diff --git a/fsw/generic-qnx/inc/cfe_psp_config.h b/fsw/generic-qnx/inc/cfe_psp_config.h index a0340dab..ee966a9b 100644 --- a/fsw/generic-qnx/inc/cfe_psp_config.h +++ b/fsw/generic-qnx/inc/cfe_psp_config.h @@ -120,9 +120,9 @@ typedef pthread_t CFE_PSP_Exception_SysTaskId_t; */ typedef struct { - struct timespec event_time; - siginfo_t si; - int32 ValidAddrs; + struct timespec event_time; + siginfo_t si; + int32 ValidAddrs; /* ** This is a variably-filled array based on the number of entries @@ -134,7 +134,7 @@ typedef struct /* ** This define sets the default core affinity for the core cFE tasks. */ -#if defined (OS_CORE_AFFINITY) +#if defined(OS_CORE_AFFINITY) #define CFE_PSP_DEFAULT_CORE_AFFINITY OS_CORE_AFFINITY #else #define CFE_PSP_DEFAULT_CORE_AFFINITY (0) diff --git a/fsw/generic-qnx/inc/cfe_psp_cpuset.h b/fsw/generic-qnx/inc/cfe_psp_cpuset.h index f184c513..3cdcb60a 100644 --- a/fsw/generic-qnx/inc/cfe_psp_cpuset.h +++ b/fsw/generic-qnx/inc/cfe_psp_cpuset.h @@ -32,15 +32,15 @@ * operating system (struct _thread_runmask) to set the runmask and inherit mask. * * Applications should not directly access fields within this structure, - * as the pointer configuration may change based on the number of processors in + * as the pointer configuration may change based on the number of processors in * the running system. */ typedef struct { - int32 size; /**< The size of the QNX run/inherit mask */ - uint32 *runmask; /**< The QNX run mask pointer */ - uint32 *inherit_mask; /**< The QNX inherit mask pointer */ - uint32 mask_data[8]; /**< The QNX run mask and inherit mask storage (supports maximum of 128 processors) */ + int32 size; /**< The size of the QNX run/inherit mask */ + uint32 *runmask; /**< The QNX run mask pointer */ + uint32 *inherit_mask; /**< The QNX inherit mask pointer */ + uint32 mask_data[8]; /**< The QNX run mask and inherit mask storage (supports maximum of 128 processors) */ } CFE_PSP_cpuset_t; /*-------------------------------------------------------------------------------------*/ @@ -58,11 +58,11 @@ static inline void CFE_PSP_CpusetZero(CFE_PSP_cpuset_t *cpuset) memset(cpuset, 0x0, sizeof(CFE_PSP_cpuset_t)); /* Set size of run mask and inherit mask */ - cpuset->size = mask_size; + cpuset->size = mask_size; /* Set run mask and inherit mask pointers */ - cpuset->runmask = &cpuset->mask_data[0]; - cpuset->inherit_mask = &cpuset->mask_data[mask_size]; + cpuset->runmask = &cpuset->mask_data[0]; + cpuset->inherit_mask = &cpuset->mask_data[mask_size]; /* Verify that cpuset has enought storage for cpus in system */ if (((sizeof(uint32) * 3) + (sizeof(uint32) * mask_size * 2)) > sizeof(CFE_PSP_cpuset_t)) diff --git a/fsw/generic-qnx/inc/psp_version.h b/fsw/generic-qnx/inc/psp_version.h index 024f6092..cdf9628f 100644 --- a/fsw/generic-qnx/inc/psp_version.h +++ b/fsw/generic-qnx/inc/psp_version.h @@ -30,14 +30,14 @@ #define CFE_PSP_IMPL_BUILD_NUMBER 0 #define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0" #define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */ -#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ +#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ /* * Version Macros, see \ref cfsversions for definitions. */ -#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ -#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ -#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ +#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ +#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ +#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ /** * @brief Last official release. @@ -68,9 +68,9 @@ /** * @brief Max Version String length. - * + * * Maximum length that a tblCRCTool version string can be. - * + * */ #define CFE_PSP_CFG_MAX_VERSION_STR_LEN 256 diff --git a/fsw/generic-qnx/src/cfe_psp_exception.c b/fsw/generic-qnx/src/cfe_psp_exception.c index 1a64bd45..647e6c45 100644 --- a/fsw/generic-qnx/src/cfe_psp_exception.c +++ b/fsw/generic-qnx/src/cfe_psp_exception.c @@ -71,7 +71,7 @@ void CFE_PSP_ExceptionSigHandler(int signo, siginfo_t *si, void *ctxt) CFE_PSP_Exception_LogData_t *Buffer; int32 NumAddrs; - /* + /* * Note that the time between CFE_PSP_Exception_GetNextContextBuffer() * and CFE_PSP_Exception_WriteComplete() is sensitive in that it is * accessing a global. @@ -97,7 +97,7 @@ void CFE_PSP_ExceptionSigHandler(int signo, siginfo_t *si, void *ctxt) */ clock_gettime(CLOCK_MONOTONIC, &Buffer->context_info.event_time); memcpy(&Buffer->context_info.si, si, sizeof(Buffer->context_info.si)); - + /* Collect QNX backtrace info */ NumAddrs = CFE_PSP_Backtrace(Buffer->context_info.Addrs, ctxt, CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE); Buffer->context_info.ValidAddrs = NumAddrs; @@ -302,7 +302,10 @@ int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer default: ComputedReason = "Unknown SIGFPE"; } - (void)snprintf(ReasonBuf, ReasonSize, "%s at ip 0x%lx", ComputedReason, + (void)snprintf(ReasonBuf, + ReasonSize, + "%s at ip 0x%lx", + ComputedReason, (unsigned long)Buffer->context_info.si.si_addr); } else if (Buffer->context_info.si.si_signo == SIGINT) diff --git a/fsw/generic-qnx/src/cfe_psp_memory.c b/fsw/generic-qnx/src/cfe_psp_memory.c index 0e8ad46d..82bac19e 100644 --- a/fsw/generic-qnx/src/cfe_psp_memory.c +++ b/fsw/generic-qnx/src/cfe_psp_memory.c @@ -58,7 +58,7 @@ #include "cfe_psp_config.h" #include "cfe_psp_memory.h" -#define CFE_PSP_KEY_FILE_NAME_LENGTH 40 +#define CFE_PSP_KEY_FILE_NAME_LENGTH 40 char CdsKeyFileName[CFE_PSP_KEY_FILE_NAME_LENGTH]; char ResetKeyFileName[CFE_PSP_KEY_FILE_NAME_LENGTH]; @@ -76,7 +76,7 @@ char ReservedKeyFileName[CFE_PSP_KEY_FILE_NAME_LENGTH]; /* * Define the PSP-supported capacities to be the maximum allowed, -*/ + */ #define CFE_PSP_CDS_SIZE (GLOBAL_CONFIGDATA.CfeConfig->CdsSize) #define CFE_PSP_RESET_AREA_SIZE (GLOBAL_CONFIGDATA.CfeConfig->ResetAreaSize) #define CFE_PSP_USER_RESERVED_SIZE (GLOBAL_CONFIGDATA.CfeConfig->UserReservedSize) @@ -96,7 +96,6 @@ void CFE_PSP_InitVolatileDiskMem(void); void CFE_PSP_InitUserReservedArea(void); void CFE_PSP_InitKeyFileNames(char *CpuName, uint32 CpuId); - /* ** External Declarations */ @@ -153,7 +152,8 @@ void CFE_PSP_InitCDS(void) /* ** attach to the segment to get a pointer to it: */ - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = mmap(NULL,CFE_PSP_CDS_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, CDSShmId, 0); + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = + mmap(NULL, CFE_PSP_CDS_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, CDSShmId, 0); if (CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr == MAP_FAILED) { perror("CFE_PSP - Cannot mmap to CDS Shared memory Segment"); @@ -176,20 +176,20 @@ void CFE_PSP_InitCDS(void) */ void CFE_PSP_DeleteCDS(void) { - int ReturnCode = 0; + int ReturnCode = 0; - /* Unmapped and unlink shared memory segment */ + /* Unmapped and unlink shared memory segment */ ReturnCode = munmap(CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr, CFE_PSP_CDS_SIZE); if (ReturnCode == 0) { ReturnCode = shm_unlink(CFE_PSP_CDS_KEY_FILE); - if(ReturnCode == 0) + if (ReturnCode == 0) { - OS_printf("User CDS Area Shared memory segment removed\n"); + OS_printf("User CDS Area Shared memory segment removed\n"); } else { - OS_printf("Error Removing User CDS Area Shared memory Segment.\n"); + OS_printf("Error Removing User CDS Area Shared memory Segment.\n"); } } else @@ -240,7 +240,7 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 { if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE)) { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; CopyPtr += CDSOffset; memcpy(CopyPtr, (char *)PtrToDataToWrite, NumBytes); @@ -275,7 +275,7 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt { if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE)) { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; CopyPtr += CDSOffset; memcpy((char *)PtrToDataToRead, CopyPtr, NumBytes); @@ -311,10 +311,10 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt */ void CFE_PSP_InitResetArea(void) { - size_t total_size; - size_t reset_offset; - size_t align_mask; - cpuaddr block_addr; + size_t total_size; + size_t reset_offset; + size_t align_mask; + cpuaddr block_addr; CFE_PSP_QnxReservedAreaFixedLayout_t *FixedBlocksPtr; /* @@ -323,12 +323,12 @@ void CFE_PSP_InitResetArea(void) * reside in this shared memory segment so it will be preserved on a processor * reset. */ - align_mask = sysconf(_SC_PAGESIZE) - 1; /* align blocks to whole memory pages */ - total_size = sizeof(CFE_PSP_QnxReservedAreaFixedLayout_t); - total_size = (total_size + align_mask) & ~align_mask; - reset_offset = total_size; - total_size += CFE_PSP_RESET_AREA_SIZE; - total_size = (total_size + align_mask) & ~align_mask; + align_mask = sysconf(_SC_PAGESIZE) - 1; /* align blocks to whole memory pages */ + total_size = sizeof(CFE_PSP_QnxReservedAreaFixedLayout_t); + total_size = (total_size + align_mask) & ~align_mask; + reset_offset = total_size; + total_size += CFE_PSP_RESET_AREA_SIZE; + total_size = (total_size + align_mask) & ~align_mask; /* ** connect to (and possibly create) the segment: @@ -343,15 +343,15 @@ void CFE_PSP_InitResetArea(void) ** attach to the segment to get a pointer to it: */ ftruncate(ResetAreaShmId, total_size); - block_addr = (cpuaddr)mmap(NULL,total_size, (PROT_READ | PROT_WRITE), MAP_SHARED, ResetAreaShmId, 0); + block_addr = (cpuaddr)mmap(NULL, total_size, (PROT_READ | PROT_WRITE), MAP_SHARED, ResetAreaShmId, 0); if (block_addr == (cpuaddr)(-1)) { perror("CFE_PSP - Cannot mmap to Reset Area Shared memory Segment"); CFE_PSP_Panic(CFE_PSP_ERROR); } - FixedBlocksPtr = (CFE_PSP_QnxReservedAreaFixedLayout_t *)block_addr; - block_addr += reset_offset; + FixedBlocksPtr = (CFE_PSP_QnxReservedAreaFixedLayout_t *)block_addr; + block_addr += reset_offset; CFE_PSP_ReservedMemoryMap.BootPtr = &FixedBlocksPtr->BootRecord; CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedBlocksPtr->ExceptionStorage; @@ -373,7 +373,7 @@ void CFE_PSP_InitResetArea(void) */ void CFE_PSP_DeleteResetArea(void) { - int ReturnCode = 0; + int ReturnCode = 0; /* Unmapped and unlink shared memory segment */ ReturnCode = munmap(CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr, CFE_PSP_RESET_AREA_SIZE); @@ -381,13 +381,13 @@ void CFE_PSP_DeleteResetArea(void) if (ReturnCode == 0) { ReturnCode = shm_unlink(CFE_PSP_RESET_KEY_FILE); - if(ReturnCode == 0) + if (ReturnCode == 0) { - OS_printf("User Reset Area Shared memory segment removed\n"); + OS_printf("User Reset Area Shared memory segment removed\n"); } else { - OS_printf("Error Removing User Reset Area Shared memory Segment.\n"); + OS_printf("Error Removing User Reset Area Shared memory Segment.\n"); } } else @@ -437,9 +437,14 @@ void CFE_PSP_InitKeyFileNames(char *CpuName, uint32 CpuId) ** Construct the key file name: ** The name will consist of "/.key_file_name" */ - snprintf(CdsKeyFileName, sizeof(CdsKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_CDS_KEY_FILE_NAME_EXT); - snprintf(ResetKeyFileName, sizeof(ResetKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_RESET_KEY_FILE_NAME_EXT); - snprintf(ReservedKeyFileName, sizeof(ReservedKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_RESERVED_KEY_FILE_NAME_EXT); + snprintf(CdsKeyFileName, sizeof(CdsKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_CDS_KEY_FILE_NAME_EXT); + snprintf(ResetKeyFileName, sizeof(ResetKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_RESET_KEY_FILE_NAME_EXT); + snprintf(ReservedKeyFileName, + sizeof(ReservedKeyFileName), + "/%s.%d.%s", + CpuName, + CpuId, + CFE_PSP_RESERVED_KEY_FILE_NAME_EXT); } /****************************************************************************** @@ -469,8 +474,8 @@ void CFE_PSP_InitUserReservedArea(void) ** attach to the segment to get a pointer to it: */ ftruncate(UserShmId, CFE_PSP_USER_RESERVED_SIZE); - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = mmap(NULL, CFE_PSP_USER_RESERVED_SIZE, - (PROT_READ | PROT_WRITE), MAP_SHARED, UserShmId, 0); + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = + mmap(NULL, CFE_PSP_USER_RESERVED_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, UserShmId, 0); if (CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr == (void *)(-1)) { perror("CFE_PSP - Cannot mmap to User Reserved Area Shared memory Segment"); @@ -493,7 +498,7 @@ void CFE_PSP_InitUserReservedArea(void) */ void CFE_PSP_DeleteUserReservedArea(void) { - int ReturnCode = 0; + int ReturnCode = 0; /* Unmapped and unlink shared memory segment */ ReturnCode = munmap(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr, CFE_PSP_USER_RESERVED_SIZE); @@ -501,13 +506,13 @@ void CFE_PSP_DeleteUserReservedArea(void) if (ReturnCode == 0) { ReturnCode = shm_unlink(CFE_PSP_RESERVED_KEY_FILE); - if(ReturnCode == 0) + if (ReturnCode == 0) { - OS_printf("User Reserved Area Shared memory segment removed\n"); + OS_printf("User Reserved Area Shared memory segment removed\n"); } else { - OS_printf("Error Removing User Reserved Area Shared memory Segment.\n"); + OS_printf("Error Removing User Reserved Area Shared memory Segment.\n"); } } else @@ -661,7 +666,8 @@ int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) memset(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr, 0, CFE_PSP_USER_RESERVED_SIZE); memset(CFE_PSP_ReservedMemoryMap.BootPtr, 0, sizeof(*CFE_PSP_ReservedMemoryMap.BootPtr)); - memset(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr, 0, + memset(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr, + 0, sizeof(*CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr)); /* diff --git a/fsw/generic-qnx/src/cfe_psp_start.c b/fsw/generic-qnx/src/cfe_psp_start.c index 62327390..ba5917ff 100644 --- a/fsw/generic-qnx/src/cfe_psp_start.c +++ b/fsw/generic-qnx/src/cfe_psp_start.c @@ -115,7 +115,7 @@ typedef struct */ void CFE_PSP_DisplayUsage(char *Name); void CFE_PSP_ProcessArgumentDefaults(CFE_PSP_CommandData_t *CommandDataDefault); -int pthread_setname_np(pthread_t tid, const char* newname); +int pthread_setname_np(pthread_t tid, const char *newname); void CFE_PSP_InitKeyFileNames(char *CpuName, uint32 CpuId); /* @@ -137,13 +137,15 @@ static const char *optString = "R:S:C:I:N:h"; /* ** getopts_long long form argument table */ -static const struct option longOpts[] = {{"reset", required_argument, NULL, 'R'}, - {"subtype", required_argument, NULL, 'S'}, - {"cpuid", required_argument, NULL, 'C'}, - {"scid", required_argument, NULL, 'I'}, - {"cpuname", required_argument, NULL, 'N'}, - {"help", no_argument, NULL, 'h'}, - {NULL, no_argument, NULL, 0}}; +static const struct option longOpts[] = { + { "reset", required_argument, NULL, 'R' }, + { "subtype", required_argument, NULL, 'S' }, + { "cpuid", required_argument, NULL, 'C' }, + { "scid", required_argument, NULL, 'I' }, + { "cpuname", required_argument, NULL, 'N' }, + { "help", no_argument, NULL, 'h' }, + { NULL, no_argument, NULL, 0 } +}; /****************************************************************************** ** @@ -189,10 +191,10 @@ int32 CFE_PSP_OS_EventHandler(OS_Event_t event, osal_id_t object_id, void *data) */ if (strncmp(taskname, "CFE_", 4) == 0) { - /* Set the runmask and inherit mask for each processor that the current - * thread can run on. */ - CFE_PSP_CpusetSetCore(&runmask, CFE_PSP_DEFAULT_CORE_AFFINITY); - ThreadCtl(_NTO_TCTL_RUNMASK_GET_AND_SET_INHERIT, &runmask); + /* Set the runmask and inherit mask for each processor that the current + * thread can run on. */ + CFE_PSP_CpusetSetCore(&runmask, CFE_PSP_DEFAULT_CORE_AFFINITY); + ThreadCtl(_NTO_TCTL_RUNMASK_GET_AND_SET_INHERIT, &runmask); } /* @@ -205,7 +207,7 @@ int32 CFE_PSP_OS_EventHandler(OS_Event_t event, osal_id_t object_id, void *data) { taskname[CFE_PSP_KERNEL_NAME_LENGTH_MAX - 1] = 0; } - + /* Set thread name using non-posix function provided by QNX OS extension. */ pthread_setname_np(pthread_self(), taskname); } @@ -261,8 +263,8 @@ void OS_Application_Startup(void) strncpy(CommandData.ResetType, optarg, CFE_PSP_RESET_NAME_LENGTH - 1); CommandData.ResetType[CFE_PSP_RESET_NAME_LENGTH - 1] = 0; - if ((strncmp(CommandData.ResetType, "PO", CFE_PSP_RESET_NAME_LENGTH) != 0) && - (strncmp(CommandData.ResetType, "PR", CFE_PSP_RESET_NAME_LENGTH) != 0)) + if ((strncmp(CommandData.ResetType, "PO", CFE_PSP_RESET_NAME_LENGTH) != 0) + && (strncmp(CommandData.ResetType, "PR", CFE_PSP_RESET_NAME_LENGTH) != 0)) { printf("\nERROR: Invalid Reset Type: %s\n\n", CommandData.ResetType); CommandData.GotResetType = 0; @@ -406,8 +408,8 @@ void OS_Application_Startup(void) reset_type = 0; if (!CommandData.GotResetType) { - if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID || - CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) + if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID + || CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) { reset_type = CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType; } @@ -485,8 +487,8 @@ void OS_Application_Run(void) /* go idle and wait for an event */ ret = sigwait(&sigset, &sig); - if (ret == 0 && !CFE_PSP_IdleTaskState.ShutdownReq && sig == CFE_PSP_EXCEPTION_EVENT_SIGNAL && - GLOBAL_CFE_CONFIGDATA.SystemNotify != NULL) + if (ret == 0 && !CFE_PSP_IdleTaskState.ShutdownReq && sig == CFE_PSP_EXCEPTION_EVENT_SIGNAL + && GLOBAL_CFE_CONFIGDATA.SystemNotify != NULL) { /* notify the CFE of the event */ GLOBAL_CFE_CONFIGDATA.SystemNotify(); diff --git a/fsw/generic-qnx/src/cfe_psp_support.c b/fsw/generic-qnx/src/cfe_psp_support.c index c4520140..4c7e4378 100644 --- a/fsw/generic-qnx/src/cfe_psp_support.c +++ b/fsw/generic-qnx/src/cfe_psp_support.c @@ -51,7 +51,6 @@ extern uint32 CFE_PSP_SpacecraftId; extern uint32 CFE_PSP_CpuId; extern char CFE_PSP_CpuName[]; - /*---------------------------------------------------------------- * * Implemented per public API diff --git a/fsw/generic-qnx/src/cfe_psp_watchdog.c b/fsw/generic-qnx/src/cfe_psp_watchdog.c index 09df80e2..4cd1f960 100644 --- a/fsw/generic-qnx/src/cfe_psp_watchdog.c +++ b/fsw/generic-qnx/src/cfe_psp_watchdog.c @@ -82,7 +82,9 @@ void CFE_PSP_WatchdogInit(void) * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_PSP_WatchdogEnable(void) {} +void CFE_PSP_WatchdogEnable(void) +{ +} /*---------------------------------------------------------------- * @@ -90,7 +92,9 @@ void CFE_PSP_WatchdogEnable(void) {} * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_PSP_WatchdogDisable(void) {} +void CFE_PSP_WatchdogDisable(void) +{ +} /*---------------------------------------------------------------- * @@ -98,7 +102,9 @@ void CFE_PSP_WatchdogDisable(void) {} * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_PSP_WatchdogService(void) {} +void CFE_PSP_WatchdogService(void) +{ +} /*---------------------------------------------------------------- * diff --git a/fsw/generic-vxworks-dkm/inc/cfe_psp_config.h b/fsw/generic-vxworks-dkm/inc/cfe_psp_config.h index 28df71d3..4eb19a40 100644 --- a/fsw/generic-vxworks-dkm/inc/cfe_psp_config.h +++ b/fsw/generic-vxworks-dkm/inc/cfe_psp_config.h @@ -38,7 +38,7 @@ * in nanoseconds, and then further dividing by the OSAL OS_time_t tick * resolution will convert to an OS_time_t compatible value. * - * This needs to be set to the correct timebase for the BSP + * This needs to be set to the correct timebase for the BSP * * Note this is distinct from the VxWorks system timer tick which runs, * confusingly, at 60Hz or a ~16.67ms period. diff --git a/fsw/generic-vxworks-dkm/inc/psp_version.h b/fsw/generic-vxworks-dkm/inc/psp_version.h index 024f6092..cdf9628f 100644 --- a/fsw/generic-vxworks-dkm/inc/psp_version.h +++ b/fsw/generic-vxworks-dkm/inc/psp_version.h @@ -30,14 +30,14 @@ #define CFE_PSP_IMPL_BUILD_NUMBER 0 #define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0" #define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */ -#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ +#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ /* * Version Macros, see \ref cfsversions for definitions. */ -#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ -#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ -#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ +#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ +#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ +#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ /** * @brief Last official release. @@ -68,9 +68,9 @@ /** * @brief Max Version String length. - * + * * Maximum length that a tblCRCTool version string can be. - * + * */ #define CFE_PSP_CFG_MAX_VERSION_STR_LEN 256 diff --git a/fsw/generic-vxworks-dkm/src/bsp-integration/cfeSupport.c b/fsw/generic-vxworks-dkm/src/bsp-integration/cfeSupport.c index 1df0704a..2893408a 100644 --- a/fsw/generic-vxworks-dkm/src/bsp-integration/cfeSupport.c +++ b/fsw/generic-vxworks-dkm/src/bsp-integration/cfeSupport.c @@ -75,8 +75,8 @@ void *GetWrsKernelTextEnd(void) void showKernelCodeAddrs(void) { - printf("&wrs_kernel_text_start = 0x%lX\n",(unsigned long)&wrs_kernel_text_start); - printf("&wrs_kernel_text_end = 0x%lX\n",(unsigned long)&wrs_kernel_text_end); + printf("&wrs_kernel_text_start = 0x%lX\n", (unsigned long)&wrs_kernel_text_start); + printf("&wrs_kernel_text_end = 0x%lX\n", (unsigned long)&wrs_kernel_text_end); } /* @@ -90,23 +90,23 @@ int startCfeCore(char *cfepath) MODULE_ID moduleID; SYMBOL_DESC SymDesc; char *symValue; - void (*cFEFuncPtr)(void); - char cfeCorePath[CFE_CORE_PATH_LEN]; - TASK_ID cfeTaskId; + void (*cFEFuncPtr)(void); + char cfeCorePath[CFE_CORE_PATH_LEN]; + TASK_ID cfeTaskId; /* * Copy the cFE Core path that was passed in */ if (cfepath != NULL) { - snprintf(cfeCorePath, CFE_CORE_PATH_LEN, "%s", cfepath); + snprintf(cfeCorePath, CFE_CORE_PATH_LEN, "%s", cfepath); } else { - strncpy(cfeCorePath, CFE_CORE_PATH_DEF, CFE_CORE_PATH_LEN); + strncpy(cfeCorePath, CFE_CORE_PATH_DEF, CFE_CORE_PATH_LEN); } - printf("cFE Core path to load is: %s\n",cfeCorePath); + printf("cFE Core path to load is: %s\n", cfeCorePath); /* ** Open the cFE core module @@ -163,13 +163,11 @@ int startCfeCore(char *cfepath) cFEFuncPtr = (void *)symValue; /* spawn the async output helper task */ - cfeTaskId = taskSpawn("CFS_IDLE", 200, 0, 16384, - (FUNCPTR)cFEFuncPtr, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + cfeTaskId = taskSpawn("CFS_IDLE", 200, 0, 16384, (FUNCPTR)cFEFuncPtr, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); if (cfeTaskId == TASK_ID_ERROR) { printf("taskSpawn() Error - vxWorks errno %d\n", errno); - return(-1); + return (-1); } /* diff --git a/fsw/generic-vxworks-dkm/src/cfe_psp_exception.c b/fsw/generic-vxworks-dkm/src/cfe_psp_exception.c index cb9c609e..d523a9d5 100644 --- a/fsw/generic-vxworks-dkm/src/cfe_psp_exception.c +++ b/fsw/generic-vxworks-dkm/src/cfe_psp_exception.c @@ -112,13 +112,13 @@ void CFE_PSP_ExceptionHook(TASK_ID task_id, int vector, void *vpEsf) Buffer = CFE_PSP_Exception_GetNextContextBuffer(); if (Buffer != NULL) { - /* - * Immediately get the time when exception occurred - * - * This is because the remainder of exception processing might be done - * in a cleanup job as a low priority background task, and might be - * considerably delayed from the time the actual exception occurred. - */ + /* + * Immediately get the time when exception occurred + * + * This is because the remainder of exception processing might be done + * in a cleanup job as a low priority background task, and might be + * considerably delayed from the time the actual exception occurred. + */ OS_GetLocalTime(&Buffer->context_info.time_stamp); Buffer->sys_task_id = task_id; @@ -158,7 +158,7 @@ void CFE_PSP_ExceptionHook(TASK_ID task_id, int vector, void *vpEsf) *-----------------------------------------------------------------*/ void CFE_PSP_SetDefaultExceptionEnvironment(void) { - return; + return; } /* @@ -178,8 +178,12 @@ int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer TaskName = "NULL"; } - snprintf(ReasonBuf, ReasonSize, "Vector=0x%06X, vxWorks Task Name=%s, Task ID=0x%08X", Buffer->context_info.vector, - TaskName, Buffer->sys_task_id); + snprintf(ReasonBuf, + ReasonSize, + "Vector=0x%06X, vxWorks Task Name=%s, Task ID=0x%08X", + Buffer->context_info.vector, + TaskName, + Buffer->sys_task_id); return CFE_PSP_SUCCESS; } diff --git a/fsw/generic-vxworks-dkm/src/cfe_psp_memory.c b/fsw/generic-vxworks-dkm/src/cfe_psp_memory.c index 717a0b20..ebff62cc 100644 --- a/fsw/generic-vxworks-dkm/src/cfe_psp_memory.c +++ b/fsw/generic-vxworks-dkm/src/cfe_psp_memory.c @@ -50,7 +50,7 @@ #include #include -/* Note that usage of this reserved memory implementation requires the INCLUDE_USER_RESERVED_MEMORY +/* Note that usage of this reserved memory implementation requires the INCLUDE_USER_RESERVED_MEMORY * component with CLEAR_USER_RESERVED_MEMORY_ON_COLD_BOOT set to FALSE */ /* @@ -97,7 +97,7 @@ extern void *GetWrsKernelTextEnd(void); /* ** Dynamic map of the reserved memory area */ -CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap = {0}; +CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap = { 0 }; CFE_PSP_MemoryBlock_t VxWorks_ReservedMemBlock; @@ -146,10 +146,10 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 } else { - if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) && - ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) + if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) + && ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; CopyPtr += CDSOffset; memcpy((char *)CopyPtr, (char *)PtrToDataToWrite, NumBytes); @@ -182,10 +182,10 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt } else { - if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) && - ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) + if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) + && ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; CopyPtr += CDSOffset; memcpy((char *)PtrToDataToRead, (char *)CopyPtr, NumBytes); @@ -297,7 +297,6 @@ int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) ********************************************************************************* */ - /****************************************************************************** ** ** Purpose: @@ -338,15 +337,15 @@ int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) void CFE_PSP_SetupReservedMemoryMap(void) { CFE_PSP_VxWorksReservedAreaFixedLayout_t *FixedPtr; - cpuaddr ReservedMemoryAddr; - size_t FixedSize; - size_t ResetSize; - size_t CDSSize; - size_t UserReservedSize; - size_t VolatileDiskSize; - size_t RequiredSize; - char *ReservedMemoryStart; - size_t ReservedMemorySize; + cpuaddr ReservedMemoryAddr; + size_t FixedSize; + size_t ResetSize; + size_t CDSSize; + size_t UserReservedSize; + size_t VolatileDiskSize; + size_t RequiredSize; + char *ReservedMemoryStart; + size_t ReservedMemorySize; /* TODO: do we need both ReservedMemoryStart and ReservedMemoryAddr */ /* @@ -366,7 +365,7 @@ void CFE_PSP_SetupReservedMemoryMap(void) UserReservedSize = (UserReservedSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; /* Calculate the required size, adding padding so that each element is aligned */ - RequiredSize = FixedSize; + RequiredSize = FixedSize; RequiredSize += ResetSize; RequiredSize += VolatileDiskSize; RequiredSize += CDSSize; @@ -376,12 +375,13 @@ void CFE_PSP_SetupReservedMemoryMap(void) /* Since we need to have at least RequiredSize amount of reserved memory, * we have to check if there is enough given by the userReservedGet() call. - * Since the size of user reserved memory is a static constant built into - * the kernel at build time, there is no recourse here. Either RequiredSize + * Since the size of user reserved memory is a static constant built into + * the kernel at build time, there is no recourse here. Either RequiredSize * must be reduced or the kernel build must change to support more memory * by changing the USER_RESERVED_MEM component. */ userReservedGet(&ReservedMemoryStart, &ReservedMemorySize); - if (ReservedMemorySize < RequiredSize || ReservedMemoryStart == NULL) { + if (ReservedMemorySize < RequiredSize || ReservedMemoryStart == NULL) + { OS_printf("CFE_PSP: Error: Cannot get BSP reserved memory\n"); abort(); } @@ -389,38 +389,39 @@ void CFE_PSP_SetupReservedMemoryMap(void) OS_printf("Size of BSP reserved memory = %u bytes\n", (unsigned int)RequiredSize); /* with the INCLUDE_USER_RESERVED_MEMORY configuration, we don't need to allocate - * any memory here. We can just set this variable to the address given by + * any memory here. We can just set this variable to the address given by * userReservedGet(). */ VxWorks_ReservedMemBlock.BlockPtr = ReservedMemoryStart; VxWorks_ReservedMemBlock.BlockSize = RequiredSize; ReservedMemoryAddr = (cpuaddr)VxWorks_ReservedMemBlock.BlockPtr; - OS_printf("CFE_PSP: Allocated %u bytes for PSP reserved memory at: 0x%08lX\n", (unsigned int)RequiredSize, + OS_printf("CFE_PSP: Allocated %u bytes for PSP reserved memory at: 0x%08lX\n", + (unsigned int)RequiredSize, (unsigned long)ReservedMemoryAddr); FixedPtr = (CFE_PSP_VxWorksReservedAreaFixedLayout_t *)ReservedMemoryAddr; - CFE_PSP_ReservedMemoryMap.BootPtr = &FixedPtr->BootRecord; - CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedPtr->ExceptionStorage; - ReservedMemoryAddr += FixedSize; + CFE_PSP_ReservedMemoryMap.BootPtr = &FixedPtr->BootRecord; + CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedPtr->ExceptionStorage; + ReservedMemoryAddr += FixedSize; - CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void *)ReservedMemoryAddr; - CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = CFE_PSP_RESET_AREA_SIZE; - ReservedMemoryAddr += ResetSize; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = CFE_PSP_RESET_AREA_SIZE; + ReservedMemoryAddr += ResetSize; CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr = (void *)ReservedMemoryAddr; CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize = (CFE_PSP_RAM_DISK_SECTOR_SIZE * CFE_PSP_RAM_DISK_NUM_SECTORS); ReservedMemoryAddr += VolatileDiskSize; - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = (void *)ReservedMemoryAddr; - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = CFE_PSP_CDS_SIZE; - ReservedMemoryAddr += CDSSize; + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = CFE_PSP_CDS_SIZE; + ReservedMemoryAddr += CDSSize; - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = (void *)ReservedMemoryAddr; - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = CFE_PSP_USER_RESERVED_SIZE; - ReservedMemoryAddr += UserReservedSize; + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = CFE_PSP_USER_RESERVED_SIZE; + ReservedMemoryAddr += UserReservedSize; /* * displaying the final address shows how much was actually used, diff --git a/fsw/generic-vxworks-dkm/src/cfe_psp_ssr.c b/fsw/generic-vxworks-dkm/src/cfe_psp_ssr.c index 40283654..872f1606 100644 --- a/fsw/generic-vxworks-dkm/src/cfe_psp_ssr.c +++ b/fsw/generic-vxworks-dkm/src/cfe_psp_ssr.c @@ -57,7 +57,7 @@ *-----------------------------------------------------------------*/ int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName) { - int32 ReturnCode = CFE_PSP_SUCCESS; + int32 ReturnCode = CFE_PSP_SUCCESS; return ReturnCode; } diff --git a/fsw/generic-vxworks-dkm/src/cfe_psp_start.c b/fsw/generic-vxworks-dkm/src/cfe_psp_start.c index 7f7ec3dc..23e00744 100644 --- a/fsw/generic-vxworks-dkm/src/cfe_psp_start.c +++ b/fsw/generic-vxworks-dkm/src/cfe_psp_start.c @@ -113,7 +113,7 @@ void OS_Application_Startup(void) ** Currently, the generic VxWorks 7 DKM works with a ROMFS statically ** built into the VIP since that is easily supportable across ** most platforms. However, this may need to change based on - ** specfic needs. + ** specfic needs. */ Status = OS_FileSysAddFixedMap(&fs_id, CFE_PSP_CF_ROMFS_VIRTUAL_MAPPING, "/cf"); if (Status != OS_SUCCESS) diff --git a/fsw/generic-vxworks-dkm/src/cfe_psp_watchdog.c b/fsw/generic-vxworks-dkm/src/cfe_psp_watchdog.c index a14816f9..cbf48beb 100644 --- a/fsw/generic-vxworks-dkm/src/cfe_psp_watchdog.c +++ b/fsw/generic-vxworks-dkm/src/cfe_psp_watchdog.c @@ -78,9 +78,9 @@ int CFE_PSP_WatchdogFd = ERROR; * hard CPU lockups. When supporting a specific platform, be sure to use * its hardware watchdog capabilities. If there are no hardware watchdog * capabilities, then this virtual watchdog implementation is a good option. - * - * Additionally, be sure to set VIRT_WDT_NO_REBOOT component to FALSE to - * enable reboot capabilities. This can be found in workbench by either + * + * Additionally, be sure to set VIRT_WDT_NO_REBOOT component to FALSE to + * enable reboot capabilities. This can be found in workbench by either * searching for it in kernel config or by navigating to * VIP -> Harware -> Watchdog -> Virtual Timer Watchdog */ @@ -93,18 +93,18 @@ int CFE_PSP_WatchdogFd = ERROR; *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogInit(void) { - DEV_HDR *WatchdogHeader; - STATUS Status; + DEV_HDR *WatchdogHeader; + STATUS Status; struct watchdog_info WatchdogInfo; - int WatchdogOptions; - + int WatchdogOptions; /* check to see if the virtual watchdog device has been installed. This is * done automatically when VIP is configured with DRV_VIRTUAL_TIMER_WATCHDOG */ WatchdogHeader = iosDevFindExact("/watchdog/0"); if (WatchdogHeader == NULL) { - printf("failed to initialize watchdog driver. Be sure to add DRV_VIRTUAL_TIMER_WATCHDOG component to VxWorks VIP\n"); + printf("failed to initialize watchdog driver. Be sure to add DRV_VIRTUAL_TIMER_WATCHDOG component to VxWorks " + "VIP\n"); return; } @@ -120,13 +120,14 @@ void CFE_PSP_WatchdogInit(void) return; } - /* According to the WindRiver docs on the virtual watchdog timer, the - * watchdog is activated when the file is opened. The default timeout + /* According to the WindRiver docs on the virtual watchdog timer, the + * watchdog is activated when the file is opened. The default timeout * is 60 seconds. Thus, to avoid having the timer expire from just * calling CFE_PSP_WatchdogInit(), we disable the watchdog here */ WatchdogOptions = WDIOS_DISABLECARD; - Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_SETOPTIONS, &WatchdogOptions); - if (Status != OK) { + Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_SETOPTIONS, &WatchdogOptions); + if (Status != OK) + { printf("failed to initialize watchdog\n"); close(CFE_PSP_WatchdogFd); } @@ -141,7 +142,10 @@ void CFE_PSP_WatchdogInit(void) } else { - printf("initialized watchdog with name: %s version: %u flags: %u\n", WatchdogInfo.name, WatchdogInfo.version, WatchdogInfo.flags); + printf("initialized watchdog with name: %s version: %u flags: %u\n", + WatchdogInfo.name, + WatchdogInfo.version, + WatchdogInfo.flags); } } @@ -154,17 +158,19 @@ void CFE_PSP_WatchdogInit(void) void CFE_PSP_WatchdogEnable(void) { STATUS Status; - int WatchdogOptions; + int WatchdogOptions; - if (CFE_PSP_WatchdogFd < 0) { + if (CFE_PSP_WatchdogFd < 0) + { printf("failed to initialize watchdog beforehand\n"); return; } /* See vxbVirtualTimerWatchdog WindRiver docs for more detail */ WatchdogOptions = WDIOS_ENABLECARD; - Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_SETOPTIONS, &WatchdogOptions); - if (Status != OK) { + Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_SETOPTIONS, &WatchdogOptions); + if (Status != OK) + { printf("failed to enable watchdog\n"); close(CFE_PSP_WatchdogFd); } @@ -179,16 +185,18 @@ void CFE_PSP_WatchdogEnable(void) void CFE_PSP_WatchdogDisable(void) { STATUS Status; - int WatchdogOptions; + int WatchdogOptions; - if (CFE_PSP_WatchdogFd < 0) { + if (CFE_PSP_WatchdogFd < 0) + { printf("failed to initialize watchdog beforehand\n"); return; } WatchdogOptions = WDIOS_DISABLECARD; - Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_SETOPTIONS, &WatchdogOptions); - if (Status != OK) { + Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_SETOPTIONS, &WatchdogOptions); + if (Status != OK) + { printf("failed to disable watchdog\n"); close(CFE_PSP_WatchdogFd); } @@ -203,14 +211,16 @@ void CFE_PSP_WatchdogDisable(void) void CFE_PSP_WatchdogService(void) { STATUS Status; - - if (CFE_PSP_WatchdogFd < 0) { + + if (CFE_PSP_WatchdogFd < 0) + { printf("failed to initialize watchdog beforehand\n"); return; } Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_KEEPALIVE, 0); - if (Status != OK) { + if (Status != OK) + { printf("failed to service watchdog\n"); close(CFE_PSP_WatchdogFd); } @@ -227,14 +237,16 @@ uint32 CFE_PSP_WatchdogGet(void) STATUS Status; uint32 WatchdogValue; - if (CFE_PSP_WatchdogFd < 0) { + if (CFE_PSP_WatchdogFd < 0) + { printf("failed to initialize watchdog beforehand\n"); return 0; } WatchdogValue = 0; - Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_GETTIMEOUT, &WatchdogValue); - if (Status != OK) { + Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_GETTIMEOUT, &WatchdogValue); + if (Status != OK) + { printf("failed to get watchdog timeout\n"); close(CFE_PSP_WatchdogFd); } @@ -254,13 +266,15 @@ void CFE_PSP_WatchdogSet(uint32 WatchdogValue) { STATUS Status; - if (CFE_PSP_WatchdogFd < 0) { + if (CFE_PSP_WatchdogFd < 0) + { printf("failed to initialize watchdog beforehand\n"); return; } Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_SETTIMEOUT, &WatchdogValue); - if (Status != OK) { + if (Status != OK) + { printf("failed to set watchdog timeout\n"); close(CFE_PSP_WatchdogFd); } diff --git a/fsw/generic-vxworks-rtp/inc/cfe_psp_config.h b/fsw/generic-vxworks-rtp/inc/cfe_psp_config.h index 3c76b6fb..f7c952e9 100644 --- a/fsw/generic-vxworks-rtp/inc/cfe_psp_config.h +++ b/fsw/generic-vxworks-rtp/inc/cfe_psp_config.h @@ -37,7 +37,7 @@ * in nanoseconds, and then further dividing by the OSAL OS_time_t tick * resolution will convert to an OS_time_t compatible value. * - * This needs to be set to the correct timebase for the BSP + * This needs to be set to the correct timebase for the BSP * * Note this is distinct from the VxWorks system timer tick which runs, * confusingly, at 60Hz or a ~16.67ms period. @@ -70,7 +70,6 @@ */ #define CFE_PSP_SOFT_TIMEBASE_PERIOD 16666 - /* * A random 32-bit value that is used as the "validity flag" * of the PC-Linux boot record structure. This is simply @@ -90,14 +89,12 @@ /* use the "USR1" signal to wake the idle thread when an exception occurs */ #define CFE_PSP_EXCEPTION_EVENT_SIGNAL SIGUSR1 +#define CFE_PSP_SHM_NAME_LENGTH 32 +#define CFE_PSP_CPU_NAME_LENGTH 32 +#define CFE_PSP_RESET_NAME_LENGTH 10 +#define CFE_PSP_CFS_ID_LENGTH 16 - -#define CFE_PSP_SHM_NAME_LENGTH 32 -#define CFE_PSP_CPU_NAME_LENGTH 32 -#define CFE_PSP_RESET_NAME_LENGTH 10 -#define CFE_PSP_CFS_ID_LENGTH 16 - -#define CFE_PSP_CFS_ID "cfs1" +#define CFE_PSP_CFS_ID "cfs1" /* ** Typedef for the layout of the vxWorks boot record structure @@ -128,7 +125,6 @@ typedef struct volatile bool ShutdownReq; } CFE_PSP_IdleTaskState_t; - /* ** Structure for the Command line parameters */ @@ -143,8 +139,8 @@ typedef struct char CpuName[CFE_PSP_CPU_NAME_LENGTH]; /* CPU Name */ uint32 GotCpuName; /* Did we get a CPU Name ? */ - char CfsId[CFE_PSP_CFS_ID_LENGTH]; /* CFS ID */ - uint32 GotCfsId; /* Did we get a cFS Id? */ + char CfsId[CFE_PSP_CFS_ID_LENGTH]; /* CFS ID */ + uint32 GotCfsId; /* Did we get a cFS Id? */ uint32 CpuId; /* CPU ID */ uint32 GotCpuId; /* Did we get a CPU Id ?*/ @@ -153,7 +149,6 @@ typedef struct uint32 GotSpacecraftId; /* Did we get a Spacecraft ID */ } CFE_PSP_CommandData_t; - /** * \brief The data type used by the underlying OS to represent a thread ID. */ @@ -175,7 +170,6 @@ typedef struct void *bt_addrs[CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE]; } CFE_PSP_Exception_ContextDataEntry_t; - /* ** Watchdog minimum and maximum values ( in milliseconds ) */ diff --git a/fsw/generic-vxworks-rtp/inc/psp_version.h b/fsw/generic-vxworks-rtp/inc/psp_version.h index 024f6092..cdf9628f 100644 --- a/fsw/generic-vxworks-rtp/inc/psp_version.h +++ b/fsw/generic-vxworks-rtp/inc/psp_version.h @@ -30,14 +30,14 @@ #define CFE_PSP_IMPL_BUILD_NUMBER 0 #define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0" #define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */ -#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ +#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ /* * Version Macros, see \ref cfsversions for definitions. */ -#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ -#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ -#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ +#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ +#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ +#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ /** * @brief Last official release. @@ -68,9 +68,9 @@ /** * @brief Max Version String length. - * + * * Maximum length that a tblCRCTool version string can be. - * + * */ #define CFE_PSP_CFG_MAX_VERSION_STR_LEN 256 diff --git a/fsw/generic-vxworks-rtp/parg/parg.c b/fsw/generic-vxworks-rtp/parg/parg.c index bf2e88af..03e246d0 100644 --- a/fsw/generic-vxworks-rtp/parg/parg.c +++ b/fsw/generic-vxworks-rtp/parg/parg.c @@ -30,207 +30,227 @@ /* * Check if state is at end of argv. */ -static int -is_argv_end(const struct parg_state *ps, int argc, char *const argv[]) +static int is_argv_end(const struct parg_state *ps, int argc, char *const argv[]) { - return ps->optind >= argc || argv[ps->optind] == NULL; + return ps->optind >= argc || argv[ps->optind] == NULL; } /* * Match nextchar against optstring. */ -static int -match_short(struct parg_state *ps, int argc, char *const argv[], - const char *optstring) +static int match_short(struct parg_state *ps, int argc, char *const argv[], const char *optstring) { - const char *p = strchr(optstring, *ps->nextchar); - - if (p == NULL) { - ps->optopt = *ps->nextchar++; - return '?'; - } - - /* If no option argument, return option */ - if (p[1] != ':') { - return *ps->nextchar++; - } - - /* If more characters, return as option argument */ - if (ps->nextchar[1] != '\0') { - ps->optarg = &ps->nextchar[1]; - ps->nextchar = NULL; - return *p; - } - - /* If option argument is optional, return option */ - if (p[2] == ':') { - return *ps->nextchar++; - } - - /* Option argument required, so return next argv element */ - if (is_argv_end(ps, argc, argv)) { - ps->optopt = *ps->nextchar++; - return optstring[0] == ':' ? ':' : '?'; - } - - ps->optarg = argv[ps->optind++]; - ps->nextchar = NULL; - return *p; + const char *p = strchr(optstring, *ps->nextchar); + + if (p == NULL) + { + ps->optopt = *ps->nextchar++; + return '?'; + } + + /* If no option argument, return option */ + if (p[1] != ':') + { + return *ps->nextchar++; + } + + /* If more characters, return as option argument */ + if (ps->nextchar[1] != '\0') + { + ps->optarg = &ps->nextchar[1]; + ps->nextchar = NULL; + return *p; + } + + /* If option argument is optional, return option */ + if (p[2] == ':') + { + return *ps->nextchar++; + } + + /* Option argument required, so return next argv element */ + if (is_argv_end(ps, argc, argv)) + { + ps->optopt = *ps->nextchar++; + return optstring[0] == ':' ? ':' : '?'; + } + + ps->optarg = argv[ps->optind++]; + ps->nextchar = NULL; + return *p; } /* * Match string at nextchar against longopts. */ -static int -match_long(struct parg_state *ps, int argc, char *const argv[], - const char *optstring, - const struct parg_option *longopts, int *longindex) +static int match_long(struct parg_state *ps, + int argc, + char *const argv[], + const char *optstring, + const struct parg_option *longopts, + int *longindex) { - size_t len; - int num_match = 0; - int match = -1; - int i; - - len = strcspn(ps->nextchar, "="); - - for (i = 0; longopts[i].name; ++i) { - if (strncmp(ps->nextchar, longopts[i].name, len) == 0) { - match = i; - num_match++; - /* Take if exact match */ - if (longopts[i].name[len] == '\0') { - num_match = 1; - break; - } - } - } - - /* Return '?' on no or ambiguous match */ - if (num_match != 1) { - ps->optopt = 0; - ps->nextchar = NULL; - return '?'; - } - - assert(match != -1); - - if (longindex) { - *longindex = match; - } - - if (ps->nextchar[len] == '=') { - /* Option argument present, check if extraneous */ - if (longopts[match].has_arg == PARG_NOARG) { - ps->optopt = longopts[match].flag ? 0 : longopts[match].val; - ps->nextchar = NULL; - return optstring[0] == ':' ? ':' : '?'; - } - else { - ps->optarg = &ps->nextchar[len + 1]; - } - } - else if (longopts[match].has_arg == PARG_REQARG) { - /* Option argument required, so return next argv element */ - if (is_argv_end(ps, argc, argv)) { - ps->optopt = longopts[match].flag ? 0 : longopts[match].val; - ps->nextchar = NULL; - return optstring[0] == ':' ? ':' : '?'; - } - - ps->optarg = argv[ps->optind++]; - } - - ps->nextchar = NULL; - - if (longopts[match].flag != NULL) { - *longopts[match].flag = longopts[match].val; - return 0; - } - - return longopts[match].val; + size_t len; + int num_match = 0; + int match = -1; + int i; + + len = strcspn(ps->nextchar, "="); + + for (i = 0; longopts[i].name; ++i) + { + if (strncmp(ps->nextchar, longopts[i].name, len) == 0) + { + match = i; + num_match++; + /* Take if exact match */ + if (longopts[i].name[len] == '\0') + { + num_match = 1; + break; + } + } + } + + /* Return '?' on no or ambiguous match */ + if (num_match != 1) + { + ps->optopt = 0; + ps->nextchar = NULL; + return '?'; + } + + assert(match != -1); + + if (longindex) + { + *longindex = match; + } + + if (ps->nextchar[len] == '=') + { + /* Option argument present, check if extraneous */ + if (longopts[match].has_arg == PARG_NOARG) + { + ps->optopt = longopts[match].flag ? 0 : longopts[match].val; + ps->nextchar = NULL; + return optstring[0] == ':' ? ':' : '?'; + } + else + { + ps->optarg = &ps->nextchar[len + 1]; + } + } + else if (longopts[match].has_arg == PARG_REQARG) + { + /* Option argument required, so return next argv element */ + if (is_argv_end(ps, argc, argv)) + { + ps->optopt = longopts[match].flag ? 0 : longopts[match].val; + ps->nextchar = NULL; + return optstring[0] == ':' ? ':' : '?'; + } + + ps->optarg = argv[ps->optind++]; + } + + ps->nextchar = NULL; + + if (longopts[match].flag != NULL) + { + *longopts[match].flag = longopts[match].val; + return 0; + } + + return longopts[match].val; } -void -parg_init(struct parg_state *ps) +void parg_init(struct parg_state *ps) { - ps->optarg = NULL; - ps->optind = 1; - ps->optopt = '?'; - ps->nextchar = NULL; + ps->optarg = NULL; + ps->optind = 1; + ps->optopt = '?'; + ps->nextchar = NULL; } -int -parg_getopt(struct parg_state *ps, int argc, char *const argv[], - const char *optstring) +int parg_getopt(struct parg_state *ps, int argc, char *const argv[], const char *optstring) { - return parg_getopt_long(ps, argc, argv, optstring, NULL, NULL); + return parg_getopt_long(ps, argc, argv, optstring, NULL, NULL); } -int -parg_getopt_long(struct parg_state *ps, int argc, char *const argv[], - const char *optstring, - const struct parg_option *longopts, int *longindex) +int parg_getopt_long(struct parg_state *ps, + int argc, + char *const argv[], + const char *optstring, + const struct parg_option *longopts, + int *longindex) { - assert(ps != NULL); - assert(argv != NULL); - assert(optstring != NULL); - - ps->optarg = NULL; - - if (argc < 2) { - return -1; - } - - /* Advance to next element if needed */ - if (ps->nextchar == NULL || *ps->nextchar == '\0') { - if (is_argv_end(ps, argc, argv)) { - return -1; - } - - ps->nextchar = argv[ps->optind++]; - - /* Check for nonoption element (including '-') */ - if (ps->nextchar[0] != '-' || ps->nextchar[1] == '\0') { - ps->optarg = ps->nextchar; - ps->nextchar = NULL; - return 1; - } - - /* Check for '--' */ - if (ps->nextchar[1] == '-') { - if (ps->nextchar[2] == '\0') { - ps->nextchar = NULL; - return -1; - } - - if (longopts != NULL) { - ps->nextchar += 2; - - return match_long(ps, argc, argv, optstring, - longopts, longindex); - } - } - - ps->nextchar++; - } - - /* Match nextchar */ - return match_short(ps, argc, argv, optstring); + assert(ps != NULL); + assert(argv != NULL); + assert(optstring != NULL); + + ps->optarg = NULL; + + if (argc < 2) + { + return -1; + } + + /* Advance to next element if needed */ + if (ps->nextchar == NULL || *ps->nextchar == '\0') + { + if (is_argv_end(ps, argc, argv)) + { + return -1; + } + + ps->nextchar = argv[ps->optind++]; + + /* Check for nonoption element (including '-') */ + if (ps->nextchar[0] != '-' || ps->nextchar[1] == '\0') + { + ps->optarg = ps->nextchar; + ps->nextchar = NULL; + return 1; + } + + /* Check for '--' */ + if (ps->nextchar[1] == '-') + { + if (ps->nextchar[2] == '\0') + { + ps->nextchar = NULL; + return -1; + } + + if (longopts != NULL) + { + ps->nextchar += 2; + + return match_long(ps, argc, argv, optstring, longopts, longindex); + } + } + + ps->nextchar++; + } + + /* Match nextchar */ + return match_short(ps, argc, argv, optstring); } /* * Reverse elements of `v` from `i` to `j`. */ -static void -reverse(char *v[], int i, int j) +static void reverse(char *v[], int i, int j) { - while (j - i > 1) { - char *tmp = v[i]; - v[i] = v[j - 1]; - v[j - 1] = tmp; - ++i; - --j; - } + while (j - i > 1) + { + char *tmp = v[i]; + v[i] = v[j - 1]; + v[j - 1] = tmp; + ++i; + --j; + } } /* @@ -242,125 +262,136 @@ reverse(char *v[], int i, int j) * The algorithm is described here: * http://hardtoc.com/2016/11/07/reordering-arguments.html */ -static int -parg_reorder_simple(int argc, char *argv[], - const char *optstring, - const struct parg_option *longopts) +static int parg_reorder_simple(int argc, char *argv[], const char *optstring, const struct parg_option *longopts) { - struct parg_state ps; - int change; - int l = 0; - int m = 0; - int r = 0; - - if (argc < 2) { - return argc; - } - - do { - int nextind; - int c; - - parg_init(&ps); - - nextind = ps.optind; - - /* Parse until end of argument */ - do { - c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); - } while (ps.nextchar != NULL && *ps.nextchar != '\0'); - - change = 0; - - do { - /* Find next non-option */ - for (l = nextind; c != 1 && c != -1;) { - l = ps.optind; - - do { - c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); - } while (ps.nextchar != NULL && *ps.nextchar != '\0'); - } - - /* Find next option */ - for (m = l; c == 1;) { - m = ps.optind; - - do { - c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); - } while (ps.nextchar != NULL && *ps.nextchar != '\0'); - } - - /* Find next non-option */ - for (r = m; c != 1 && c != -1;) { - r = ps.optind; - - do { - c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); - } while (ps.nextchar != NULL && *ps.nextchar != '\0'); - } - - /* Find next option */ - for (nextind = r; c == 1;) { - nextind = ps.optind; - - do { - c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); - } while (ps.nextchar != NULL && *ps.nextchar != '\0'); - } - - if (m < r) { - change = 1; - reverse(argv, l, m); - reverse(argv, m, r); - reverse(argv, l, r); - } - } while (c != -1); - } while (change != 0); - - return l + (r - m); + struct parg_state ps; + int change; + int l = 0; + int m = 0; + int r = 0; + + if (argc < 2) + { + return argc; + } + + do + { + int nextind; + int c; + + parg_init(&ps); + + nextind = ps.optind; + + /* Parse until end of argument */ + do + { + c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); + } while (ps.nextchar != NULL && *ps.nextchar != '\0'); + + change = 0; + + do + { + /* Find next non-option */ + for (l = nextind; c != 1 && c != -1;) + { + l = ps.optind; + + do + { + c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); + } while (ps.nextchar != NULL && *ps.nextchar != '\0'); + } + + /* Find next option */ + for (m = l; c == 1;) + { + m = ps.optind; + + do + { + c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); + } while (ps.nextchar != NULL && *ps.nextchar != '\0'); + } + + /* Find next non-option */ + for (r = m; c != 1 && c != -1;) + { + r = ps.optind; + + do + { + c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); + } while (ps.nextchar != NULL && *ps.nextchar != '\0'); + } + + /* Find next option */ + for (nextind = r; c == 1;) + { + nextind = ps.optind; + + do + { + c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); + } while (ps.nextchar != NULL && *ps.nextchar != '\0'); + } + + if (m < r) + { + change = 1; + reverse(argv, l, m); + reverse(argv, m, r); + reverse(argv, l, r); + } + } while (c != -1); + } while (change != 0); + + return l + (r - m); } -int -parg_reorder(int argc, char *argv[], - const char *optstring, - const struct parg_option *longopts) +int parg_reorder(int argc, char *argv[], const char *optstring, const struct parg_option *longopts) { - struct parg_state ps; - int lastind; - int optend; - int c; - - assert(argv != NULL); - assert(optstring != NULL); - - if (argc < 2) { - return argc; - } - - parg_init(&ps); - - /* Find end of normal arguments */ - do { - lastind = ps.optind; - - c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); - - /* Check for trailing option with error */ - if ((c == '?' || c == ':') && is_argv_end(&ps, argc, argv)) { - lastind = ps.optind - 1; - break; - } - } while (c != -1); - - optend = parg_reorder_simple(lastind, argv, optstring, longopts); - - /* Rotate `--` or trailing option with error into position */ - if (lastind < argc) { - reverse(argv, optend, lastind); - reverse(argv, optend, lastind + 1); - ++optend; - } - - return optend; + struct parg_state ps; + int lastind; + int optend; + int c; + + assert(argv != NULL); + assert(optstring != NULL); + + if (argc < 2) + { + return argc; + } + + parg_init(&ps); + + /* Find end of normal arguments */ + do + { + lastind = ps.optind; + + c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); + + /* Check for trailing option with error */ + if ((c == '?' || c == ':') && is_argv_end(&ps, argc, argv)) + { + lastind = ps.optind - 1; + break; + } + } while (c != -1); + + optend = parg_reorder_simple(lastind, argv, optstring, longopts); + + /* Rotate `--` or trailing option with error into position */ + if (lastind < argc) + { + reverse(argv, optend, lastind); + reverse(argv, optend, lastind + 1); + ++optend; + } + + return optend; } diff --git a/fsw/generic-vxworks-rtp/parg/parg.h b/fsw/generic-vxworks-rtp/parg/parg.h index d48ec128..62b4287d 100644 --- a/fsw/generic-vxworks-rtp/parg/parg.h +++ b/fsw/generic-vxworks-rtp/parg/parg.h @@ -25,177 +25,177 @@ #define PARG_H_INCLUDED #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif -#define PARG_VER_MAJOR 1 /**< Major version number */ -#define PARG_VER_MINOR 0 /**< Minor version number */ -#define PARG_VER_PATCH 3 /**< Patch version number */ +#define PARG_VER_MAJOR 1 /**< Major version number */ +#define PARG_VER_MINOR 0 /**< Minor version number */ +#define PARG_VER_PATCH 3 /**< Patch version number */ #define PARG_VER_STRING "1.0.3" /**< Version number as a string */ -/** - * Structure containing state between calls to parser. - * - * @see parg_init - */ -struct parg_state { - const char *optarg; /**< Pointer to option argument, if any */ - int optind; /**< Next index in argv to process */ - int optopt; /**< Option value resulting in error, if any */ - const char *nextchar; /**< Next character to process */ -}; + /** + * Structure containing state between calls to parser. + * + * @see parg_init + */ + struct parg_state + { + const char *optarg; /**< Pointer to option argument, if any */ + int optind; /**< Next index in argv to process */ + int optopt; /**< Option value resulting in error, if any */ + const char *nextchar; /**< Next character to process */ + }; -/** - * Structure for supplying long options to `parg_getopt_long()`. - * - * @see parg_getopt_long - */ -struct parg_option { - const char *name; /**< Name of option */ - int has_arg; /**< Option argument status */ - int *flag; /**< Pointer to flag variable */ - int val; /**< Value of option */ -}; + /** + * Structure for supplying long options to `parg_getopt_long()`. + * + * @see parg_getopt_long + */ + struct parg_option + { + const char *name; /**< Name of option */ + int has_arg; /**< Option argument status */ + int *flag; /**< Pointer to flag variable */ + int val; /**< Value of option */ + }; -/** - * Values for `has_arg` flag in `parg_option`. - * - * @see parg_option - */ -typedef enum { - PARG_NOARG, /**< No argument */ - PARG_REQARG, /**< Required argument */ - PARG_OPTARG /**< Optional argument */ -} parg_arg_num; + /** + * Values for `has_arg` flag in `parg_option`. + * + * @see parg_option + */ + typedef enum + { + PARG_NOARG, /**< No argument */ + PARG_REQARG, /**< Required argument */ + PARG_OPTARG /**< Optional argument */ + } parg_arg_num; -/** - * Initialize `ps`. - * - * Must be called before using state with a parser. - * - * @see parg_state - * - * @param ps pointer to state - */ -void -parg_init(struct parg_state *ps); + /** + * Initialize `ps`. + * + * Must be called before using state with a parser. + * + * @see parg_state + * + * @param ps pointer to state + */ + void parg_init(struct parg_state *ps); -/** - * Parse next short option in `argv`. - * - * Elements in `argv` that contain short options start with a single dash - * followed by one or more option characters, and optionally an option - * argument for the last option character. Examples are '`-d`', '`-ofile`', - * and '`-dofile`'. - * - * Consecutive calls to this function match the command-line arguments in - * `argv` against the short option characters in `optstring`. - * - * If an option character in `optstring` is followed by a colon, '`:`', the - * option requires an argument. If it is followed by two colons, the option - * may take an optional argument. - * - * If a match is found, `optarg` points to the option argument, if any, and - * the value of the option character is returned. - * - * If a match is found, but is missing a required option argument, `optopt` - * is set to the option character. If the first character in `optstring` is - * '`:`', then '`:`' is returned, otherwise '`?`' is returned. - * - * If no option character in `optstring` matches a short option, `optopt` - * is set to the option character, and '`?`' is returned. - * - * If an element of argv does not contain options (a nonoption element), - * `optarg` points to the element, and `1` is returned. - * - * An element consisting of a single dash, '`-`', is returned as a nonoption. - * - * Parsing stops and `-1` is returned, when the end of `argv` is reached, or - * if an element contains '`--`'. - * - * Works similarly to `getopt`, if `optstring` were prefixed by '`-`'. - * - * @param ps pointer to state - * @param argc number of elements in `argv` - * @param argv array of pointers to command-line arguments - * @param optstring string containing option characters - * @return option value on match, `1` on nonoption element, `-1` on end of - * arguments, '`?`' on unmatched option, '`?`' or '`:`' on option argument - * error - */ -int -parg_getopt(struct parg_state *ps, int argc, char *const argv[], - const char *optstring); + /** + * Parse next short option in `argv`. + * + * Elements in `argv` that contain short options start with a single dash + * followed by one or more option characters, and optionally an option + * argument for the last option character. Examples are '`-d`', '`-ofile`', + * and '`-dofile`'. + * + * Consecutive calls to this function match the command-line arguments in + * `argv` against the short option characters in `optstring`. + * + * If an option character in `optstring` is followed by a colon, '`:`', the + * option requires an argument. If it is followed by two colons, the option + * may take an optional argument. + * + * If a match is found, `optarg` points to the option argument, if any, and + * the value of the option character is returned. + * + * If a match is found, but is missing a required option argument, `optopt` + * is set to the option character. If the first character in `optstring` is + * '`:`', then '`:`' is returned, otherwise '`?`' is returned. + * + * If no option character in `optstring` matches a short option, `optopt` + * is set to the option character, and '`?`' is returned. + * + * If an element of argv does not contain options (a nonoption element), + * `optarg` points to the element, and `1` is returned. + * + * An element consisting of a single dash, '`-`', is returned as a nonoption. + * + * Parsing stops and `-1` is returned, when the end of `argv` is reached, or + * if an element contains '`--`'. + * + * Works similarly to `getopt`, if `optstring` were prefixed by '`-`'. + * + * @param ps pointer to state + * @param argc number of elements in `argv` + * @param argv array of pointers to command-line arguments + * @param optstring string containing option characters + * @return option value on match, `1` on nonoption element, `-1` on end of + * arguments, '`?`' on unmatched option, '`?`' or '`:`' on option argument + * error + */ + int parg_getopt(struct parg_state *ps, int argc, char *const argv[], const char *optstring); -/** - * Parse next long or short option in `argv`. - * - * Elements in `argv` that contain a long option start with two dashes - * followed by a string, and optionally an equal sign and an option argument. - * Examples are '`--help`' and '`--size=5`'. - * - * If no exact match is found, an unambiguous prefix of a long option will - * match. For example, if '`foo`' and '`foobar`' are valid long options, then - * '`--fo`' is ambiguous and will not match, '`--foo`' matches exactly, and - * '`--foob`' is an unambiguous prefix and will match. - * - * If a long option match is found, and `flag` is `NULL`, `val` is returned. - * - * If a long option match is found, and `flag` is not `NULL`, `val` is stored - * in the variable `flag` points to, and `0` is returned. - * - * If a long option match is found, but is missing a required option argument, - * or has an option argument even though it takes none, `optopt` is set to - * `val` if `flag` is `NULL`, and `0` otherwise. If the first character in - * `optstring` is '`:`', then '`:`' is returned, otherwise '`?`' is returned. - * - * If `longindex` is not `NULL`, the index of the entry in `longopts` that - * matched is stored there. - * - * If no long option in `longopts` matches a long option, '`?`' is returned. - * - * Handling of nonoptions and short options is like `parg_getopt()`. - * - * If no short options are required, an empty string, `""`, should be passed - * as `optstring`. - * - * Works similarly to `getopt_long`, if `optstring` were prefixed by '`-`'. - * - * @see parg_getopt - * - * @param ps pointer to state - * @param argc number of elements in `argv` - * @param argv array of pointers to command-line arguments - * @param optstring string containing option characters - * @param longopts array of `parg_option` structures - * @param longindex pointer to variable to store index of matching option in - * @return option value on match, `0` for flag option, `1` on nonoption - * element, `-1` on end of arguments, '`?`' on unmatched or ambiguous option, - * '`?`' or '`:`' on option argument error - */ -int -parg_getopt_long(struct parg_state *ps, int argc, char *const argv[], - const char *optstring, - const struct parg_option *longopts, int *longindex); + /** + * Parse next long or short option in `argv`. + * + * Elements in `argv` that contain a long option start with two dashes + * followed by a string, and optionally an equal sign and an option argument. + * Examples are '`--help`' and '`--size=5`'. + * + * If no exact match is found, an unambiguous prefix of a long option will + * match. For example, if '`foo`' and '`foobar`' are valid long options, then + * '`--fo`' is ambiguous and will not match, '`--foo`' matches exactly, and + * '`--foob`' is an unambiguous prefix and will match. + * + * If a long option match is found, and `flag` is `NULL`, `val` is returned. + * + * If a long option match is found, and `flag` is not `NULL`, `val` is stored + * in the variable `flag` points to, and `0` is returned. + * + * If a long option match is found, but is missing a required option argument, + * or has an option argument even though it takes none, `optopt` is set to + * `val` if `flag` is `NULL`, and `0` otherwise. If the first character in + * `optstring` is '`:`', then '`:`' is returned, otherwise '`?`' is returned. + * + * If `longindex` is not `NULL`, the index of the entry in `longopts` that + * matched is stored there. + * + * If no long option in `longopts` matches a long option, '`?`' is returned. + * + * Handling of nonoptions and short options is like `parg_getopt()`. + * + * If no short options are required, an empty string, `""`, should be passed + * as `optstring`. + * + * Works similarly to `getopt_long`, if `optstring` were prefixed by '`-`'. + * + * @see parg_getopt + * + * @param ps pointer to state + * @param argc number of elements in `argv` + * @param argv array of pointers to command-line arguments + * @param optstring string containing option characters + * @param longopts array of `parg_option` structures + * @param longindex pointer to variable to store index of matching option in + * @return option value on match, `0` for flag option, `1` on nonoption + * element, `-1` on end of arguments, '`?`' on unmatched or ambiguous option, + * '`?`' or '`:`' on option argument error + */ + int parg_getopt_long(struct parg_state *ps, + int argc, + char *const argv[], + const char *optstring, + const struct parg_option *longopts, + int *longindex); -/** - * Reorder elements of `argv` so options appear first. - * - * If there are no long options, `longopts` may be `NULL`. - * - * The return value can be used as `argc` parameter for `parg_getopt()` and - * `parg_getopt_long()`. - * - * @param argc number of elements in `argv` - * @param argv array of pointers to command-line arguments - * @param optstring string containing option characters - * @param longopts array of `parg_option` structures - * @return index of first nonoption in `argv` on success, `-1` on error - */ -int -parg_reorder(int argc, char *argv[], - const char *optstring, - const struct parg_option *longopts); + /** + * Reorder elements of `argv` so options appear first. + * + * If there are no long options, `longopts` may be `NULL`. + * + * The return value can be used as `argc` parameter for `parg_getopt()` and + * `parg_getopt_long()`. + * + * @param argc number of elements in `argv` + * @param argv array of pointers to command-line arguments + * @param optstring string containing option characters + * @param longopts array of `parg_option` structures + * @return index of first nonoption in `argv` on success, `-1` on error + */ + int parg_reorder(int argc, char *argv[], const char *optstring, const struct parg_option *longopts); #ifdef __cplusplus } /* extern "C" */ diff --git a/fsw/generic-vxworks-rtp/src/cfe_psp_exception.c b/fsw/generic-vxworks-rtp/src/cfe_psp_exception.c index b719d157..df8566e4 100644 --- a/fsw/generic-vxworks-rtp/src/cfe_psp_exception.c +++ b/fsw/generic-vxworks-rtp/src/cfe_psp_exception.c @@ -164,7 +164,7 @@ void CFE_PSP_ExceptionSigHandlerKill(int signo, siginfo_t *si, void *ctxt) */ CFE_PSP_ExceptionSigHandler(signo, si, ctxt); - printf("CFE_PSP: Exception handler exiting thread: %d\n",pthread_self()); + printf("CFE_PSP: Exception handler exiting thread: %d\n", pthread_self()); /* * Call pthread_exit to stop this thread @@ -189,9 +189,9 @@ void CFE_PSP_AttachSigHandler(int signo) * synchronous events, use the CFE_PSP_ExceptionSigHandlerKill variant. * * This exits the calling thread. - * - * For debugging, this could be changed to CFE_PSP_ExceptionSigHandlerSuspend - * which will suspend the calling thread so it can be examined. + * + * For debugging, this could be changed to CFE_PSP_ExceptionSigHandlerSuspend + * which will suspend the calling thread so it can be examined. */ sa.sa_sigaction = CFE_PSP_ExceptionSigHandlerKill; @@ -346,7 +346,10 @@ int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer default: ComputedReason = "Unknown SIGFPE"; } - (void)snprintf(ReasonBuf, ReasonSize, "%s at ip 0x%lx", ComputedReason, + (void)snprintf(ReasonBuf, + ReasonSize, + "%s at ip 0x%lx", + ComputedReason, (unsigned long)Buffer->context_info.si.si_addr); } else if (Buffer->context_info.si.si_signo == SIGINT) diff --git a/fsw/generic-vxworks-rtp/src/cfe_psp_memory.c b/fsw/generic-vxworks-rtp/src/cfe_psp_memory.c index 723856a3..0a037993 100644 --- a/fsw/generic-vxworks-rtp/src/cfe_psp_memory.c +++ b/fsw/generic-vxworks-rtp/src/cfe_psp_memory.c @@ -19,7 +19,7 @@ /****************************************************************************** ** File: cfe_psp_memory.c ** -** VxWorks 7 RTP / POSIX implementation +** VxWorks 7 RTP / POSIX implementation ** ** Purpose: ** cFE PSP Memory related functions. This is the implementation of the cFE @@ -81,10 +81,10 @@ ** This allows more than one copy of the cFS to run on VxWorks (in RTPs) by using ** a different cfs id such as "cfs2" */ -#define CFE_PSP_SHM_DIR "/shm/" -#define CFE_PSP_CDS_SHM_FILE ".cdsfile" -#define CFE_PSP_RST_SHM_FILE ".resetfile" -#define CFE_PSP_USR_SHM_FILE ".reservedfile" +#define CFE_PSP_SHM_DIR "/shm/" +#define CFE_PSP_CDS_SHM_FILE ".cdsfile" +#define CFE_PSP_RST_SHM_FILE ".resetfile" +#define CFE_PSP_USR_SHM_FILE ".reservedfile" /* * Define the PSP-supported capacities to be the maximum allowed, @@ -119,7 +119,7 @@ void CFE_PSP_InitUserReservedArea(void); extern unsigned int _init; extern unsigned int _fini; -/* +/* ** Need to access the command line paramter data for cfsid */ extern CFE_PSP_CommandData_t CommandData; @@ -132,7 +132,7 @@ extern CFE_PSP_CommandData_t CommandData; ** Pointer to the vxWorks USER_RESERVED_MEMORY area ** The sizes of each memory area is defined in os_processor.h for this architecture. */ -CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap = {0}; +CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap = { 0 }; /* ********************************************************************************* @@ -159,14 +159,14 @@ void CFE_PSP_InitCDS(void) char shm_name[CFE_PSP_SHM_NAME_LENGTH]; memset(shm_name, 0, CFE_PSP_SHM_NAME_LENGTH); - strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH -1); + strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH - 1); strncat(shm_name, CommandData.CfsId, strlen(CommandData.CfsId)); strncat(shm_name, CFE_PSP_CDS_SHM_FILE, strlen(CFE_PSP_CDS_SHM_FILE)); - /* + /* ** Try to open an existing shared memory segment. ** If it fails, create a new one - */ + */ shm_fd = shm_open(shm_name, O_RDWR, 0666); if (shm_fd != -1) { @@ -179,25 +179,26 @@ void CFE_PSP_InitCDS(void) shm_fd = shm_open(shm_name, O_CREAT | O_RDWR, 0666); if (shm_fd == -1) { - perror("CFE_PSP - cannot create new shared memory segment"); - CFE_PSP_Panic(CFE_PSP_ERROR); + perror("CFE_PSP - cannot create new shared memory segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); } - + ftruncate(shm_fd, CFE_PSP_CDS_SIZE); } - /* + /* ** Map the shared memory object */ - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = mmap(0, CFE_PSP_CDS_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); - if ( CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr == MAP_FAILED) + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = + mmap(0, CFE_PSP_CDS_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); + if (CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr == MAP_FAILED) { perror("CFE_PSP - Cannot map CDS Shared memory Segment"); CFE_PSP_Panic(CFE_PSP_ERROR); } else { - OS_printf("CFE_PSP: mmap CDS shared memory segment, size = %d\n", CFE_PSP_CDS_SIZE); + OS_printf("CFE_PSP: mmap CDS shared memory segment, size = %d\n", CFE_PSP_CDS_SIZE); } CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = CFE_PSP_CDS_SIZE; @@ -220,7 +221,7 @@ void CFE_PSP_DeleteCDS(void) char shm_name[CFE_PSP_SHM_NAME_LENGTH]; memset(shm_name, 0, CFE_PSP_SHM_NAME_LENGTH); - strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH -1); + strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH - 1); strncat(shm_name, CommandData.CfsId, strlen(CommandData.CfsId)); strncat(shm_name, CFE_PSP_CDS_SHM_FILE, strlen(CFE_PSP_CDS_SHM_FILE)); @@ -270,7 +271,7 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 { if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE)) { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; CopyPtr += CDSOffset; memcpy(CopyPtr, (char *)PtrToDataToWrite, NumBytes); @@ -305,7 +306,7 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt { if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE)) { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; CopyPtr += CDSOffset; memcpy((char *)PtrToDataToRead, CopyPtr, NumBytes); @@ -341,7 +342,6 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt */ void CFE_PSP_InitResetArea(void) { - size_t total_size; size_t reset_offset; size_t align_mask; @@ -351,7 +351,7 @@ void CFE_PSP_InitResetArea(void) int shm_fd; memset(shm_name, 0, CFE_PSP_SHM_NAME_LENGTH); - strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH -1); + strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH - 1); strncat(shm_name, CommandData.CfsId, strlen(CommandData.CfsId)); strncat(shm_name, CFE_PSP_RST_SHM_FILE, strlen(CFE_PSP_RST_SHM_FILE)); @@ -361,17 +361,17 @@ void CFE_PSP_InitResetArea(void) * reside in this shared memory segment so it will be preserved on a processor * reset. */ - align_mask = 4096 - 1; /* align blocks to whole memory pages */ - total_size = sizeof(CFE_PSP_VxWorksReservedAreaFixedLayout_t); - total_size = (total_size + align_mask) & ~align_mask; - reset_offset = total_size; - total_size += CFE_PSP_RESET_AREA_SIZE; - total_size = (total_size + align_mask) & ~align_mask; - - /* + align_mask = 4096 - 1; /* align blocks to whole memory pages */ + total_size = sizeof(CFE_PSP_VxWorksReservedAreaFixedLayout_t); + total_size = (total_size + align_mask) & ~align_mask; + reset_offset = total_size; + total_size += CFE_PSP_RESET_AREA_SIZE; + total_size = (total_size + align_mask) & ~align_mask; + + /* ** Try to open an existing shared memory segment. ** If it fails, create a new one - */ + */ shm_fd = shm_open(shm_name, O_RDWR, 0666); if (shm_fd != -1) { @@ -384,29 +384,29 @@ void CFE_PSP_InitResetArea(void) shm_fd = shm_open(shm_name, O_CREAT | O_RDWR, 0666); if (shm_fd == -1) { - perror("CFE_PSP - cannot create new shared memory segment"); - CFE_PSP_Panic(CFE_PSP_ERROR); + perror("CFE_PSP - cannot create new shared memory segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); } ftruncate(shm_fd, total_size); - } + } - /* + /* ** Map the shared memory object */ block_addr = (cpuaddr)mmap(0, total_size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); - if ( block_addr == (cpuaddr)MAP_FAILED) + if (block_addr == (cpuaddr)MAP_FAILED) { perror("CFE_PSP - Cannot map RST Shared memory Segment"); CFE_PSP_Panic(CFE_PSP_ERROR); } else { - OS_printf("CFE_PSP: mmap RST shared memory segment, size = %zu\n", total_size); + OS_printf("CFE_PSP: mmap RST shared memory segment, size = %zu\n", total_size); } - - FixedBlocksPtr = (CFE_PSP_VxWorksReservedAreaFixedLayout_t *)block_addr; - block_addr += reset_offset; + + FixedBlocksPtr = (CFE_PSP_VxWorksReservedAreaFixedLayout_t *)block_addr; + block_addr += reset_offset; CFE_PSP_ReservedMemoryMap.BootPtr = &FixedBlocksPtr->BootRecord; CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedBlocksPtr->ExceptionStorage; @@ -432,7 +432,7 @@ void CFE_PSP_DeleteResetArea(void) char shm_name[CFE_PSP_SHM_NAME_LENGTH]; memset(shm_name, 0, CFE_PSP_SHM_NAME_LENGTH); - strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH -1); + strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH - 1); strncat(shm_name, CommandData.CfsId, strlen(CommandData.CfsId)); strncat(shm_name, CFE_PSP_RST_SHM_FILE, strlen(CFE_PSP_RST_SHM_FILE)); @@ -488,14 +488,14 @@ void CFE_PSP_InitUserReservedArea(void) char shm_name[CFE_PSP_SHM_NAME_LENGTH]; memset(shm_name, 0, CFE_PSP_SHM_NAME_LENGTH); - strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH -1); + strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH - 1); strncat(shm_name, CommandData.CfsId, strlen(CommandData.CfsId)); strncat(shm_name, CFE_PSP_USR_SHM_FILE, strlen(CFE_PSP_USR_SHM_FILE)); - /* + /* ** Try to open an existing shared memory segment. ** If it fails, create a new one - */ + */ shm_fd = shm_open(shm_name, O_RDWR, 0666); if (shm_fd != -1) { @@ -507,18 +507,19 @@ void CFE_PSP_InitUserReservedArea(void) shm_fd = shm_open(shm_name, O_CREAT | O_RDWR, 0666); if (shm_fd == -1) { - perror("CFE_PSP - cannot create new shared memory segment"); - CFE_PSP_Panic(CFE_PSP_ERROR); + perror("CFE_PSP - cannot create new shared memory segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); } ftruncate(shm_fd, CFE_PSP_USER_RESERVED_SIZE); } - /* + /* ** Map the shared memory object */ - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = mmap(0, CFE_PSP_USER_RESERVED_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); - if ( CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr == MAP_FAILED) + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = + mmap(0, CFE_PSP_USER_RESERVED_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); + if (CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr == MAP_FAILED) { perror("CFE_PSP - Cannot map USR Shared memory Segment"); CFE_PSP_Panic(CFE_PSP_ERROR); @@ -526,11 +527,10 @@ void CFE_PSP_InitUserReservedArea(void) } else { - OS_printf("CFE_PSP: mmap USR shared memory segment, size = %d\n", CFE_PSP_USER_RESERVED_SIZE); + OS_printf("CFE_PSP: mmap USR shared memory segment, size = %d\n", CFE_PSP_USER_RESERVED_SIZE); } CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = CFE_PSP_USER_RESERVED_SIZE; close(shm_fd); - } /****************************************************************************** @@ -549,7 +549,7 @@ void CFE_PSP_DeleteUserReservedArea(void) char shm_name[CFE_PSP_SHM_NAME_LENGTH]; memset(shm_name, 0, CFE_PSP_SHM_NAME_LENGTH); - strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH -1); + strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH - 1); strncat(shm_name, CommandData.CfsId, strlen(CommandData.CfsId)); strncat(shm_name, CFE_PSP_USR_SHM_FILE, strlen(CFE_PSP_USR_SHM_FILE)); @@ -689,7 +689,8 @@ int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) memset(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr, 0, CFE_PSP_USER_RESERVED_SIZE); memset(CFE_PSP_ReservedMemoryMap.BootPtr, 0, sizeof(*CFE_PSP_ReservedMemoryMap.BootPtr)); - memset(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr, 0, + memset(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr, + 0, sizeof(*CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr)); /* diff --git a/fsw/generic-vxworks-rtp/src/cfe_psp_ssr.c b/fsw/generic-vxworks-rtp/src/cfe_psp_ssr.c index 40283654..872f1606 100644 --- a/fsw/generic-vxworks-rtp/src/cfe_psp_ssr.c +++ b/fsw/generic-vxworks-rtp/src/cfe_psp_ssr.c @@ -57,7 +57,7 @@ *-----------------------------------------------------------------*/ int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName) { - int32 ReturnCode = CFE_PSP_SUCCESS; + int32 ReturnCode = CFE_PSP_SUCCESS; return ReturnCode; } diff --git a/fsw/generic-vxworks-rtp/src/cfe_psp_start.c b/fsw/generic-vxworks-rtp/src/cfe_psp_start.c index cbbee545..0c0e9471 100644 --- a/fsw/generic-vxworks-rtp/src/cfe_psp_start.c +++ b/fsw/generic-vxworks-rtp/src/cfe_psp_start.c @@ -101,14 +101,16 @@ static const char *optString = "R:S:C:I:N:F:h"; /* ** getopts_long long form argument table */ -static const struct parg_option longOpts[] = {{"reset", PARG_REQARG, NULL, 'R'}, - {"subtype", PARG_REQARG, NULL, 'S'}, - {"cpuid", PARG_REQARG, NULL, 'C'}, - {"scid", PARG_REQARG, NULL, 'I'}, - {"cpuname", PARG_REQARG, NULL, 'N'}, - {"cfsid", PARG_REQARG, NULL, 'F'}, - {"help", PARG_NOARG, NULL, 'h'}, - {NULL, PARG_NOARG, NULL, 0}}; +static const struct parg_option longOpts[] = { + { "reset", PARG_REQARG, NULL, 'R' }, + { "subtype", PARG_REQARG, NULL, 'S' }, + { "cpuid", PARG_REQARG, NULL, 'C' }, + { "scid", PARG_REQARG, NULL, 'I' }, + { "cpuname", PARG_REQARG, NULL, 'N' }, + { "cfsid", PARG_REQARG, NULL, 'F' }, + { "help", PARG_NOARG, NULL, 'h' }, + { NULL, PARG_NOARG, NULL, 0 } +}; /* ** OS_Application_Run is called by the OSAL BSP after initialization */ @@ -155,8 +157,8 @@ void OS_Application_Run(void) /* go idle and wait for an event */ ret = sigwait(&sigset, &sig); - if (ret == 0 && !CFE_PSP_IdleTaskState.ShutdownReq && sig == CFE_PSP_EXCEPTION_EVENT_SIGNAL && - GLOBAL_CFE_CONFIGDATA.SystemNotify != NULL) + if (ret == 0 && !CFE_PSP_IdleTaskState.ShutdownReq && sig == CFE_PSP_EXCEPTION_EVENT_SIGNAL + && GLOBAL_CFE_CONFIGDATA.SystemNotify != NULL) { /* notify the CFE of the event */ GLOBAL_CFE_CONFIGDATA.SystemNotify(); @@ -185,8 +187,8 @@ void OS_Application_Run(void) */ int32 CFE_PSP_OS_EventHandler(OS_Event_t event, osal_id_t object_id, void *data) { - char taskname[OS_MAX_API_NAME]; - sigset_t sigset; + char taskname[OS_MAX_API_NAME]; + sigset_t sigset; /* ** VxWorks RTP work todo: enable processor affinity @@ -228,7 +230,7 @@ int32 CFE_PSP_OS_EventHandler(OS_Event_t event, osal_id_t object_id, void *data) ** CPU_SET(0, &cpuset); ** pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset); ** } - */ + */ /* * glibc/kernel has an internal limit for this name. * If the OSAL name is longer, just truncate it. @@ -239,8 +241,8 @@ int32 CFE_PSP_OS_EventHandler(OS_Event_t event, osal_id_t object_id, void *data) { taskname[CFE_PSP_KERNEL_NAME_LENGTH_MAX - 1] = 0; } - /* pthread_setname_np is not in the VxWorks SR650 SDK */ - /* SR0650 supports pthread_attr_setname, but that would require an OSAL modification */ + /* pthread_setname_np is not in the VxWorks SR650 SDK */ + /* SR0650 supports pthread_attr_setname, but that would require an OSAL modification */ /* pthread_setname_np(pthread_self(), taskname); */ /* @@ -296,7 +298,7 @@ void OS_Application_Startup(void) argv = OS_BSP_GetArgV(); parg_init(&ps); - opt = parg_getopt_long(&ps, argc, argv, optString, longOpts, &longIndex); + opt = parg_getopt_long(&ps, argc, argv, optString, longOpts, &longIndex); while (opt != -1) { @@ -306,8 +308,8 @@ void OS_Application_Startup(void) strncpy(CommandData.ResetType, ps.optarg, CFE_PSP_RESET_NAME_LENGTH - 1); CommandData.ResetType[CFE_PSP_RESET_NAME_LENGTH - 1] = 0; - if ((strncmp(CommandData.ResetType, "PO", CFE_PSP_RESET_NAME_LENGTH) != 0) && - (strncmp(CommandData.ResetType, "PR", CFE_PSP_RESET_NAME_LENGTH) != 0)) + if ((strncmp(CommandData.ResetType, "PO", CFE_PSP_RESET_NAME_LENGTH) != 0) + && (strncmp(CommandData.ResetType, "PR", CFE_PSP_RESET_NAME_LENGTH) != 0)) { printf("\nERROR: Invalid Reset Type: %s\n\n", CommandData.ResetType); CommandData.GotResetType = 0; @@ -455,8 +457,8 @@ void OS_Application_Startup(void) if (!CommandData.GotResetType) { reset_type = CFE_PSP_RST_TYPE_POWERON; - if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID || - CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) + if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID + || CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) { reset_type = CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType; } @@ -597,4 +599,3 @@ void CFE_PSP_ProcessArgumentDefaults(CFE_PSP_CommandData_t *CommandDataDefault) CommandDataDefault->GotCfsId = 1; } } - diff --git a/fsw/generic-vxworks-rtp/src/cfe_psp_watchdog.c b/fsw/generic-vxworks-rtp/src/cfe_psp_watchdog.c index 4a24dc1d..aa93a9d0 100644 --- a/fsw/generic-vxworks-rtp/src/cfe_psp_watchdog.c +++ b/fsw/generic-vxworks-rtp/src/cfe_psp_watchdog.c @@ -86,7 +86,7 @@ void CFE_PSP_WatchdogInit(void) *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogEnable(void) { - return; + return; } /*---------------------------------------------------------------- @@ -97,7 +97,7 @@ void CFE_PSP_WatchdogEnable(void) *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogDisable(void) { - return; + return; } /*---------------------------------------------------------------- @@ -108,7 +108,7 @@ void CFE_PSP_WatchdogDisable(void) *-----------------------------------------------------------------*/ void CFE_PSP_WatchdogService(void) { - return; + return; } /*---------------------------------------------------------------- diff --git a/fsw/inc/cfe_psp_memrange_api.h b/fsw/inc/cfe_psp_memrange_api.h index de9c3507..7ce5c1b3 100644 --- a/fsw/inc/cfe_psp_memrange_api.h +++ b/fsw/inc/cfe_psp_memrange_api.h @@ -185,8 +185,12 @@ uint32 CFE_PSP_MemRanges(void); * @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); +int32 CFE_PSP_MemRangeSet(uint32 RangeNum, + uint32 MemoryType, + cpuaddr StartAddr, + size_t Size, + size_t WordSize, + uint32 Attributes); /*--------------------------------------------------------------------------------------*/ /** @@ -208,7 +212,11 @@ int32 CFE_PSP_MemRangeSet(uint32 RangeNum, uint32 MemoryType, cpuaddr StartAddr, * @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); +int32 CFE_PSP_MemRangeGet(uint32 RangeNum, + uint32 *MemoryType, + cpuaddr *StartAddr, + size_t *Size, + size_t *WordSize, + uint32 *Attributes); #endif diff --git a/fsw/inc/cfe_psp_watchdog_api.h b/fsw/inc/cfe_psp_watchdog_api.h index 2513955d..dabc5725 100644 --- a/fsw/inc/cfe_psp_watchdog_api.h +++ b/fsw/inc/cfe_psp_watchdog_api.h @@ -77,25 +77,25 @@ /** \{ */ /** @brief Reset caused by power having been removed and restored */ -#define CFE_PSP_RST_SUBTYPE_POWER_CYCLE 1 +#define CFE_PSP_RST_SUBTYPE_POWER_CYCLE 1 /** @brief Reset caused by reset button on the board */ -#define CFE_PSP_RST_SUBTYPE_PUSH_BUTTON 2 +#define CFE_PSP_RST_SUBTYPE_PUSH_BUTTON 2 /** @brief Reset was caused by a reset line having been stimulated by a hardware special command */ #define CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND 3 /** @brief Reset was caused by a watchdog timer expiring */ -#define CFE_PSP_RST_SUBTYPE_HW_WATCHDOG 4 +#define CFE_PSP_RST_SUBTYPE_HW_WATCHDOG 4 /** @brief Reset was caused by cFE ES processing a @link #CFE_ES_RESTART_CC Reset Command @endlink */ -#define CFE_PSP_RST_SUBTYPE_RESET_COMMAND 5 +#define CFE_PSP_RST_SUBTYPE_RESET_COMMAND 5 /** @brief Reset was caused by a Processor Exception */ -#define CFE_PSP_RST_SUBTYPE_EXCEPTION 6 +#define CFE_PSP_RST_SUBTYPE_EXCEPTION 6 /** @brief Reset was caused in an unknown manner */ -#define CFE_PSP_RST_SUBTYPE_UNDEFINED_RESET 7 +#define CFE_PSP_RST_SUBTYPE_UNDEFINED_RESET 7 /** @brief Reset was caused by a JTAG or BDM connection */ -#define CFE_PSP_RST_SUBTYPE_HWDEBUG_RESET 8 +#define CFE_PSP_RST_SUBTYPE_HWDEBUG_RESET 8 /** @brief Reset reverted to a cFE POWERON due to a boot bank switch */ -#define CFE_PSP_RST_SUBTYPE_BANKSWITCH_RESET 9 +#define CFE_PSP_RST_SUBTYPE_BANKSWITCH_RESET 9 /** @brief Placeholder to indicate 1+ the maximum value that the PSP will ever use. */ -#define CFE_PSP_RST_SUBTYPE_MAX 10 +#define CFE_PSP_RST_SUBTYPE_MAX 10 /** \} */ /****************************************************************************** diff --git a/fsw/mcp750-vxworks/inc/psp_version.h b/fsw/mcp750-vxworks/inc/psp_version.h index 024f6092..cdf9628f 100644 --- a/fsw/mcp750-vxworks/inc/psp_version.h +++ b/fsw/mcp750-vxworks/inc/psp_version.h @@ -30,14 +30,14 @@ #define CFE_PSP_IMPL_BUILD_NUMBER 0 #define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0" #define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */ -#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ +#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ /* * Version Macros, see \ref cfsversions for definitions. */ -#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ -#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ -#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ +#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ +#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ +#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ /** * @brief Last official release. @@ -68,9 +68,9 @@ /** * @brief Max Version String length. - * + * * Maximum length that a tblCRCTool version string can be. - * + * */ #define CFE_PSP_CFG_MAX_VERSION_STR_LEN 256 diff --git a/fsw/mcp750-vxworks/src/bsp-integration/cfeSupport.c b/fsw/mcp750-vxworks/src/bsp-integration/cfeSupport.c index 5e2ce93a..9df6be22 100644 --- a/fsw/mcp750-vxworks/src/bsp-integration/cfeSupport.c +++ b/fsw/mcp750-vxworks/src/bsp-integration/cfeSupport.c @@ -85,7 +85,7 @@ int startCfeCore(char *cfevolume, char *cfepath) int status; MODULE_ID moduleID; SYM_TYPE symType; - char * symValue; + char *symValue; void (*cFEFuncPtr)(void); char cfeCorePath[64]; diff --git a/fsw/mcp750-vxworks/src/cfe_psp_exception.c b/fsw/mcp750-vxworks/src/cfe_psp_exception.c index aafb17df..0fa7e48b 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_exception.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_exception.c @@ -193,8 +193,12 @@ int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer TaskName = "NULL"; } - snprintf(ReasonBuf, ReasonSize, "Vector=0x%06X, vxWorks Task Name=%s, Task ID=0x%08X", Buffer->context_info.vector, - TaskName, Buffer->sys_task_id); + snprintf(ReasonBuf, + ReasonSize, + "Vector=0x%06X, vxWorks Task Name=%s, Task ID=0x%08X", + Buffer->context_info.vector, + TaskName, + Buffer->sys_task_id); return CFE_PSP_SUCCESS; } diff --git a/fsw/mcp750-vxworks/src/cfe_psp_memory.c b/fsw/mcp750-vxworks/src/cfe_psp_memory.c index 23418c4f..529bb711 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_memory.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_memory.c @@ -130,10 +130,10 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 } else { - if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) && - ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) + if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) + && ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; CopyPtr += CDSOffset; memcpy(CopyPtr, (char *)PtrToDataToWrite, NumBytes); @@ -172,10 +172,10 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt } else { - if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) && - ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) + if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) + && ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; CopyPtr += CDSOffset; memcpy((char *)PtrToDataToRead, CopyPtr, NumBytes); @@ -361,33 +361,33 @@ void CFE_PSP_SetupReservedMemoryMap(void) memset(&CFE_PSP_ReservedMemoryMap, 0, sizeof(CFE_PSP_ReservedMemoryMap)); - CFE_PSP_ReservedMemoryMap.BootPtr = (CFE_PSP_ReservedMemoryBootRecord_t *)end_addr; - end_addr += sizeof(CFE_PSP_ReservedMemoryBootRecord_t); - end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + CFE_PSP_ReservedMemoryMap.BootPtr = (CFE_PSP_ReservedMemoryBootRecord_t *)end_addr; + end_addr += sizeof(CFE_PSP_ReservedMemoryBootRecord_t); + end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = (CFE_PSP_ExceptionStorage_t *)end_addr; - end_addr += sizeof(CFE_PSP_ExceptionStorage_t); - end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = (CFE_PSP_ExceptionStorage_t *)end_addr; + end_addr += sizeof(CFE_PSP_ExceptionStorage_t); + end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void *)end_addr; - CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = GLOBAL_CONFIGDATA.CfeConfig->ResetAreaSize; - end_addr += CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize; - end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void *)end_addr; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = GLOBAL_CONFIGDATA.CfeConfig->ResetAreaSize; + end_addr += CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize; + end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr = (void *)end_addr; CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize = GLOBAL_CONFIGDATA.CfeConfig->RamDiskSectorSize * GLOBAL_CONFIGDATA.CfeConfig->RamDiskTotalSectors; end_addr += CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize; - end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = (void *)end_addr; - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = GLOBAL_CONFIGDATA.CfeConfig->CdsSize; - end_addr += CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize; - end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = (void *)end_addr; + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = GLOBAL_CONFIGDATA.CfeConfig->CdsSize; + end_addr += CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize; + end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = (void *)end_addr; - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = GLOBAL_CONFIGDATA.CfeConfig->UserReservedSize; - end_addr += CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize; + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = (void *)end_addr; + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = GLOBAL_CONFIGDATA.CfeConfig->UserReservedSize; + end_addr += CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize; end_addr = (end_addr + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; /* The total size of the entire block is the difference in address */ @@ -395,7 +395,8 @@ void CFE_PSP_SetupReservedMemoryMap(void) MCP750_ReservedMemBlock.BlockSize = end_addr - start_addr; OS_printf("CFE_PSP: MCP750 Reserved Memory Block at 0x%08lx, Total Size = 0x%lx\n", - (unsigned long)MCP750_ReservedMemBlock.BlockPtr, (unsigned long)MCP750_ReservedMemBlock.BlockSize); + (unsigned long)MCP750_ReservedMemBlock.BlockPtr, + (unsigned long)MCP750_ReservedMemBlock.BlockSize); /* * Set up the "RAM" entry in the memory table. @@ -408,7 +409,9 @@ void CFE_PSP_SetupReservedMemoryMap(void) * No action on MCP750 - reserved block is statically allocated at sysMemTop. * Implemented for API consistency with other PSPs. */ -void CFE_PSP_DeleteProcessorReservedMemory(void) {} +void CFE_PSP_DeleteProcessorReservedMemory(void) +{ +} /* ********************************************************************************* diff --git a/fsw/modules/backtrace_libunwind/src/cfe_psp_backtrace.c b/fsw/modules/backtrace_libunwind/src/cfe_psp_backtrace.c index f859621f..a3b9b309 100644 --- a/fsw/modules/backtrace_libunwind/src/cfe_psp_backtrace.c +++ b/fsw/modules/backtrace_libunwind/src/cfe_psp_backtrace.c @@ -37,11 +37,10 @@ #include /* Global unwind variables */ -unw_cursor_t Cursor; -unw_context_t Context; +unw_cursor_t Cursor; +unw_context_t Context; unw_proc_info_t Info; - CFE_PSP_MODULE_DECLARE_SIMPLE(backtrace_libunwind); /* @@ -71,44 +70,49 @@ void CFE_PSP_Backtrace_Init(void) */ int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, int32 MaxEntries) { - int32 NumAddrs = 0; - - if (Entry != NULL) - { - /* Init the unwind context */ - Context = *(unw_context_t *)ContextPtr; - - /* Init unwind cursor for local execution context */ - unw_init_local(&Cursor, &Context); - - /* loop through stack frame */ - while ((MaxEntries > 0) && (unw_step(&Cursor) > 0)) - { - /* Get instruction pointer (IP) and stack pointer (SP) registers */ - Entry->RegIp = Entry->RegSp = 0xDEADBEEF; - unw_get_reg(&Cursor, UNW_REG_IP, &Entry->RegIp); - unw_get_reg(&Cursor, UNW_REG_SP, &Entry->RegSp); - - /* Get symbol name and offset */ - if (unw_get_proc_name(&Cursor, Entry->SymName, CFE_PSP_BACKTRACE_SYM_NAME_LEN, &Entry->SymOffset) != 0) - { - strncpy(Entry->SymName, "", CFE_PSP_BACKTRACE_SYM_NAME_LEN); - Entry->SymOffset = 0; - } - else - { - Entry->SymName[CFE_PSP_BACKTRACE_SYM_NAME_LEN - 1] = '\0'; - } - - /* Display bracktrace info */ - PSP_DEBUG("CFE_PSP_Backtrace: [%02u] SP: 0x%lx PC: 0x%lx (%s+0x%lx)\n", NumAddrs, Entry->RegSp, Entry->RegIp, Entry->SymName, Entry->SymOffset); - - /* update entry pointer and counters */ - NumAddrs++; - Entry++; - MaxEntries--; - } - } - - return NumAddrs; + int32 NumAddrs = 0; + + if (Entry != NULL) + { + /* Init the unwind context */ + Context = *(unw_context_t *)ContextPtr; + + /* Init unwind cursor for local execution context */ + unw_init_local(&Cursor, &Context); + + /* loop through stack frame */ + while ((MaxEntries > 0) && (unw_step(&Cursor) > 0)) + { + /* Get instruction pointer (IP) and stack pointer (SP) registers */ + Entry->RegIp = Entry->RegSp = 0xDEADBEEF; + unw_get_reg(&Cursor, UNW_REG_IP, &Entry->RegIp); + unw_get_reg(&Cursor, UNW_REG_SP, &Entry->RegSp); + + /* Get symbol name and offset */ + if (unw_get_proc_name(&Cursor, Entry->SymName, CFE_PSP_BACKTRACE_SYM_NAME_LEN, &Entry->SymOffset) != 0) + { + strncpy(Entry->SymName, "", CFE_PSP_BACKTRACE_SYM_NAME_LEN); + Entry->SymOffset = 0; + } + else + { + Entry->SymName[CFE_PSP_BACKTRACE_SYM_NAME_LEN - 1] = '\0'; + } + + /* Display bracktrace info */ + PSP_DEBUG("CFE_PSP_Backtrace: [%02u] SP: 0x%lx PC: 0x%lx (%s+0x%lx)\n", + NumAddrs, + Entry->RegSp, + Entry->RegIp, + Entry->SymName, + Entry->SymOffset); + + /* update entry pointer and counters */ + NumAddrs++; + Entry++; + MaxEntries--; + } + } + + return NumAddrs; } diff --git a/fsw/modules/backtrace_libunwind/ut-stubs/cfe_psp_backtrace_stubs.c b/fsw/modules/backtrace_libunwind/ut-stubs/cfe_psp_backtrace_stubs.c index 2fe40381..7a33e7c5 100644 --- a/fsw/modules/backtrace_libunwind/ut-stubs/cfe_psp_backtrace_stubs.c +++ b/fsw/modules/backtrace_libunwind/ut-stubs/cfe_psp_backtrace_stubs.c @@ -31,17 +31,17 @@ * Generated stub function for CFE_PSP_Backtrace() * ---------------------------------------------------- */ -int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, - int32 MaxEntries) { - UT_GenStub_SetupReturnBuffer(CFE_PSP_Backtrace, int32); +int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, int32 MaxEntries) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_Backtrace, int32); - UT_GenStub_AddParam(CFE_PSP_Backtrace, CFE_PSP_BacktraceEntry_t *, Entry); - UT_GenStub_AddParam(CFE_PSP_Backtrace, void *, ContextPtr); - UT_GenStub_AddParam(CFE_PSP_Backtrace, int32, MaxEntries); + UT_GenStub_AddParam(CFE_PSP_Backtrace, CFE_PSP_BacktraceEntry_t *, Entry); + UT_GenStub_AddParam(CFE_PSP_Backtrace, void *, ContextPtr); + UT_GenStub_AddParam(CFE_PSP_Backtrace, int32, MaxEntries); - UT_GenStub_Execute(CFE_PSP_Backtrace, Basic, NULL); + UT_GenStub_Execute(CFE_PSP_Backtrace, Basic, NULL); - return UT_GenStub_GetReturnValue(CFE_PSP_Backtrace, int32); + return UT_GenStub_GetReturnValue(CFE_PSP_Backtrace, int32); } /* @@ -49,7 +49,7 @@ int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, * Generated stub function for CFE_PSP_Backtrace_Init() * ---------------------------------------------------- */ -void CFE_PSP_Backtrace_Init(void) { - - UT_GenStub_Execute(CFE_PSP_Backtrace_Init, Basic, NULL); +void CFE_PSP_Backtrace_Init(void) +{ + UT_GenStub_Execute(CFE_PSP_Backtrace_Init, Basic, NULL); } diff --git a/fsw/modules/backtrace_qnx/src/cfe_psp_backtrace.c b/fsw/modules/backtrace_qnx/src/cfe_psp_backtrace.c index fb6afaa6..b67cc25c 100644 --- a/fsw/modules/backtrace_qnx/src/cfe_psp_backtrace.c +++ b/fsw/modules/backtrace_qnx/src/cfe_psp_backtrace.c @@ -61,8 +61,12 @@ void CFE_PSP_Backtrace_Init(void) /* Initialize backtrace accessor */ if (bt_init_accessor(&CFE_PSP_BacktraceAcc, BT_SELF) == -1) { - OS_printf("CFE_PSP: %s:%i could not initialize backtrace: %s (%i)%s\n", __func__, __LINE__, - "bt_init_accessor", errno, strerror(errno)); + OS_printf("CFE_PSP: %s:%i could not initialize backtrace: %s (%i)%s\n", + __func__, + __LINE__, + "bt_init_accessor", + errno, + strerror(errno)); abort(); /* abort() is preferable to exit(EXIT_FAILURE), as it may create a core file for debug */ } } @@ -74,12 +78,17 @@ void CFE_PSP_Backtrace_Init(void) */ int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, int32 MaxEntries) { - int32 NumAddrs; + int32 NumAddrs; - NumAddrs = bt_get_backtrace(&CFE_PSP_BacktraceAcc, Entry, MaxEntries); + NumAddrs = bt_get_backtrace(&CFE_PSP_BacktraceAcc, Entry, MaxEntries); - PSP_DEBUG("CFE_PSP: %s:%i collecting backtrace [ NumAddrs: %i Info: %s (%i) %s ]\n", __func__, __LINE__, - NumAddrs, "bt_init_accessor/bt_get_backtrace", errno, strerror(errno)); + PSP_DEBUG("CFE_PSP: %s:%i collecting backtrace [ NumAddrs: %i Info: %s (%i) %s ]\n", + __func__, + __LINE__, + NumAddrs, + "bt_init_accessor/bt_get_backtrace", + errno, + strerror(errno)); - return NumAddrs; + return NumAddrs; } diff --git a/fsw/modules/backtrace_qnx/ut-stubs/cfe_psp_backtrace_stubs.c b/fsw/modules/backtrace_qnx/ut-stubs/cfe_psp_backtrace_stubs.c index 2fe40381..7a33e7c5 100644 --- a/fsw/modules/backtrace_qnx/ut-stubs/cfe_psp_backtrace_stubs.c +++ b/fsw/modules/backtrace_qnx/ut-stubs/cfe_psp_backtrace_stubs.c @@ -31,17 +31,17 @@ * Generated stub function for CFE_PSP_Backtrace() * ---------------------------------------------------- */ -int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, - int32 MaxEntries) { - UT_GenStub_SetupReturnBuffer(CFE_PSP_Backtrace, int32); +int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, int32 MaxEntries) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_Backtrace, int32); - UT_GenStub_AddParam(CFE_PSP_Backtrace, CFE_PSP_BacktraceEntry_t *, Entry); - UT_GenStub_AddParam(CFE_PSP_Backtrace, void *, ContextPtr); - UT_GenStub_AddParam(CFE_PSP_Backtrace, int32, MaxEntries); + UT_GenStub_AddParam(CFE_PSP_Backtrace, CFE_PSP_BacktraceEntry_t *, Entry); + UT_GenStub_AddParam(CFE_PSP_Backtrace, void *, ContextPtr); + UT_GenStub_AddParam(CFE_PSP_Backtrace, int32, MaxEntries); - UT_GenStub_Execute(CFE_PSP_Backtrace, Basic, NULL); + UT_GenStub_Execute(CFE_PSP_Backtrace, Basic, NULL); - return UT_GenStub_GetReturnValue(CFE_PSP_Backtrace, int32); + return UT_GenStub_GetReturnValue(CFE_PSP_Backtrace, int32); } /* @@ -49,7 +49,7 @@ int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, * Generated stub function for CFE_PSP_Backtrace_Init() * ---------------------------------------------------- */ -void CFE_PSP_Backtrace_Init(void) { - - UT_GenStub_Execute(CFE_PSP_Backtrace_Init, Basic, NULL); +void CFE_PSP_Backtrace_Init(void) +{ + UT_GenStub_Execute(CFE_PSP_Backtrace_Init, Basic, NULL); } diff --git a/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c b/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c index 9a2a9077..fe2b0d44 100644 --- a/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c +++ b/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c @@ -164,10 +164,16 @@ void eeprom_mmap_file_Init(uint32 PspModuleId) /* ** Install the 2nd memory range as the mapped file ( EEPROM ) */ - Status = CFE_PSP_MemRangeSet(1, CFE_PSP_MEM_EEPROM, eeprom_address, eeprom_size, CFE_PSP_MEM_SIZE_DWORD, + Status = CFE_PSP_MemRangeSet(1, + CFE_PSP_MEM_EEPROM, + eeprom_address, + eeprom_size, + CFE_PSP_MEM_SIZE_DWORD, CFE_PSP_MEM_ATTR_READWRITE); OS_printf("CFE_PSP: EEPROM Range (2) created: Start Address = %08lX, Size = %08X Status = %d\n", - (unsigned long)eeprom_address, (unsigned int)eeprom_size, (int)Status); + (unsigned long)eeprom_address, + (unsigned int)eeprom_size, + (int)Status); } else { diff --git a/fsw/modules/endian_api/cfe_psp_endian_generic.c b/fsw/modules/endian_api/cfe_psp_endian_generic.c index faf26ae9..516ba206 100644 --- a/fsw/modules/endian_api/cfe_psp_endian_generic.c +++ b/fsw/modules/endian_api/cfe_psp_endian_generic.c @@ -74,8 +74,8 @@ uint16 PSP_ENDIAN_CONVERSION(HtoBE16)(uint16 host_16bits) while (i > 0) { --i; - Out.Octets[i] = ShiftReg & 0xFF; - ShiftReg >>= 8; + Out.Octets[i] = ShiftReg & 0xFF; + ShiftReg >>= 8; } return Out.Word; @@ -93,8 +93,8 @@ uint16 PSP_ENDIAN_CONVERSION(HtoLE16)(uint16 host_16bits) i = 0; while (i < sizeof(Out)) { - Out.Octets[i] = ShiftReg & 0xFF; - ShiftReg >>= 8; + Out.Octets[i] = ShiftReg & 0xFF; + ShiftReg >>= 8; ++i; } @@ -114,7 +114,7 @@ uint16 PSP_ENDIAN_CONVERSION(BE16toH)(uint16 big_endian_16bits) while (i < sizeof(In)) { ShiftReg <<= 8; - ShiftReg |= In.Octets[i]; + ShiftReg |= In.Octets[i]; ++i; } @@ -135,7 +135,7 @@ uint16 PSP_ENDIAN_CONVERSION(LE16toH)(uint16 little_endian_16bits) { --i; ShiftReg <<= 8; - ShiftReg |= In.Octets[i]; + ShiftReg |= In.Octets[i]; } return ShiftReg; @@ -154,8 +154,8 @@ uint32 PSP_ENDIAN_CONVERSION(HtoBE32)(uint32 host_32bits) while (i > 0) { --i; - Out.Octets[i] = ShiftReg & 0xFF; - ShiftReg >>= 8; + Out.Octets[i] = ShiftReg & 0xFF; + ShiftReg >>= 8; } return Out.Word; @@ -173,8 +173,8 @@ uint32 PSP_ENDIAN_CONVERSION(HtoLE32)(uint32 host_32bits) i = 0; while (i < sizeof(Out)) { - Out.Octets[i] = ShiftReg & 0xFF; - ShiftReg >>= 8; + Out.Octets[i] = ShiftReg & 0xFF; + ShiftReg >>= 8; ++i; } @@ -194,7 +194,7 @@ uint32 PSP_ENDIAN_CONVERSION(BE32toH)(uint32 big_endian_32bits) while (i < sizeof(In)) { ShiftReg <<= 8; - ShiftReg |= In.Octets[i]; + ShiftReg |= In.Octets[i]; ++i; } @@ -215,7 +215,7 @@ uint32 PSP_ENDIAN_CONVERSION(LE32toH)(uint32 little_endian_32bits) { --i; ShiftReg <<= 8; - ShiftReg |= In.Octets[i]; + ShiftReg |= In.Octets[i]; } return ShiftReg; @@ -234,8 +234,8 @@ uint64 PSP_ENDIAN_CONVERSION(HtoBE64)(uint64 host_64bits) while (i > 0) { --i; - Out.Octets[i] = ShiftReg & 0xFF; - ShiftReg >>= 8; + Out.Octets[i] = ShiftReg & 0xFF; + ShiftReg >>= 8; } return Out.Word; @@ -253,8 +253,8 @@ uint64 PSP_ENDIAN_CONVERSION(HtoLE64)(uint64 host_64bits) i = 0; while (i < sizeof(Out)) { - Out.Octets[i] = ShiftReg & 0xFF; - ShiftReg >>= 8; + Out.Octets[i] = ShiftReg & 0xFF; + ShiftReg >>= 8; ++i; } @@ -274,7 +274,7 @@ uint64 PSP_ENDIAN_CONVERSION(BE64toH)(uint64 big_endian_64bits) while (i < sizeof(In)) { ShiftReg <<= 8; - ShiftReg |= In.Octets[i]; + ShiftReg |= In.Octets[i]; ++i; } @@ -295,7 +295,7 @@ uint64 PSP_ENDIAN_CONVERSION(LE64toH)(uint64 little_endian_64bits) { --i; ShiftReg <<= 8; - ShiftReg |= In.Octets[i]; + ShiftReg |= In.Octets[i]; } return ShiftReg; diff --git a/fsw/modules/iodriver/inc/iodriver_base.h b/fsw/modules/iodriver/inc/iodriver_base.h index 72d5de14..b466e1d3 100644 --- a/fsw/modules/iodriver/inc/iodriver_base.h +++ b/fsw/modules/iodriver/inc/iodriver_base.h @@ -52,7 +52,7 @@ typedef struct */ typedef union { - void * Vptr; + void *Vptr; const void *ConstVptr; const char *ConstStr; uint32 U32; @@ -119,12 +119,12 @@ enum CFE_PSP_IODriver_GET_CONFIGURATION = 4, /**< void * argument (device-dependent content) */ /* Sub-channel configuration/mapping opcodes */ - CFE_PSP_IODriver_LOOKUP_SUBSYSTEM = 5, /**< const char * argument, looks up ChannelName and returns positive value + CFE_PSP_IODriver_LOOKUP_SUBSYSTEM = 5, /**< const char * argument, looks up ChannelName and returns positive value for subsystem ID, negative value for error */ CFE_PSP_IODriver_LOOKUP_SUBCHANNEL = 6, /**< const char * argument, looks up ChannelName and returns positive value for subchannel ID, negative value for error */ - CFE_PSP_IODriver_SET_DIRECTION = 7, /**< U32 (CFE_PSP_IODriver_Direction_t) argument as input */ - CFE_PSP_IODriver_QUERY_DIRECTION = 8, /**< U32 (CFE_PSP_IODriver_Direction_t) argument as output */ + CFE_PSP_IODriver_SET_DIRECTION = 7, /**< U32 (CFE_PSP_IODriver_Direction_t) argument as input */ + CFE_PSP_IODriver_QUERY_DIRECTION = 8, /**< U32 (CFE_PSP_IODriver_Direction_t) argument as output */ /* * Placeholders for opcodes that could be implemented across a class of devices. @@ -166,7 +166,8 @@ int32 CFE_PSP_IODriver_FindByName(const char *DriverName, uint32 *PspModuleId); * * @retval #CFE_PSP_SUCCESS if successful, or error code if not successful */ -int32 CFE_PSP_IODriver_Command(const CFE_PSP_IODriver_Location_t *Location, uint32 CommandCode, - CFE_PSP_IODriver_Arg_t Arg); +int32 CFE_PSP_IODriver_Command(const CFE_PSP_IODriver_Location_t *Location, + uint32 CommandCode, + CFE_PSP_IODriver_Arg_t Arg); #endif /* IODRIVER_BASE_H */ diff --git a/fsw/modules/iodriver/inc/iodriver_impl.h b/fsw/modules/iodriver/inc/iodriver_impl.h index ed537c94..b1638b8d 100644 --- a/fsw/modules/iodriver/inc/iodriver_impl.h +++ b/fsw/modules/iodriver/inc/iodriver_impl.h @@ -40,7 +40,9 @@ * Implemented as a single API call with an extendible command code for device-specific ops. This allows * a common API to be used while still allowing full freedom to handle many different device types. */ -typedef int32 (*CFE_PSP_IODriver_ApiFunc_t)(uint32 CommandCode, uint16 Instance, uint16 SubChannel, +typedef int32 (*CFE_PSP_IODriver_ApiFunc_t)(uint32 CommandCode, + uint16 Instance, + uint16 SubChannel, CFE_PSP_IODriver_Arg_t arg); typedef const struct diff --git a/fsw/modules/iodriver/inc/iodriver_memory_io.h b/fsw/modules/iodriver/inc/iodriver_memory_io.h index eb114df2..08c4f83e 100644 --- a/fsw/modules/iodriver/inc/iodriver_memory_io.h +++ b/fsw/modules/iodriver/inc/iodriver_memory_io.h @@ -38,7 +38,7 @@ typedef struct { uint32 DeviceAddress; uint32 BufferSize; - void * BufferMem; + void *BufferMem; } CFE_PSP_IODriver_ReadMemoryBuffer_t; /** diff --git a/fsw/modules/iodriver/inc/iodriver_packet_io.h b/fsw/modules/iodriver/inc/iodriver_packet_io.h index abeae2e1..160521c3 100644 --- a/fsw/modules/iodriver/inc/iodriver_packet_io.h +++ b/fsw/modules/iodriver/inc/iodriver_packet_io.h @@ -40,7 +40,7 @@ typedef struct typedef struct { uint32 BufferSize; /**< Number of channels in the i/o structure (length of "samples" array) */ - void * BufferMem; + void *BufferMem; } CFE_PSP_IODriver_ReadPacketBuffer_t; /** diff --git a/fsw/modules/iodriver/inc/iodriver_stream_io.h b/fsw/modules/iodriver/inc/iodriver_stream_io.h index d0f1df3e..edb993d8 100644 --- a/fsw/modules/iodriver/inc/iodriver_stream_io.h +++ b/fsw/modules/iodriver/inc/iodriver_stream_io.h @@ -34,7 +34,7 @@ typedef struct typedef struct { uint32 BufferSize; /**< Size of data buffer */ - void * BufferMem; /**< Pointer to data buffer to store read data */ + void *BufferMem; /**< Pointer to data buffer to store read data */ } CFE_PSP_IODriver_ReadStreamBuffer_t; /** diff --git a/fsw/modules/iodriver/src/iodriver.c b/fsw/modules/iodriver/src/iodriver.c index 6c6ce65a..cf2ae4b9 100644 --- a/fsw/modules/iodriver/src/iodriver.c +++ b/fsw/modules/iodriver/src/iodriver.c @@ -22,7 +22,7 @@ CFE_PSP_MODULE_DECLARE_SIMPLE(iodriver); static osal_id_t CFE_PSP_IODriver_Mutex_Table[CFE_PSP_IODRIVER_LOCK_TABLE_SIZE]; -const CFE_PSP_IODriver_API_t CFE_PSP_IODriver_DEFAULT_API = {.DeviceCommand = NULL, .DeviceMutex = NULL}; +const CFE_PSP_IODriver_API_t CFE_PSP_IODriver_DEFAULT_API = { .DeviceCommand = NULL, .DeviceMutex = NULL }; void iodriver_Init(uint32 PspModuleId) { @@ -39,7 +39,7 @@ void iodriver_Init(uint32 PspModuleId) CFE_PSP_IODriver_API_t *CFE_PSP_IODriver_GetAPI(uint32 PspModuleId) { int32 Result; - CFE_PSP_ModuleApi_t * API; + CFE_PSP_ModuleApi_t *API; CFE_PSP_IODriver_API_t *CFE_PSP_IODriver_API; Result = CFE_PSP_Module_GetAPIEntry(PspModuleId, &API); @@ -91,8 +91,9 @@ int32 CFE_PSP_IODriver_HashMutex(int32 StartHash, int32 Datum) return ((StartHash + Datum) & 0x7FFFFFFF); } -int32 CFE_PSP_IODriver_Command(const CFE_PSP_IODriver_Location_t *Location, uint32 CommandCode, - CFE_PSP_IODriver_Arg_t Arg) +int32 CFE_PSP_IODriver_Command(const CFE_PSP_IODriver_Location_t *Location, + uint32 CommandCode, + CFE_PSP_IODriver_Arg_t Arg) { int32 Result; osal_id_t MutexId; @@ -103,9 +104,9 @@ int32 CFE_PSP_IODriver_Command(const CFE_PSP_IODriver_Location_t *Location, uint { if (API->DeviceMutex != NULL) { - MutexId = - CFE_PSP_IODriver_GetMutex(Location->PspModuleId, API->DeviceMutex(CommandCode, Location->SubsystemId, - Location->SubchannelId, Arg)); + MutexId = CFE_PSP_IODriver_GetMutex( + Location->PspModuleId, + API->DeviceMutex(CommandCode, Location->SubsystemId, Location->SubchannelId, Arg)); } else { diff --git a/fsw/modules/iodriver/ut-stubs/iodriver_base_stubs.c b/fsw/modules/iodriver/ut-stubs/iodriver_base_stubs.c index 80c4e51d..a531596a 100644 --- a/fsw/modules/iodriver/ut-stubs/iodriver_base_stubs.c +++ b/fsw/modules/iodriver/ut-stubs/iodriver_base_stubs.c @@ -19,8 +19,9 @@ * Generated stub function for CFE_PSP_IODriver_Command() * ---------------------------------------------------- */ -int32 CFE_PSP_IODriver_Command(const CFE_PSP_IODriver_Location_t *Location, uint32 CommandCode, - CFE_PSP_IODriver_Arg_t Arg) +int32 CFE_PSP_IODriver_Command(const CFE_PSP_IODriver_Location_t *Location, + uint32 CommandCode, + CFE_PSP_IODriver_Arg_t Arg) { UT_GenStub_SetupReturnBuffer(CFE_PSP_IODriver_Command, int32); diff --git a/fsw/modules/linux_sysmon/linux_sysmon.c b/fsw/modules/linux_sysmon/linux_sysmon.c index f93907a3..71199373 100644 --- a/fsw/modules/linux_sysmon/linux_sysmon.c +++ b/fsw/modules/linux_sysmon/linux_sysmon.c @@ -83,28 +83,28 @@ typedef struct linux_sysmon_state * Local Function Prototypes ********************************************************************/ -static void * linux_sysmon_Task(void *arg); +static void *linux_sysmon_Task(void *arg); static int32_t linux_sysmon_Start(linux_sysmon_cpuload_state_t *state); static int32_t linux_sysmon_Stop(linux_sysmon_cpuload_state_t *state); static void linux_sysmon_Init(uint32_t local_module_id); /* Function that starts up linux_sysmon driver. */ -static int32_t linux_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, - CFE_PSP_IODriver_Arg_t Arg); +static int32_t +linux_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, CFE_PSP_IODriver_Arg_t Arg); /******************************************************************** * Global Data ********************************************************************/ /* linux_sysmon device command that is called by iodriver to start up linux_sysmon */ -CFE_PSP_IODriver_API_t linux_sysmon_DevApi = {.DeviceCommand = linux_sysmon_DevCmd}; +CFE_PSP_IODriver_API_t linux_sysmon_DevApi = { .DeviceCommand = linux_sysmon_DevCmd }; CFE_PSP_MODULE_DECLARE_IODEVICEDRIVER(linux_sysmon); static linux_sysmon_state_t linux_sysmon_global; -static const char *linux_sysmon_subsystem_names[] = {"aggregate", "per-cpu", NULL}; -static const char *linux_sysmon_subchannel_names[] = {"cpu-load", NULL}; +static const char *linux_sysmon_subsystem_names[] = { "aggregate", "per-cpu", NULL }; +static const char *linux_sysmon_subchannel_names[] = { "cpu-load", NULL }; /*********************************************************************** * Global Functions @@ -120,7 +120,7 @@ void linux_sysmon_Init(uint32_t local_module_id) void linux_sysmon_read_cpuuse_line(const char *line_data, unsigned int *cpu_num, unsigned long *run_time) { unsigned long value; - const char * val_end; + const char *val_end; int val_count; /* each "cpu" line contains the cpu number followed by 9 values */ @@ -164,7 +164,7 @@ void linux_sysmon_update_schedstat(linux_sysmon_cpuload_state_t *state, int elap char line_data[256]; size_t line_size; ssize_t line_rdsz; - char * eol_p; + char *eol_p; linux_sysmon_cpuload_core_t *core_p; @@ -184,7 +184,7 @@ void linux_sysmon_update_schedstat(linux_sysmon_cpuload_state_t *state, int elap } /* check for newline char */ - eol_p = memchr(&line_data[line_size], '\n', line_rdsz); + eol_p = memchr(&line_data[line_size], '\n', line_rdsz); line_size += line_rdsz; while (eol_p != NULL) @@ -226,10 +226,12 @@ void linux_sysmon_update_schedstat(linux_sysmon_cpuload_state_t *state, int elap } else { - core_p->avg_load = (0x1000 * cpu_time_ms) / elapsed_ms; + core_p->avg_load = (0x1000 * cpu_time_ms) / elapsed_ms; core_p->avg_load |= (core_p->avg_load << 12); /* Expand from 12->24 bit */ } - LINUX_SYSMON_DEBUG("CFE_PSP(linux_sysmon): CPU%u time_ms=%u ms, load=%06x\n", cpu_num, cpu_time_ms, + LINUX_SYSMON_DEBUG("CFE_PSP(linux_sysmon): CPU%u time_ms=%u ms, load=%06x\n", + cpu_num, + cpu_time_ms, (unsigned int)core_p->avg_load); } } @@ -570,8 +572,8 @@ int32_t linux_sysmon_cpu_load_dispatch(uint32_t CommandCode, uint16_t Subchannel * \returns Status code * \retval #CFE_PSP_SUCCESS if successful */ -int32_t linux_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, - CFE_PSP_IODriver_Arg_t Arg) +int32_t +linux_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, CFE_PSP_IODriver_Arg_t Arg) { int32_t StatusCode; diff --git a/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.c b/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.c index 49e178e8..4640ffea 100644 --- a/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.c +++ b/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.c @@ -45,10 +45,10 @@ static struct rtems_bsdnet_ifconfig netdriver_config = { }; struct rtems_bsdnet_config rtems_bsdnet_config = { - .ifconfig = &netdriver_config, .bootp = rtems_bsdnet_do_dhcp_failsafe, /* fill if DHCP is used*/ + .ifconfig = &netdriver_config, + .bootp = rtems_bsdnet_do_dhcp_failsafe, /* fill if DHCP is used*/ }; - CFE_PSP_MODULE_DECLARE_SIMPLE(network_pc686_rtems); /* Module initialization function */ @@ -68,5 +68,4 @@ void network_pc686_rtems_Init(uint32 PspModuleId) { printf("Network init not successful: %s / %s (continuing)\n", rtems_status_text(status), strerror(errno)); } - } \ No newline at end of file diff --git a/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.h b/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.h index e33a3426..f98d554b 100644 --- a/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.h +++ b/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.h @@ -23,11 +23,11 @@ * */ - #ifndef CFE_PSP_NETWORK_PC686_RTEMS_H - #define CFE_PSP_NETWORK_PC686_RTEMS_H +#ifndef CFE_PSP_NETWORK_PC686_RTEMS_H +#define CFE_PSP_NETWORK_PC686_RTEMS_H /* Parameters needed for network initialization */ -static unsigned char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x61}; +static unsigned char ethernet_address[6] = { 0x00, 0x04, 0x9F, 0x00, 0x27, 0x61 }; static char net_name_str[] = "fxp1"; static char ip_addr_str[] = "10.0.2.15"; static char ip_netmask_str[] = "255.255.255.0"; diff --git a/fsw/modules/rtems_sysmon/rtems_sysmon.c b/fsw/modules/rtems_sysmon/rtems_sysmon.c index 7005b189..a64dcbd5 100644 --- a/fsw/modules/rtems_sysmon/rtems_sysmon.c +++ b/fsw/modules/rtems_sysmon/rtems_sysmon.c @@ -16,7 +16,7 @@ * limitations under the License. ************************************************************************/ /* - * Based on RTEMS5 cpuusagereport.c + * Based on RTEMS5 cpuusagereport.c */ /************************************************************************ @@ -36,7 +36,7 @@ /******************************************************************** * Local Function Prototypes ********************************************************************/ -static void rtems_sysmon_Init(uint32_t local_module_id); +static void rtems_sysmon_Init(uint32_t local_module_id); /******************************************************************** * Global Data @@ -45,14 +45,14 @@ static void rtems_sysmon_Init(uint32_t local_module_id); extern Timestamp_Control CPU_usage_Uptime_at_last_reset; /* rtems_sysmon device command that is called by iodriver to start up rtems_sysmon */ -CFE_PSP_IODriver_API_t rtems_sysmon_DevApi = {.DeviceCommand = rtems_sysmon_DevCmd}; +CFE_PSP_IODriver_API_t rtems_sysmon_DevApi = { .DeviceCommand = rtems_sysmon_DevCmd }; CFE_PSP_MODULE_DECLARE_IODEVICEDRIVER(rtems_sysmon); rtems_sysmon_state_t rtems_sysmon_global; -static const char *rtems_sysmon_subsystem_names[] = {"aggregate", "per-cpu", NULL}; -static const char *rtems_sysmon_subchannel_names[] = {"cpu-load", NULL}; +static const char *rtems_sysmon_subsystem_names[] = { "aggregate", "per-cpu", NULL }; +static const char *rtems_sysmon_subchannel_names[] = { "cpu-load", NULL }; /*********************************************************************** * Global Functions @@ -67,7 +67,7 @@ void rtems_sysmon_Init(uint32_t local_module_id) bool rtems_cpu_usage_visitor(Thread_Control *the_thread, void *arg) { rtems_sysmon_cpuload_state_t *state = (rtems_sysmon_cpuload_state_t *)arg; - rtems_sysmon_cpuload_core_t* core_p; + rtems_sysmon_cpuload_core_t *core_p; Timestamp_Control uptime_at_last_calc; Timestamp_Control idle_uptime_at_last_calc; @@ -76,65 +76,71 @@ bool rtems_cpu_usage_visitor(Thread_Control *the_thread, void *arg) Timestamp_Control idle_uptime_elapsed; Timestamp_Control total_elapsed; - char name[38]; - uint32_t ival; - uint32_t fval; - bool status = false; + char name[38]; + uint32_t ival; + uint32_t fval; + bool status = false; - if(state->poll_core_no >= RTEMS_SYSMON_MAX_CPUS) + if (state->poll_core_no >= RTEMS_SYSMON_MAX_CPUS) { /* Set true to stop iterating. All idle task has been found. */ - status = true; + status = true; state->poll_core_no = 0; } - core_p = &state->per_core[state->poll_core_no]; - uptime_at_last_calc = core_p->last_run_time; + core_p = &state->per_core[state->poll_core_no]; + uptime_at_last_calc = core_p->last_run_time; idle_uptime_at_last_calc = core_p->idle_last_uptime; _Thread_Get_name(the_thread, name, sizeof(name)); - if(strncmp("IDLE", name, 4) == 0 && status == false) + if (strncmp("IDLE", name, 4) == 0 && status == false) { - #if __RTEMS_MAJOR__ == 5 - _Thread_Get_CPU_time_used( the_thread, &idle_task_uptime ); - #else /* RTEMS 6 */ - idle_task_uptime = _Thread_Get_CPU_time_used_after_last_reset( the_thread ); - #endif +#if __RTEMS_MAJOR__ == 5 + _Thread_Get_CPU_time_used(the_thread, &idle_task_uptime); +#else /* RTEMS 6 */ + idle_task_uptime = _Thread_Get_CPU_time_used_after_last_reset(the_thread); +#endif _TOD_Get_uptime(¤t_uptime); _Timestamp_Subtract(&idle_uptime_at_last_calc, &idle_task_uptime, &idle_uptime_elapsed); _Timestamp_Subtract(&uptime_at_last_calc, ¤t_uptime, &total_elapsed); - _Timestamp_Divide(&idle_uptime_elapsed, &total_elapsed, &ival, &fval); /* ival - points to the integer portion */ - /* fval - points to the thousandths of percentage */ + _Timestamp_Divide(&idle_uptime_elapsed, + &total_elapsed, + &ival, + &fval); /* ival - points to the integer portion */ + /* fval - points to the thousandths of percentage */ - core_p->last_run_time = current_uptime; + core_p->last_run_time = current_uptime; core_p->idle_last_uptime = idle_task_uptime; - if(ival >= 100) + if (ival >= 100) { core_p->avg_load = 0xFFFFFF; /* max */ } - else if(total_elapsed == 0) + else if (total_elapsed == 0) { core_p->avg_load = 0; } else { - while (fval > 999) { fval /= 10; } /* Keep 3 most significant digits. Should not occur. */ + while (fval > 999) + { + fval /= 10; + } /* Keep 3 most significant digits. Should not occur. */ core_p->avg_load = (RTEMS_SYSMON_MAX_SCALE - ((ival * 1000) + fval)); /* Get percentages as integer */ - /* + /* ** Mimic ADC so that "analogio" API can be used with out modification. API assumes 24 bits. - ** First calculate out of 0x1000 and then duplicate it to expand to 24 bits. Doing this prevents + ** First calculate out of 0x1000 and then duplicate it to expand to 24 bits. Doing this prevents ** an overflow. avg_load has a "real" resolution of 12 bits. */ - core_p->avg_load = (0x1000 * core_p->avg_load) / RTEMS_SYSMON_MAX_SCALE; + core_p->avg_load = (0x1000 * core_p->avg_load) / RTEMS_SYSMON_MAX_SCALE; core_p->avg_load |= (core_p->avg_load << 12); } state->poll_core_no++; } - + /* return true to exit iterating tasks */ return status; } @@ -142,17 +148,17 @@ bool rtems_cpu_usage_visitor(Thread_Control *the_thread, void *arg) void rtems_sysmon_update_stat(rtems_sysmon_cpuload_state_t *state) { state->poll_core_no = 0; - rtems_task_iterate( rtems_cpu_usage_visitor, state); + rtems_task_iterate(rtems_cpu_usage_visitor, state); } rtems_task rtems_sysmon_Task(rtems_task_argument arg) { - rtems_sysmon_cpuload_state_t* state = (rtems_sysmon_cpuload_state_t *)arg; - int i; + rtems_sysmon_cpuload_state_t *state = (rtems_sysmon_cpuload_state_t *)arg; + int i; /* Initialize */ rtems_cpu_usage_reset(); - + memset(state->per_core, 0, RTEMS_SYSMON_MAX_CPUS * sizeof(rtems_sysmon_cpuload_core_t)); for (i = 0; i < RTEMS_SYSMON_MAX_CPUS; i++) { @@ -161,7 +167,6 @@ rtems_task rtems_sysmon_Task(rtems_task_argument arg) while (state->should_run) { - OS_TaskDelay(RTEMS_SYSMON_SAMPLE_DELAY); rtems_sysmon_update_stat(state); } @@ -177,7 +182,7 @@ rtems_task rtems_sysmon_Task(rtems_task_argument arg) * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ int32_t rtems_sysmon_Start(rtems_sysmon_cpuload_state_t *state) { - int32_t StatusCode; + int32_t StatusCode; rtems_status_code status; if (state->is_running) @@ -192,19 +197,22 @@ int32_t rtems_sysmon_Start(rtems_sysmon_cpuload_state_t *state) StatusCode = CFE_PSP_ERROR; state->should_run = true; - state->task_name = rtems_build_name( 'R','S','M',' '); - status = rtems_task_create(state->task_name, RTEMS_SYSMON_TASK_PRIORITY, - RTEMS_SYSMON_STACK_SIZE, RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, &state->task_id); - if(status != RTEMS_SUCCESSFUL) + state->task_name = rtems_build_name('R', 'S', 'M', ' '); + status = rtems_task_create(state->task_name, + RTEMS_SYSMON_TASK_PRIORITY, + RTEMS_SYSMON_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &state->task_id); + if (status != RTEMS_SUCCESSFUL) { perror("rtems_task_create()"); state->should_run = false; } else { - status = rtems_task_start(state->task_id, rtems_sysmon_Task, (rtems_task_argument) state); - if(status != RTEMS_SUCCESSFUL) + status = rtems_task_start(state->task_id, rtems_sysmon_Task, (rtems_task_argument)state); + if (status != RTEMS_SUCCESSFUL) { perror("rtems_task_start()"); rtems_task_delete(state->task_id); @@ -215,9 +223,9 @@ int32_t rtems_sysmon_Start(rtems_sysmon_cpuload_state_t *state) OS_printf("CFE_PSP(RTEMS_SysMon): Started CPU utilization monitoring\n"); StatusCode = CFE_PSP_SUCCESS; - state->is_running = true; + state->is_running = true; } - } + } } return StatusCode; } @@ -236,18 +244,17 @@ int32_t rtems_sysmon_Stop(rtems_sysmon_cpuload_state_t *state) int32_t rtems_sysmon_calc_aggregate_cpu(rtems_sysmon_cpuload_state_t *state, CFE_PSP_IODriver_AdcCode_t *Val) { - uint8_t cpu; uint32_t sum; sum = 0; - for (cpu = 0; cpu < RTEMS_SYSMON_MAX_CPUS; cpu++ ) + for (cpu = 0; cpu < RTEMS_SYSMON_MAX_CPUS; cpu++) { - sum += state->per_core[cpu].avg_load; + sum += state->per_core[cpu].avg_load; } - sum /= RTEMS_SYSMON_MAX_CPUS; - *Val = sum; + sum /= RTEMS_SYSMON_MAX_CPUS; + *Val = sum; RTEMS_SYSMON_DEBUG("CFE_PSP(rtems_sysmon): Aggregate CPU load=%08X\n", (unsigned int)sum); @@ -260,8 +267,8 @@ int32_t rtems_sysmon_aggregate_dispatch(uint32_t CommandCode, uint16_t Subchanne rtems_sysmon_cpuload_state_t *state; /* There is just one global cpuload object */ - state = &rtems_sysmon_global.cpu_load; - + state = &rtems_sysmon_global.cpu_load; + StatusCode = CFE_PSP_ERROR_NOT_IMPLEMENTED; switch (CommandCode) { @@ -269,7 +276,7 @@ int32_t rtems_sysmon_aggregate_dispatch(uint32_t CommandCode, uint16_t Subchanne case CFE_PSP_IODriver_ANALOG_IO_NOOP: RTEMS_SYSMON_DEBUG("CFE_PSP(RTEMS_SysMon): Noop \n"); break; - case CFE_PSP_IODriver_SET_RUNNING: + case CFE_PSP_IODriver_SET_RUNNING: { if (Arg.U32) { @@ -281,7 +288,7 @@ int32_t rtems_sysmon_aggregate_dispatch(uint32_t CommandCode, uint16_t Subchanne } break; } - case CFE_PSP_IODriver_GET_RUNNING: + case CFE_PSP_IODriver_GET_RUNNING: { StatusCode = state->is_running; break; @@ -418,8 +425,8 @@ int32_t rtems_sysmon_cpu_load_dispatch(uint32_t CommandCode, uint16_t Subchannel * \returns Status code * \retval #CFE_PSP_SUCCESS if successful */ -int32_t rtems_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, - CFE_PSP_IODriver_Arg_t Arg) +int32_t +rtems_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, CFE_PSP_IODriver_Arg_t Arg) { int32_t StatusCode; diff --git a/fsw/modules/rtems_sysmon/rtems_sysmon.h b/fsw/modules/rtems_sysmon/rtems_sysmon.h index f6140988..d27cf062 100644 --- a/fsw/modules/rtems_sysmon/rtems_sysmon.h +++ b/fsw/modules/rtems_sysmon/rtems_sysmon.h @@ -29,9 +29,9 @@ * Local Defines ********************************************************************/ #ifdef OS_MAXIMUM_PROCESSORS - #define RTEMS_SYSMON_MAX_CPUS OS_MAXIMUM_PROCESSORS +#define RTEMS_SYSMON_MAX_CPUS OS_MAXIMUM_PROCESSORS #else - #define RTEMS_SYSMON_MAX_CPUS 1 +#define RTEMS_SYSMON_MAX_CPUS 1 #endif #define RTEMS_SYSMON_AGGREGATE_SUBSYS 0 @@ -48,15 +48,14 @@ #define RTEMS_SYSMON_DEBUG(...) #endif - /******************************************************************** * Local Type Definitions ********************************************************************/ typedef struct rtems_sysmon_cpuload_core { CFE_PSP_IODriver_AdcCode_t avg_load; - Timestamp_Control last_run_time; - Timestamp_Control idle_last_uptime; + Timestamp_Control last_run_time; + Timestamp_Control idle_last_uptime; } rtems_sysmon_cpuload_core_t; @@ -68,7 +67,7 @@ typedef struct rtems_sysmon_cpuload_state rtems_id task_id; rtems_name task_name; - uint8_t poll_core_no; + uint8_t poll_core_no; rtems_sysmon_cpuload_core_t per_core[RTEMS_SYSMON_MAX_CPUS]; } rtems_sysmon_cpuload_state_t; @@ -79,13 +78,12 @@ typedef struct rtems_sysmon_state rtems_sysmon_cpuload_state_t cpu_load; } rtems_sysmon_state_t; - /******************************************************************** * Local Function Prototypes ********************************************************************/ rtems_task rtems_sysmon_Task(rtems_task_argument arg); -void rtems_sysmon_update_stat(rtems_sysmon_cpuload_state_t *state); -bool rtems_cpu_usage_visitor(Thread_Control *the_thread, void *arg); +void rtems_sysmon_update_stat(rtems_sysmon_cpuload_state_t *state); +bool rtems_cpu_usage_visitor(Thread_Control *the_thread, void *arg); int32_t rtems_sysmon_Start(rtems_sysmon_cpuload_state_t *state); int32_t rtems_sysmon_Stop(rtems_sysmon_cpuload_state_t *state); @@ -94,8 +92,7 @@ int32_t rtems_sysmon_aggregate_dispatch(uint32_t CommandCode, uint16_t Subchanne int32_t rtems_sysmon_calc_aggregate_cpu(rtems_sysmon_cpuload_state_t *state, CFE_PSP_IODriver_AdcCode_t *Val); /* Function that starts up rtems_sysmon driver. */ -int32_t rtems_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, - CFE_PSP_IODriver_Arg_t Arg); - +int32_t +rtems_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, CFE_PSP_IODriver_Arg_t Arg); #endif /* RTEMS_SYSMON_H_ */ diff --git a/fsw/modules/soft_timebase/cfe_psp_soft_timebase.c b/fsw/modules/soft_timebase/cfe_psp_soft_timebase.c index efceed38..658858ca 100644 --- a/fsw/modules/soft_timebase/cfe_psp_soft_timebase.c +++ b/fsw/modules/soft_timebase/cfe_psp_soft_timebase.c @@ -54,7 +54,8 @@ void soft_timebase_Init(uint32 PspModuleId) if (status == OS_SUCCESS) { /* Set the timebase to trigger with desired resolution */ - status = OS_TimeBaseSet(PSP_SoftTimebase_Global.sys_timebase_id, CFE_PSP_SOFT_TIMEBASE_PERIOD, + status = OS_TimeBaseSet(PSP_SoftTimebase_Global.sys_timebase_id, + CFE_PSP_SOFT_TIMEBASE_PERIOD, CFE_PSP_SOFT_TIMEBASE_PERIOD); } @@ -69,12 +70,14 @@ void soft_timebase_Init(uint32 PspModuleId) if (status != OS_SUCCESS) { printf("CFE_PSP: *** Failed to configure software timebase \'%s\', status = %d! ***\n", - CFE_PSP_SOFT_TIMEBASE_NAME, (int)status); + CFE_PSP_SOFT_TIMEBASE_NAME, + (int)status); } else { /* Inform the user that this module is in use */ - printf("CFE_PSP: Instantiated software timebase \'%s\' running at %lu usec\n", CFE_PSP_SOFT_TIMEBASE_NAME, + printf("CFE_PSP: Instantiated software timebase \'%s\' running at %lu usec\n", + CFE_PSP_SOFT_TIMEBASE_NAME, (unsigned long)CFE_PSP_SOFT_TIMEBASE_PERIOD); } } diff --git a/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c b/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c index 243cca99..8c822031 100644 --- a/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c +++ b/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c @@ -98,7 +98,7 @@ void timebase_vxworks_Init(uint32 PspModuleId) * Note this may not be an exact value. The API is limited * in this regard. */ - TicksPerSec = 1000000000; + TicksPerSec = 1000000000; TicksPerSec *= CFE_PSP_VX_TIMEBASE_PERIOD_DENOMINATOR; TicksPerSec /= CFE_PSP_VX_TIMEBASE_PERIOD_NUMERATOR; @@ -108,8 +108,8 @@ void timebase_vxworks_Init(uint32 PspModuleId) * This is the timebase period divided by OS_TIME_TICK_RESOLUTION_NS, * which may not be a whole number. */ - RatioN = CFE_PSP_VX_TIMEBASE_PERIOD_NUMERATOR; - RatioD = CFE_PSP_VX_TIMEBASE_PERIOD_DENOMINATOR; + RatioN = CFE_PSP_VX_TIMEBASE_PERIOD_NUMERATOR; + RatioD = CFE_PSP_VX_TIMEBASE_PERIOD_DENOMINATOR; RatioD *= OS_TIME_TICK_RESOLUTION_NS; /* @@ -145,8 +145,10 @@ void timebase_vxworks_Init(uint32 PspModuleId) } /* Inform the user that this module is in use */ - printf("CFE_PSP: Set up VxWorks timebase, %lu ticks/sec, OS_time_t ratio=%lu/%lu\n", (unsigned long)TicksPerSec, - (unsigned long)RatioN, (unsigned long)RatioD); + printf("CFE_PSP: Set up VxWorks timebase, %lu ticks/sec, OS_time_t ratio=%lu/%lu\n", + (unsigned long)TicksPerSec, + (unsigned long)RatioN, + (unsigned long)RatioD); /* Save the final reduced fraction for use in CFE_PSP_GetTime() */ PSP_VxWorks_Timebase_Global.OSTimeConvNumerator = RatioN; @@ -218,9 +220,9 @@ void CFE_PSP_GetTime(OS_time_t *LocalTime) * cycle or reset) for over 2000 years to reach that point, so * for all practical purposes it does not roll over. */ - NormalizedTicks = RegUpper; + NormalizedTicks = RegUpper; NormalizedTicks <<= 32; - NormalizedTicks |= RegLower; + NormalizedTicks |= RegLower; /* * Apply the pre-computed conversion to OS_time_t. @@ -232,6 +234,6 @@ void CFE_PSP_GetTime(OS_time_t *LocalTime) NormalizedTicks /= PSP_VxWorks_Timebase_Global.OSTimeConvDenominator; /* Output the value as an OS_time_t */ - *LocalTime = (OS_time_t) {NormalizedTicks}; + *LocalTime = (OS_time_t) { NormalizedTicks }; } } diff --git a/fsw/modules/vxworks_sysmon/vxworks_sysmon.c b/fsw/modules/vxworks_sysmon/vxworks_sysmon.c index 6dc38911..418b9e54 100644 --- a/fsw/modules/vxworks_sysmon/vxworks_sysmon.c +++ b/fsw/modules/vxworks_sysmon/vxworks_sysmon.c @@ -37,14 +37,14 @@ static void vxworks_sysmon_Init(uint32_t local_module_id); * Global Data ********************************************************************/ /* vxworks_sysmon device command that is called by iodriver to start up vxworks_sysmon */ -CFE_PSP_IODriver_API_t vxworks_sysmon_DevApi = {.DeviceCommand = vxworks_sysmon_DevCmd}; +CFE_PSP_IODriver_API_t vxworks_sysmon_DevApi = { .DeviceCommand = vxworks_sysmon_DevCmd }; CFE_PSP_MODULE_DECLARE_IODEVICEDRIVER(vxworks_sysmon); vxworks_sysmon_state_t vxworks_sysmon_global; -static const char *vxworks_sysmon_subsystem_names[] = {"aggregate", "per-cpu", NULL}; -static const char *vxworks_sysmon_subchannel_names[] = {"cpu-load", NULL}; +static const char *vxworks_sysmon_subsystem_names[] = { "aggregate", "per-cpu", NULL }; +static const char *vxworks_sysmon_subchannel_names[] = { "cpu-load", NULL }; /*********************************************************************** * Global Functions @@ -58,9 +58,9 @@ void vxworks_sysmon_Init(uint32_t local_module_id) int vxworks_sysmon_update_stat(const char *fmt, ...) { vxworks_sysmon_cpuload_state_t *state; - vxworks_sysmon_cpuload_core_t *core_p; - int curr_load; - va_list arg; + vxworks_sysmon_cpuload_core_t *core_p; + int curr_load; + va_list arg; state = &vxworks_sysmon_global.cpu_load; @@ -76,10 +76,10 @@ int vxworks_sysmon_update_stat(const char *fmt, ...) core_p->idle_state.name = va_arg(arg, char *); /* only want IDLE string */ - if(strncmp("IDLE", core_p->idle_state.name, 4) == 0) + if (strncmp("IDLE", core_p->idle_state.name, 4) == 0) { /* - ** Example format: + ** Example format: ** (* printRtn) (spyFmt2, "IDLE", "", "", "", totalPerCent, spyIdleTicks, ** incPerCent, tmpIdleIncTicks); ** @@ -92,10 +92,10 @@ int vxworks_sysmon_update_stat(const char *fmt, ...) core_p->idle_state.placeholder = va_arg(arg, char *); core_p->idle_state.placeholder = va_arg(arg, char *); - core_p->idle_state.total_idle_percent = va_arg(arg, int); - core_p->idle_state.total_idle_ticks = va_arg(arg, int); + core_p->idle_state.total_idle_percent = va_arg(arg, int); + core_p->idle_state.total_idle_ticks = va_arg(arg, int); core_p->idle_state.idle_percent_since_last_report = va_arg(arg, int); - core_p->idle_state.idle_ticks_since_last_report = va_arg(arg, int); + core_p->idle_state.idle_ticks_since_last_report = va_arg(arg, int); curr_load = VXWORKS_SYSMON_MAX_SCALE - core_p->idle_state.idle_percent_since_last_report; @@ -109,17 +109,17 @@ int vxworks_sysmon_update_stat(const char *fmt, ...) } else { - core_p->avg_load = (0x1000 * curr_load) / VXWORKS_SYSMON_MAX_SCALE ; + core_p->avg_load = (0x1000 * curr_load) / VXWORKS_SYSMON_MAX_SCALE; core_p->avg_load |= (core_p->avg_load << 12); /* Expand from 12->24 bit */ } VXWORKS_SYSMON_DEBUG("CFE_PSP(vxworks_sysmon): load=%06x\n", (unsigned int)core_p->avg_load); VXWORKS_SYSMON_DEBUG("Name: %s, Total Percent: %d, Total Ticks: %d, Idle Percent: %d, Idle Ticks: %d\n", - core_p->idle_state.name, - core_p->idle_state.total_idle_percent, - core_p->idle_state.total_idle_ticks, - core_p->idle_state.idle_percent_since_last_report, - core_p->idle_state.idle_ticks_since_last_report); + core_p->idle_state.name, + core_p->idle_state.total_idle_percent, + core_p->idle_state.total_idle_ticks, + core_p->idle_state.idle_percent_since_last_report, + core_p->idle_state.idle_ticks_since_last_report); } /* end of idle check */ @@ -132,16 +132,16 @@ int vxworks_sysmon_update_stat(const char *fmt, ...) void vxworks_sysmon_Task(void) { - int status; + int status; vxworks_sysmon_cpuload_state_t *state = &vxworks_sysmon_global.cpu_load; /* Initialize */ spyLibInit(VXWORKS_SYSMON_MAX_SPY_TASKS); memset(state->per_core, 0, VXWORKS_SYSMON_MAX_CPUS * sizeof(vxworks_sysmon_cpuload_core_t)); - /* - ** Begin collecting data by enabling the auxilary clock interrupts at a frequency of interrupts per - ** second + /* + ** Begin collecting data by enabling the auxilary clock interrupts at a frequency of interrupts per + ** second */ status = spyClkStartCommon(VXWORKS_AUX_CLOCK_INTERRUPT_FREQ, (FUNCPTR)OS_printf); if (status != OK) @@ -155,11 +155,10 @@ void vxworks_sysmon_Task(void) { OS_TaskDelay(VXWORKS_SYSMON_SAMPLE_DELAY); - spyReportCommon( (FUNCPTR)vxworks_sysmon_update_stat); + spyReportCommon((FUNCPTR)vxworks_sysmon_update_stat); } spyClkStopCommon(); /* Disable auxillary clock interrupts */ - } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -170,7 +169,7 @@ void vxworks_sysmon_Task(void) * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ int32_t vxworks_sysmon_Start(vxworks_sysmon_cpuload_state_t *state) { - uint32_t StatusCode; + uint32_t StatusCode; if (state->is_running) { @@ -182,26 +181,25 @@ int32_t vxworks_sysmon_Start(vxworks_sysmon_cpuload_state_t *state) /* start clean */ memset(state, 0, sizeof(*state)); state->should_run = true; - StatusCode = OS_TaskCreate(&state->task_id, - VXWORKS_SYSMON_TASK_NAME, + StatusCode = OS_TaskCreate(&state->task_id, + VXWORKS_SYSMON_TASK_NAME, vxworks_sysmon_Task, - NULL, - VXWORKS_SYSMON_STACK_SIZE, - VXWORKS_SYSMON_TASK_PRIORITY, + NULL, + VXWORKS_SYSMON_STACK_SIZE, + VXWORKS_SYSMON_TASK_PRIORITY, 0); - if(StatusCode != OS_SUCCESS) + if (StatusCode != OS_SUCCESS) { perror("vxworks_task_create()"); - StatusCode = CFE_PSP_ERROR; + StatusCode = CFE_PSP_ERROR; state->should_run = false; } else { - OS_printf("CFE_PSP(VXWORKS_SYSMON): Started CPU utilization monitoring\n"); state->is_running = true; StatusCode = CFE_PSP_SUCCESS; - } + } } return StatusCode; } @@ -222,18 +220,17 @@ int32_t vxworks_sysmon_Stop(vxworks_sysmon_cpuload_state_t *state) int32_t vxworks_sysmon_calc_aggregate_cpu(vxworks_sysmon_cpuload_state_t *state, CFE_PSP_IODriver_AdcCode_t *Val) { - uint8_t cpu; uint32_t sum; sum = 0; - for (cpu = 0; cpu < VXWORKS_SYSMON_MAX_CPUS; cpu++ ) + for (cpu = 0; cpu < VXWORKS_SYSMON_MAX_CPUS; cpu++) { - sum += state->per_core[cpu].avg_load; + sum += state->per_core[cpu].avg_load; } - sum /= VXWORKS_SYSMON_MAX_CPUS; - *Val = sum; + sum /= VXWORKS_SYSMON_MAX_CPUS; + *Val = sum; VXWORKS_SYSMON_DEBUG("CFE_PSP(vxworks_sysmon): Aggregate CPU load=%08X\n", (unsigned int)sum); @@ -242,12 +239,12 @@ int32_t vxworks_sysmon_calc_aggregate_cpu(vxworks_sysmon_cpuload_state_t *state, int32_t vxworks_sysmon_aggregate_dispatch(uint32_t CommandCode, uint16_t Subchannel, CFE_PSP_IODriver_Arg_t Arg) { - int32_t StatusCode; + int32_t StatusCode; vxworks_sysmon_cpuload_state_t *state; /* There is just one global cpuload object */ - state = &vxworks_sysmon_global.cpu_load; - + state = &vxworks_sysmon_global.cpu_load; + StatusCode = CFE_PSP_ERROR_NOT_IMPLEMENTED; switch (CommandCode) { @@ -255,7 +252,7 @@ int32_t vxworks_sysmon_aggregate_dispatch(uint32_t CommandCode, uint16_t Subchan case CFE_PSP_IODriver_ANALOG_IO_NOOP: VXWORKS_SYSMON_DEBUG("CFE_PSP(vxworks_sysmon): Noop \n"); break; - case CFE_PSP_IODriver_SET_RUNNING: + case CFE_PSP_IODriver_SET_RUNNING: { if (Arg.U32) { @@ -267,7 +264,7 @@ int32_t vxworks_sysmon_aggregate_dispatch(uint32_t CommandCode, uint16_t Subchan } break; } - case CFE_PSP_IODriver_GET_RUNNING: + case CFE_PSP_IODriver_GET_RUNNING: { StatusCode = state->is_running; break; @@ -339,7 +336,7 @@ int32_t vxworks_sysmon_aggregate_dispatch(uint32_t CommandCode, uint16_t Subchan int32_t vxworks_sysmon_cpu_load_dispatch(uint32_t CommandCode, uint16_t Subchannel, CFE_PSP_IODriver_Arg_t Arg) { - int32_t StatusCode; + int32_t StatusCode; vxworks_sysmon_cpuload_state_t *state; /* There is just one global cpuload object */ @@ -403,8 +400,8 @@ int32_t vxworks_sysmon_cpu_load_dispatch(uint32_t CommandCode, uint16_t Subchann * \returns Status code * \retval #CFE_PSP_SUCCESS if successful */ -int32_t vxworks_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, - CFE_PSP_IODriver_Arg_t Arg) +int32_t +vxworks_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, CFE_PSP_IODriver_Arg_t Arg) { int32_t StatusCode; diff --git a/fsw/modules/vxworks_sysmon/vxworks_sysmon.h b/fsw/modules/vxworks_sysmon/vxworks_sysmon.h index 7b79f935..8301dfdd 100644 --- a/fsw/modules/vxworks_sysmon/vxworks_sysmon.h +++ b/fsw/modules/vxworks_sysmon/vxworks_sysmon.h @@ -29,9 +29,9 @@ * Local Defines ********************************************************************/ #ifdef OS_MAXIMUM_PROCESSORS - #define VXWORKS_SYSMON_MAX_CPUS OS_MAXIMUM_PROCESSORS +#define VXWORKS_SYSMON_MAX_CPUS OS_MAXIMUM_PROCESSORS #else - #define VXWORKS_SYSMON_MAX_CPUS 1 +#define VXWORKS_SYSMON_MAX_CPUS 1 #endif #define VXWORKS_SYSMON_AGGREGATE_SUBSYS 0 @@ -40,7 +40,7 @@ #define VXWORKS_SYSMON_SAMPLE_DELAY 1000 #define VXWORKS_SYSMON_TASK_PRIORITY 100 #define VXWORKS_SYSMON_STACK_SIZE 4096 -#define VXWORKS_AUX_CLOCK_INTERRUPT_FREQ 100 /* Frequency to collect data (interrupts per second) */ +#define VXWORKS_AUX_CLOCK_INTERRUPT_FREQ 100 /* Frequency to collect data (interrupts per second) */ #define VXWORKS_SYSMON_MAX_SCALE 100 #define VXWORKS_SYSMON_TASK_NAME "VXWORKS SYSMON" #define VXWORKS_SYSMON_MAX_SPY_TASKS 100 /* Max number of tasks to spy on */ @@ -58,10 +58,10 @@ typedef struct vxworks_sysmon_va_arg { char *name; char *placeholder; /* empty */ - int total_idle_percent; - int total_idle_ticks; - int idle_percent_since_last_report; - int idle_ticks_since_last_report; + int total_idle_percent; + int total_idle_ticks; + int idle_percent_since_last_report; + int idle_ticks_since_last_report; } vxworks_sysmon_va_arg_t; @@ -77,9 +77,9 @@ typedef struct vxworks_sysmon_cpuload_state volatile bool is_running; volatile bool should_run; - osal_id_t task_id; + osal_id_t task_id; - uint8_t poll_core_no; + uint8_t poll_core_no; vxworks_sysmon_cpuload_core_t per_core[VXWORKS_SYSMON_MAX_CPUS]; @@ -87,14 +87,14 @@ typedef struct vxworks_sysmon_cpuload_state typedef struct vxworks_sysmon_state { - uint32_t local_module_id; + uint32_t local_module_id; vxworks_sysmon_cpuload_state_t cpu_load; } vxworks_sysmon_state_t; /******************************************************************** * Local Function Prototypes ********************************************************************/ -int vxworks_sysmon_update_stat(const char *fmt, ...); +int vxworks_sysmon_update_stat(const char *fmt, ...); void vxworks_sysmon_Task(void); int32_t vxworks_sysmon_Start(vxworks_sysmon_cpuload_state_t *state); @@ -104,7 +104,7 @@ int32_t vxworks_sysmon_aggregate_dispatch(uint32_t CommandCode, uint16_t Subchan int32_t vxworks_sysmon_calc_aggregate_cpu(vxworks_sysmon_cpuload_state_t *state, CFE_PSP_IODriver_AdcCode_t *Val); /* Function that starts up vxworks_sysmon driver. */ -int32_t vxworks_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, - CFE_PSP_IODriver_Arg_t Arg); +int32_t +vxworks_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, CFE_PSP_IODriver_Arg_t Arg); #endif /* VXWORKS_SYSMON_H_ */ diff --git a/fsw/pc-linux/inc/psp_version.h b/fsw/pc-linux/inc/psp_version.h index 024f6092..cdf9628f 100644 --- a/fsw/pc-linux/inc/psp_version.h +++ b/fsw/pc-linux/inc/psp_version.h @@ -30,14 +30,14 @@ #define CFE_PSP_IMPL_BUILD_NUMBER 0 #define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0" #define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */ -#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ +#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ /* * Version Macros, see \ref cfsversions for definitions. */ -#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ -#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ -#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ +#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ +#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ +#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ /** * @brief Last official release. @@ -68,9 +68,9 @@ /** * @brief Max Version String length. - * + * * Maximum length that a tblCRCTool version string can be. - * + * */ #define CFE_PSP_CFG_MAX_VERSION_STR_LEN 256 diff --git a/fsw/pc-linux/src/cfe_psp_exception.c b/fsw/pc-linux/src/cfe_psp_exception.c index bbf7acb0..68550559 100644 --- a/fsw/pc-linux/src/cfe_psp_exception.c +++ b/fsw/pc-linux/src/cfe_psp_exception.c @@ -98,7 +98,7 @@ void CFE_PSP_ExceptionSigHandler(int signo, siginfo_t *si, void *ctxt) NumAddrs = backtrace(Buffer->context_info.bt_addrs, CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE); Buffer->context_size = offsetof(CFE_PSP_Exception_ContextDataEntry_t, bt_addrs[NumAddrs]); /* pthread_self() is signal-safe per POSIX.1-2013 */ - Buffer->sys_task_id = pthread_self(); + Buffer->sys_task_id = pthread_self(); CFE_PSP_Exception_WriteComplete(); } @@ -302,7 +302,10 @@ int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer default: ComputedReason = "Unknown SIGFPE"; } - (void)snprintf(ReasonBuf, ReasonSize, "%s at ip 0x%lx", ComputedReason, + (void)snprintf(ReasonBuf, + ReasonSize, + "%s at ip 0x%lx", + ComputedReason, (unsigned long)Buffer->context_info.si.si_addr); } else if (Buffer->context_info.si.si_signo == SIGINT) diff --git a/fsw/pc-linux/src/cfe_psp_memory.c b/fsw/pc-linux/src/cfe_psp_memory.c index 649f1f2e..a603c81d 100644 --- a/fsw/pc-linux/src/cfe_psp_memory.c +++ b/fsw/pc-linux/src/cfe_psp_memory.c @@ -96,13 +96,13 @@ void CFE_PSP_InitUserReservedArea(void); #ifdef __riscv extern unsigned int _start; extern unsigned int __DATA_BEGIN__; -#define CODE_START_ADDR ((cpuaddr)&_start) -#define CODE_END_ADDR ((cpuaddr)&__DATA_BEGIN__) +#define CODE_START_ADDR ((cpuaddr) & _start) +#define CODE_END_ADDR ((cpuaddr) & __DATA_BEGIN__) #else extern unsigned int _init; extern unsigned int _fini; -#define CODE_START_ADDR ((cpuaddr)&_init) -#define CODE_END_ADDR ((cpuaddr)&_fini) +#define CODE_START_ADDR ((cpuaddr) & _init) +#define CODE_END_ADDR ((cpuaddr) & _fini) #endif /* @@ -245,7 +245,7 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 { if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE)) { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; CopyPtr += CDSOffset; memcpy(CopyPtr, (char *)PtrToDataToWrite, NumBytes); @@ -280,7 +280,7 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt { if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE)) { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; CopyPtr += CDSOffset; memcpy((char *)PtrToDataToRead, CopyPtr, NumBytes); @@ -337,12 +337,12 @@ void CFE_PSP_InitResetArea(void) * reside in this shared memory segment so it will be preserved on a processor * reset. */ - align_mask = sysconf(_SC_PAGESIZE) - 1; /* align blocks to whole memory pages */ - total_size = sizeof(CFE_PSP_LinuxReservedAreaFixedLayout_t); - total_size = (total_size + align_mask) & ~align_mask; - reset_offset = total_size; - total_size += CFE_PSP_RESET_AREA_SIZE; - total_size = (total_size + align_mask) & ~align_mask; + align_mask = sysconf(_SC_PAGESIZE) - 1; /* align blocks to whole memory pages */ + total_size = sizeof(CFE_PSP_LinuxReservedAreaFixedLayout_t); + total_size = (total_size + align_mask) & ~align_mask; + reset_offset = total_size; + total_size += CFE_PSP_RESET_AREA_SIZE; + total_size = (total_size + align_mask) & ~align_mask; /* ** connect to (and possibly create) the segment: @@ -363,8 +363,8 @@ void CFE_PSP_InitResetArea(void) CFE_PSP_Panic(CFE_PSP_ERROR); } - FixedBlocksPtr = (CFE_PSP_LinuxReservedAreaFixedLayout_t *)block_addr; - block_addr += reset_offset; + FixedBlocksPtr = (CFE_PSP_LinuxReservedAreaFixedLayout_t *)block_addr; + block_addr += reset_offset; CFE_PSP_ReservedMemoryMap.BootPtr = &FixedBlocksPtr->BootRecord; CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedBlocksPtr->ExceptionStorage; @@ -653,7 +653,8 @@ int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) memset(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr, 0, CFE_PSP_USER_RESERVED_SIZE); memset(CFE_PSP_ReservedMemoryMap.BootPtr, 0, sizeof(*CFE_PSP_ReservedMemoryMap.BootPtr)); - memset(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr, 0, + memset(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr, + 0, sizeof(*CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr)); /* diff --git a/fsw/pc-linux/src/cfe_psp_start.c b/fsw/pc-linux/src/cfe_psp_start.c index e8bfb584..d95f28de 100644 --- a/fsw/pc-linux/src/cfe_psp_start.c +++ b/fsw/pc-linux/src/cfe_psp_start.c @@ -132,13 +132,15 @@ static const char *optString = "R:S:C:I:N:h"; /* ** getopts_long long form argument table */ -static const struct option longOpts[] = {{"reset", required_argument, NULL, 'R'}, - {"subtype", required_argument, NULL, 'S'}, - {"cpuid", required_argument, NULL, 'C'}, - {"scid", required_argument, NULL, 'I'}, - {"cpuname", required_argument, NULL, 'N'}, - {"help", no_argument, NULL, 'h'}, - {NULL, no_argument, NULL, 0}}; +static const struct option longOpts[] = { + { "reset", required_argument, NULL, 'R' }, + { "subtype", required_argument, NULL, 'S' }, + { "cpuid", required_argument, NULL, 'C' }, + { "scid", required_argument, NULL, 'I' }, + { "cpuname", required_argument, NULL, 'N' }, + { "help", no_argument, NULL, 'h' }, + { NULL, no_argument, NULL, 0 } +}; /****************************************************************************** ** @@ -268,8 +270,8 @@ void OS_Application_Startup(void) strncpy(CommandData.ResetType, optarg, CFE_PSP_RESET_NAME_LENGTH - 1); CommandData.ResetType[CFE_PSP_RESET_NAME_LENGTH - 1] = 0; - if ((strncmp(CommandData.ResetType, "PO", CFE_PSP_RESET_NAME_LENGTH) != 0) && - (strncmp(CommandData.ResetType, "PR", CFE_PSP_RESET_NAME_LENGTH) != 0)) + if ((strncmp(CommandData.ResetType, "PO", CFE_PSP_RESET_NAME_LENGTH) != 0) + && (strncmp(CommandData.ResetType, "PR", CFE_PSP_RESET_NAME_LENGTH) != 0)) { printf("\nERROR: Invalid Reset Type: %s\n\n", CommandData.ResetType); CommandData.GotResetType = 0; @@ -409,8 +411,8 @@ void OS_Application_Startup(void) reset_type = 0; if (!CommandData.GotResetType) { - if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID || - CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) + if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID + || CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) { reset_type = CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType; } @@ -488,8 +490,8 @@ void OS_Application_Run(void) /* go idle and wait for an event */ ret = sigwait(&sigset, &sig); - if (ret == 0 && !CFE_PSP_IdleTaskState.ShutdownReq && sig == CFE_PSP_EXCEPTION_EVENT_SIGNAL && - GLOBAL_CFE_CONFIGDATA.SystemNotify != NULL) + if (ret == 0 && !CFE_PSP_IdleTaskState.ShutdownReq && sig == CFE_PSP_EXCEPTION_EVENT_SIGNAL + && GLOBAL_CFE_CONFIGDATA.SystemNotify != NULL) { /* notify the CFE of the event */ GLOBAL_CFE_CONFIGDATA.SystemNotify(); diff --git a/fsw/pc-linux/src/cfe_psp_watchdog.c b/fsw/pc-linux/src/cfe_psp_watchdog.c index 09df80e2..4cd1f960 100644 --- a/fsw/pc-linux/src/cfe_psp_watchdog.c +++ b/fsw/pc-linux/src/cfe_psp_watchdog.c @@ -82,7 +82,9 @@ void CFE_PSP_WatchdogInit(void) * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_PSP_WatchdogEnable(void) {} +void CFE_PSP_WatchdogEnable(void) +{ +} /*---------------------------------------------------------------- * @@ -90,7 +92,9 @@ void CFE_PSP_WatchdogEnable(void) {} * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_PSP_WatchdogDisable(void) {} +void CFE_PSP_WatchdogDisable(void) +{ +} /*---------------------------------------------------------------- * @@ -98,7 +102,9 @@ void CFE_PSP_WatchdogDisable(void) {} * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_PSP_WatchdogService(void) {} +void CFE_PSP_WatchdogService(void) +{ +} /*---------------------------------------------------------------- * diff --git a/fsw/pc-rtems/inc/psp_version.h b/fsw/pc-rtems/inc/psp_version.h index 024f6092..cdf9628f 100644 --- a/fsw/pc-rtems/inc/psp_version.h +++ b/fsw/pc-rtems/inc/psp_version.h @@ -30,14 +30,14 @@ #define CFE_PSP_IMPL_BUILD_NUMBER 0 #define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0" #define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */ -#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ +#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ /* * Version Macros, see \ref cfsversions for definitions. */ -#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ -#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ -#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ +#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ +#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ +#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ /** * @brief Last official release. @@ -68,9 +68,9 @@ /** * @brief Max Version String length. - * + * * Maximum length that a tblCRCTool version string can be. - * + * */ #define CFE_PSP_CFG_MAX_VERSION_STR_LEN 256 diff --git a/fsw/pc-rtems/src/cfe_psp_exception.c b/fsw/pc-rtems/src/cfe_psp_exception.c index 60e43d06..06569978 100644 --- a/fsw/pc-rtems/src/cfe_psp_exception.c +++ b/fsw/pc-rtems/src/cfe_psp_exception.c @@ -84,4 +84,6 @@ int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_PSP_SetDefaultExceptionEnvironment(void) {} +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 f6d4565e..503bc376 100644 --- a/fsw/pc-rtems/src/cfe_psp_memory.c +++ b/fsw/pc-rtems/src/cfe_psp_memory.c @@ -83,7 +83,7 @@ typedef struct /* ** Dynamic map of the reserved memory area */ -CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap = {0}; +CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap = { 0 }; CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock; @@ -132,10 +132,10 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 } else { - if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) && - ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) + if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) + && ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; CopyPtr += CDSOffset; memcpy((char *)CopyPtr, (char *)PtrToDataToWrite, NumBytes); @@ -168,10 +168,10 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt } else { - if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) && - ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) + if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) + && ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) { - CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; CopyPtr += CDSOffset; memcpy((char *)PtrToDataToRead, (char *)CopyPtr, NumBytes); @@ -322,7 +322,7 @@ void CFE_PSP_SetupReservedMemoryMap(void) UserReservedSize = (UserReservedSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; /* Calculate the required size, adding padding so that each element is aligned */ - RequiredSize = FixedSize; + RequiredSize = FixedSize; RequiredSize += ResetSize; RequiredSize += VolatileDiskSize; RequiredSize += CDSSize; @@ -341,31 +341,32 @@ void CFE_PSP_SetupReservedMemoryMap(void) PcRtems_ReservedMemBlock.BlockSize = RequiredSize; ReservedMemoryAddr = (cpuaddr)PcRtems_ReservedMemBlock.BlockPtr; - OS_printf("CFE_PSP: Allocated %u bytes for PSP reserved memory at: 0x%08lX\n", (unsigned int)RequiredSize, + OS_printf("CFE_PSP: Allocated %u bytes for PSP reserved memory at: 0x%08lX\n", + (unsigned int)RequiredSize, (unsigned long)ReservedMemoryAddr); FixedPtr = (CFE_PSP_RtemsReservedAreaFixedLayout_t *)ReservedMemoryAddr; - CFE_PSP_ReservedMemoryMap.BootPtr = &FixedPtr->BootRecord; - CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedPtr->ExceptionStorage; - ReservedMemoryAddr += FixedSize; + CFE_PSP_ReservedMemoryMap.BootPtr = &FixedPtr->BootRecord; + CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedPtr->ExceptionStorage; + ReservedMemoryAddr += FixedSize; - CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void *)ReservedMemoryAddr; - CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = CFE_PSP_RESET_AREA_SIZE; - ReservedMemoryAddr += ResetSize; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = CFE_PSP_RESET_AREA_SIZE; + ReservedMemoryAddr += ResetSize; CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr = (void *)ReservedMemoryAddr; CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize = (CFE_PSP_RAM_DISK_SECTOR_SIZE * CFE_PSP_RAM_DISK_NUM_SECTORS); ReservedMemoryAddr += VolatileDiskSize; - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = (void *)ReservedMemoryAddr; - CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = CFE_PSP_CDS_SIZE; - ReservedMemoryAddr += CDSSize; + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = CFE_PSP_CDS_SIZE; + ReservedMemoryAddr += CDSSize; - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = (void *)ReservedMemoryAddr; - CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = CFE_PSP_USER_RESERVED_SIZE; - ReservedMemoryAddr += UserReservedSize; + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = CFE_PSP_USER_RESERVED_SIZE; + ReservedMemoryAddr += UserReservedSize; /* * displaying the final address shows how much was actually used, diff --git a/fsw/pc-rtems/src/cfe_psp_start.c b/fsw/pc-rtems/src/cfe_psp_start.c index 2de8a78a..b5c001f8 100644 --- a/fsw/pc-rtems/src/cfe_psp_start.c +++ b/fsw/pc-rtems/src/cfe_psp_start.c @@ -33,7 +33,6 @@ #include #include - /* ** cFE includes */ @@ -59,7 +58,6 @@ rtems_id RtemsTimerId; - /* ** 1 HZ Timer "ISR" */ diff --git a/fsw/pc-rtems/src/cfe_psp_support.c b/fsw/pc-rtems/src/cfe_psp_support.c index 11e02199..30545b8a 100644 --- a/fsw/pc-rtems/src/cfe_psp_support.c +++ b/fsw/pc-rtems/src/cfe_psp_support.c @@ -73,7 +73,6 @@ extern CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock; *-----------------------------------------------------------------*/ void CFE_PSP_Restart(uint32 resetType) { - CFE_PSP_DeleteProcessorReservedMemory(); /* diff --git a/fsw/pc-rtems/src/cfe_psp_watchdog.c b/fsw/pc-rtems/src/cfe_psp_watchdog.c index f8e3f0fb..edb08ed3 100644 --- a/fsw/pc-rtems/src/cfe_psp_watchdog.c +++ b/fsw/pc-rtems/src/cfe_psp_watchdog.c @@ -82,7 +82,9 @@ void CFE_PSP_WatchdogInit(void) * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_PSP_WatchdogEnable(void) {} +void CFE_PSP_WatchdogEnable(void) +{ +} /*---------------------------------------------------------------- * @@ -90,7 +92,9 @@ void CFE_PSP_WatchdogEnable(void) {} * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_PSP_WatchdogDisable(void) {} +void CFE_PSP_WatchdogDisable(void) +{ +} /*---------------------------------------------------------------- * @@ -98,7 +102,9 @@ void CFE_PSP_WatchdogDisable(void) {} * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_PSP_WatchdogService(void) {} +void CFE_PSP_WatchdogService(void) +{ +} /*---------------------------------------------------------------- * diff --git a/fsw/shared/inc/cfe_psp_exceptionstorage_api.h b/fsw/shared/inc/cfe_psp_exceptionstorage_api.h index 0e67bc1a..ef3e6ecc 100644 --- a/fsw/shared/inc/cfe_psp_exceptionstorage_api.h +++ b/fsw/shared/inc/cfe_psp_exceptionstorage_api.h @@ -91,7 +91,8 @@ void CFE_PSP_Exception_Reset(void); * * \returns CFE_PSP_SUCCESS on success */ -int32 CFE_PSP_ExceptionGetSummary_Impl(const struct CFE_PSP_Exception_LogData *Buffer, char *ReasonBuf, - uint32 ReasonSize); +int32 CFE_PSP_ExceptionGetSummary_Impl(const struct CFE_PSP_Exception_LogData *Buffer, + char *ReasonBuf, + uint32 ReasonSize); #endif /* CFE_PSP_EXCEPTIONSTORAGE_API_H_ */ diff --git a/fsw/shared/inc/cfe_psp_memory.h b/fsw/shared/inc/cfe_psp_memory.h index bedd7493..58a6a749 100644 --- a/fsw/shared/inc/cfe_psp_memory.h +++ b/fsw/shared/inc/cfe_psp_memory.h @@ -55,7 +55,7 @@ typedef struct */ typedef struct { - void * BlockPtr; + void *BlockPtr; size_t BlockSize; } CFE_PSP_MemoryBlock_t; @@ -65,7 +65,7 @@ typedef struct typedef struct { CFE_PSP_ReservedMemoryBootRecord_t *BootPtr; - CFE_PSP_ExceptionStorage_t * ExceptionStoragePtr; + CFE_PSP_ExceptionStorage_t *ExceptionStoragePtr; CFE_PSP_MemoryBlock_t ResetMemory; CFE_PSP_MemoryBlock_t VolatileDiskMemory; diff --git a/fsw/shared/inc/cfe_psp_module.h b/fsw/shared/inc/cfe_psp_module.h index a594df75..a2902a70 100644 --- a/fsw/shared/inc/cfe_psp_module.h +++ b/fsw/shared/inc/cfe_psp_module.h @@ -85,7 +85,7 @@ typedef const struct uint32 OperationFlags; CFE_PSP_ModuleInitFunc_t Init; /* More API calls may be added for other module types */ - const void *ExtendedApi; + const void *ExtendedApi; } CFE_PSP_ModuleApi_t; /** diff --git a/fsw/shared/src/cfe_psp_debug.c b/fsw/shared/src/cfe_psp_debug.c index 913a5b11..0e899c86 100644 --- a/fsw/shared/src/cfe_psp_debug.c +++ b/fsw/shared/src/cfe_psp_debug.c @@ -40,7 +40,7 @@ #include "cfe_psp.h" #include "osapi.h" -#define PSP_DEBUG_MAX_LINE_LEN 132 +#define PSP_DEBUG_MAX_LINE_LEN 132 uint8 CFE_PSP_DebugLevel = CFE_PSP_DEBUG_LEVEL; @@ -74,7 +74,7 @@ void PSP_DebugPrintf(uint32 Level, const char *Func, uint32 Line, const char *Fo va_start(va, Format); actualsz = vsnprintf(buffer, sizeof(buffer), Format, va); va_end(va); - + if (actualsz < 0) { actualsz = 0; @@ -84,9 +84,8 @@ void PSP_DebugPrintf(uint32 Level, const char *Func, uint32 Line, const char *Fo actualsz = PSP_DEBUG_MAX_LINE_LEN - 1; } buffer[actualsz] = 0; - + /* output message strings */ OS_printf("%s%s", prefix, buffer); } } - diff --git a/fsw/shared/src/cfe_psp_exceptionstorage.c b/fsw/shared/src/cfe_psp_exceptionstorage.c index 17470da2..7c6d43fc 100644 --- a/fsw/shared/src/cfe_psp_exceptionstorage.c +++ b/fsw/shared/src/cfe_psp_exceptionstorage.c @@ -131,8 +131,8 @@ void CFE_PSP_Exception_WriteComplete(void) *-----------------------------------------------------------------*/ uint32 CFE_PSP_Exception_GetCount(void) { - return (CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumWritten - - CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumRead); + return (CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumWritten + - CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumRead); } /*---------------------------------------------------------------- @@ -248,7 +248,8 @@ int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint3 * where the CFE platform configuration has not allocated enough space for context logs. * Generate a warning message to raise awareness. */ OS_printf("CFE_PSP: Insufficient buffer for exception context, total=%lu bytes, saved=%lu\n", - (unsigned long)Buffer->context_size, (unsigned long)ContextSize); + (unsigned long)Buffer->context_size, + (unsigned long)ContextSize); ActualSize = ContextSize; } diff --git a/fsw/shared/src/cfe_psp_memrange.c b/fsw/shared/src/cfe_psp_memrange.c index 739e5fcc..ee632c68 100644 --- a/fsw/shared/src/cfe_psp_memrange.c +++ b/fsw/shared/src/cfe_psp_memrange.c @@ -138,8 +138,12 @@ uint32 CFE_PSP_MemRanges(void) * 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) +int32 CFE_PSP_MemRangeSet(uint32 RangeNum, + uint32 MemoryType, + cpuaddr StartAddr, + size_t Size, + size_t WordSize, + uint32 Attributes) { CFE_PSP_MemTable_t *SysMemPtr; @@ -153,14 +157,14 @@ int32 CFE_PSP_MemRangeSet(uint32 RangeNum, uint32 MemoryType, cpuaddr StartAddr, return CFE_PSP_INVALID_MEM_TYPE; } - if ((WordSize != CFE_PSP_MEM_SIZE_BYTE) && (WordSize != CFE_PSP_MEM_SIZE_WORD) && - (WordSize != CFE_PSP_MEM_SIZE_DWORD)) + if ((WordSize != CFE_PSP_MEM_SIZE_BYTE) && (WordSize != CFE_PSP_MEM_SIZE_WORD) + && (WordSize != CFE_PSP_MEM_SIZE_DWORD)) { return CFE_PSP_INVALID_MEM_WORDSIZE; } - if ((Attributes != CFE_PSP_MEM_ATTR_READ) && (Attributes != CFE_PSP_MEM_ATTR_WRITE) && - (Attributes != CFE_PSP_MEM_ATTR_READWRITE)) + if ((Attributes != CFE_PSP_MEM_ATTR_READ) && (Attributes != CFE_PSP_MEM_ATTR_WRITE) + && (Attributes != CFE_PSP_MEM_ATTR_READWRITE)) { return CFE_PSP_INVALID_MEM_ATTR; } @@ -185,8 +189,12 @@ int32 CFE_PSP_MemRangeSet(uint32 RangeNum, uint32 MemoryType, cpuaddr StartAddr, * 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) +int32 CFE_PSP_MemRangeGet(uint32 RangeNum, + uint32 *MemoryType, + cpuaddr *StartAddr, + size_t *Size, + size_t *WordSize, + uint32 *Attributes) { CFE_PSP_MemTable_t *SysMemPtr; diff --git a/fsw/shared/src/cfe_psp_module.c b/fsw/shared/src/cfe_psp_module.c index 09421d4e..7ce423f8 100644 --- a/fsw/shared/src/cfe_psp_module.c +++ b/fsw/shared/src/cfe_psp_module.c @@ -80,7 +80,7 @@ CFE_PSP_ModuleListGlobal_t CFE_PSP_MODULE_LIST_GLOBAL; void CFE_PSP_ModuleInitList(CFE_PSP_ModuleListWrapper_t *WrapPtr, uint32 BaseId, CFE_StaticModuleLoadEntry_t *ListPtr) { CFE_StaticModuleLoadEntry_t *Entry; - CFE_PSP_ModuleApi_t * ApiPtr; + CFE_PSP_ModuleApi_t *ApiPtr; uint32 ModuleCount; uint32 ModuleId; diff --git a/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c b/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c index 5798d488..6a201a7e 100644 --- a/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c +++ b/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c @@ -41,7 +41,7 @@ static CFE_PSP_ReservedMemoryBootRecord_t UT_BOOTREC; -static const CFE_PSP_ReservedMemoryBootRecord_t UT_DEFAULT_BOOTREC = {0}; +static const CFE_PSP_ReservedMemoryBootRecord_t UT_DEFAULT_BOOTREC = { 0 }; void UT_BootRecAdaptor_InitDefault(void) { diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c index a9829c00..25b23dcc 100644 --- a/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c @@ -53,7 +53,9 @@ void Psp_Test_Setup(void) * Purpose: * Called by the unit test tool to tear down the app after each test */ -void Psp_Test_Teardown(void) {} +void Psp_Test_Teardown(void) +{ +} /* UtTest_Setup * diff --git a/unit-test-coverage/modules/eeprom_direct/coveragetest-eeprom_direct.c b/unit-test-coverage/modules/eeprom_direct/coveragetest-eeprom_direct.c index 6b7b3c33..04d5d306 100644 --- a/unit-test-coverage/modules/eeprom_direct/coveragetest-eeprom_direct.c +++ b/unit-test-coverage/modules/eeprom_direct/coveragetest-eeprom_direct.c @@ -90,7 +90,7 @@ void Test_CFE_PSP_EepromWrite32_AddressMisaligned(void) /* Arrange */ cpuaddr UtAddress; - UtAddress = (cpuaddr)&UT_RAM_BLOCK.u32[1]; + UtAddress = (cpuaddr)&UT_RAM_BLOCK.u32[1]; UtAddress += 1; /* Act */ @@ -105,7 +105,7 @@ void Test_CFE_PSP_EepromWrite16_AddressMisaligned(void) /* Arrange */ cpuaddr UtAddress; - UtAddress = (cpuaddr)&UT_RAM_BLOCK.u16[4]; + UtAddress = (cpuaddr)&UT_RAM_BLOCK.u16[4]; UtAddress += 1; /* Act */ @@ -131,7 +131,7 @@ void Test_CFE_PSP_EepromWrite16_WriteHighBitOrder(void) /* Arrange */ cpuaddr UtAddress; - UtAddress = (cpuaddr)&UT_RAM_BLOCK.u16[8]; + UtAddress = (cpuaddr)&UT_RAM_BLOCK.u16[8]; UtAddress += 2; /* Act */ @@ -163,7 +163,7 @@ void Test_CFE_PSP_EepromWrite8_WriteHighBitOrder(void) /* Arrange */ cpuaddr UtAddress; - UtAddress = (cpuaddr)&UT_RAM_BLOCK.u8[24]; + UtAddress = (cpuaddr)&UT_RAM_BLOCK.u8[24]; UtAddress += 3; /* Act */ diff --git a/unit-test-coverage/modules/endian_api/coveragetest-endian_api.c b/unit-test-coverage/modules/endian_api/coveragetest-endian_api.c index 9045a387..bbfc948b 100644 --- a/unit-test-coverage/modules/endian_api/coveragetest-endian_api.c +++ b/unit-test-coverage/modules/endian_api/coveragetest-endian_api.c @@ -275,7 +275,7 @@ void Test_CFE_PSP_HtoBE16(void) { uint16 host_16bits; uint16 result; - const uint16 test_values[] = {0x1234, 0x5678, 0x9ABC, 0xDEF0}; + const uint16 test_values[] = { 0x1234, 0x5678, 0x9ABC, 0xDEF0 }; uint16 i; UT_SetHandlerFunction(UT_KEY(PCS_htobe16), UT_Handler_PCS_htobe16, NULL); @@ -298,7 +298,7 @@ void Test_CFE_PSP_HtoBE16(void) void Test_CFE_PSP_HtoLE16(void) { uint16 host_16bits; - const uint16 test_values[] = {0x1234, 0x5678, 0x9ABC, 0xDEF0}; + const uint16 test_values[] = { 0x1234, 0x5678, 0x9ABC, 0xDEF0 }; uint16 result; uint16 i; @@ -322,7 +322,7 @@ void Test_CFE_PSP_HtoLE16(void) void Test_CFE_PSP_BE16toH(void) { uint16 big_endian_16bits; - const uint16 test_values[] = {0x1234, 0x5678, 0x9ABC, 0xDEF0}; + const uint16 test_values[] = { 0x1234, 0x5678, 0x9ABC, 0xDEF0 }; uint16 result; uint16 i; @@ -346,7 +346,7 @@ void Test_CFE_PSP_BE16toH(void) void Test_CFE_PSP_LE16toH(void) { uint16 little_endian_16bits; - const uint16 test_values[] = {0x1234, 0x5678, 0x9ABC, 0xDEF0}; + const uint16 test_values[] = { 0x1234, 0x5678, 0x9ABC, 0xDEF0 }; uint16 result; uint16 i; @@ -370,7 +370,7 @@ void Test_CFE_PSP_LE16toH(void) void Test_CFE_PSP_HtoBE32(void) { uint32 host_32bits; - const uint32 test_values[] = {0x12345678, 0x9ABCDEF0, 0x3456789A, 0xBCDEF012}; + const uint32 test_values[] = { 0x12345678, 0x9ABCDEF0, 0x3456789A, 0xBCDEF012 }; uint32 result; uint16 i; @@ -394,7 +394,7 @@ void Test_CFE_PSP_HtoBE32(void) void Test_CFE_PSP_HtoLE32(void) { uint32 host_32bits; - const uint32 test_values[] = {0x12345678, 0x9ABCDEF0, 0x3456789A, 0xBCDEF012}; + const uint32 test_values[] = { 0x12345678, 0x9ABCDEF0, 0x3456789A, 0xBCDEF012 }; uint32 result; uint16 i; @@ -418,7 +418,7 @@ void Test_CFE_PSP_HtoLE32(void) void Test_CFE_PSP_BE32toH(void) { uint32 big_endian_32bits; - const uint32 test_values[] = {0x12345678, 0x9ABCDEF0, 0x3456789A, 0xBCDEF012}; + const uint32 test_values[] = { 0x12345678, 0x9ABCDEF0, 0x3456789A, 0xBCDEF012 }; uint32 result; uint16 i; @@ -442,7 +442,7 @@ void Test_CFE_PSP_BE32toH(void) void Test_CFE_PSP_LE32toH(void) { uint32 little_endian_32bits; - const uint32 test_values[] = {0x12345678, 0x9ABCDEF0, 0x3456789A, 0xBCDEF012}; + const uint32 test_values[] = { 0x12345678, 0x9ABCDEF0, 0x3456789A, 0xBCDEF012 }; uint32 result; uint16 i; @@ -466,7 +466,7 @@ void Test_CFE_PSP_LE32toH(void) void Test_CFE_PSP_HtoBE64(void) { uint64 host_64bits; - const uint64 test_values[] = {0x123456789ABCDEF0, 0x56789ABCDEF01234, 0x9ABCDEF012345678, 0xDEF0123456789ABC}; + const uint64 test_values[] = { 0x123456789ABCDEF0, 0x56789ABCDEF01234, 0x9ABCDEF012345678, 0xDEF0123456789ABC }; uint64 result; uint16 i; @@ -490,7 +490,7 @@ void Test_CFE_PSP_HtoBE64(void) void Test_CFE_PSP_HtoLE64(void) { uint64 host_64bits; - const uint64 test_values[] = {0x123456789ABCDEF0, 0x56789ABCDEF01234, 0x9ABCDEF012345678, 0xDEF0123456789ABC}; + const uint64 test_values[] = { 0x123456789ABCDEF0, 0x56789ABCDEF01234, 0x9ABCDEF012345678, 0xDEF0123456789ABC }; uint64 result; uint16 i; @@ -514,7 +514,7 @@ void Test_CFE_PSP_HtoLE64(void) void Test_CFE_PSP_BE64toH(void) { uint64 big_endian_64bits; - const uint64 test_values[] = {0x123456789ABCDEF0, 0x56789ABCDEF01234, 0x9ABCDEF012345678, 0xDEF0123456789ABC}; + const uint64 test_values[] = { 0x123456789ABCDEF0, 0x56789ABCDEF01234, 0x9ABCDEF012345678, 0xDEF0123456789ABC }; uint64 result; uint16 i; @@ -538,7 +538,7 @@ void Test_CFE_PSP_BE64toH(void) void Test_CFE_PSP_LE64toH(void) { uint64 little_endian_64bits; - const uint64 test_values[] = {0x123456789ABCDEF0, 0x56789ABCDEF01234, 0x9ABCDEF012345678, 0xDEF0123456789ABC}; + const uint64 test_values[] = { 0x123456789ABCDEF0, 0x56789ABCDEF01234, 0x9ABCDEF012345678, 0xDEF0123456789ABC }; uint64 result; uint16 i; diff --git a/unit-test-coverage/modules/iodriver/coveragetest-iodriver.c b/unit-test-coverage/modules/iodriver/coveragetest-iodriver.c index 171c1435..c84d62a9 100644 --- a/unit-test-coverage/modules/iodriver/coveragetest-iodriver.c +++ b/unit-test-coverage/modules/iodriver/coveragetest-iodriver.c @@ -46,7 +46,7 @@ #include "iodriver_base.h" #include "iodriver_impl.h" -CFE_PSP_IODriver_API_t Ut_NoopAPI = {NULL, NULL}; +CFE_PSP_IODriver_API_t Ut_NoopAPI = { NULL, NULL }; extern void iodriver_Init(uint32 PspModuleId); extern CFE_PSP_IODriver_API_t *CFE_PSP_IODriver_GetAPI(uint32 PspModuleId); @@ -71,7 +71,7 @@ static void StubNoMut_Init(uint32 ModuleID) UT_DEFAULT_IMPL(StubNoMut_Init); } -static CFE_PSP_IODriver_API_t StubNoMut_DevApi = {.DeviceCommand = Stub_DeviceCommand}; +static CFE_PSP_IODriver_API_t StubNoMut_DevApi = { .DeviceCommand = Stub_DeviceCommand }; CFE_PSP_MODULE_DECLARE_IODEVICEDRIVER(StubNoMut); @@ -85,8 +85,8 @@ static void StubWithMut_Init(uint32 ModuleID) UT_DEFAULT_IMPL(StubWithMut_Init); } -static CFE_PSP_IODriver_API_t StubWithMut_DevApi = {.DeviceCommand = Stub_DeviceCommand, - .DeviceMutex = Stub_DeviceMutex}; +static CFE_PSP_IODriver_API_t StubWithMut_DevApi = { .DeviceCommand = Stub_DeviceCommand, + .DeviceMutex = Stub_DeviceMutex }; CFE_PSP_MODULE_DECLARE_IODEVICEDRIVER(StubWithMut); @@ -169,7 +169,8 @@ void Test_CFE_PSP_IODriver_GetAPI(void) UtAssert_BOOL_TRUE(ApiPtr->DeviceMutex == NULL); UT_ResetState(UT_KEY(CFE_PSP_Module_GetAPIEntry)); - UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_GetAPIEntry), UtHandler_CFE_PSP_Module_GetAPIEntry, + UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_GetAPIEntry), + UtHandler_CFE_PSP_Module_GetAPIEntry, (void *)&CFE_PSP_StubNoMut_API); UtAssert_NOT_NULL(ApiPtr = CFE_PSP_IODriver_GetAPI(0)); UtAssert_BOOL_TRUE(ApiPtr->DeviceCommand == Stub_DeviceCommand); @@ -209,20 +210,23 @@ void Test_CFE_PSP_IODriver_Command(void) * int32 CFE_PSP_IODriver_Command(const CFE_PSP_IODriver_Location_t *Location, uint32 CommandCode, * CFE_PSP_IODriver_Arg_t Arg) */ - const CFE_PSP_IODriver_Location_t UtLocation = {1, 1, 1}; + const CFE_PSP_IODriver_Location_t UtLocation = { 1, 1, 1 }; - UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_GetAPIEntry), UtHandler_CFE_PSP_Module_GetAPIEntry, + UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_GetAPIEntry), + UtHandler_CFE_PSP_Module_GetAPIEntry, (void *)&Ut_NoopAPI); UtAssert_INT32_EQ(CFE_PSP_IODriver_Command(&UtLocation, 1, CFE_PSP_IODriver_U32ARG(0)), CFE_PSP_ERROR_NOT_IMPLEMENTED); - UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_GetAPIEntry), UtHandler_CFE_PSP_Module_GetAPIEntry, + UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_GetAPIEntry), + UtHandler_CFE_PSP_Module_GetAPIEntry, (void *)&CFE_PSP_StubNoMut_API); UtAssert_INT32_EQ(CFE_PSP_IODriver_Command(&UtLocation, 1, CFE_PSP_IODriver_U32ARG(0)), CFE_PSP_SUCCESS); UtAssert_STUB_COUNT(Stub_DeviceCommand, 1); UtAssert_STUB_COUNT(Stub_DeviceMutex, 0); - UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_GetAPIEntry), UtHandler_CFE_PSP_Module_GetAPIEntry, + UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_GetAPIEntry), + UtHandler_CFE_PSP_Module_GetAPIEntry, (void *)&CFE_PSP_StubWithMut_API); UtAssert_INT32_EQ(CFE_PSP_IODriver_Command(&UtLocation, 1, CFE_PSP_IODriver_U32ARG(0)), CFE_PSP_SUCCESS); UtAssert_STUB_COUNT(Stub_DeviceCommand, 2); @@ -242,11 +246,13 @@ void Test_CFE_PSP_IODriver_FindByName(void) UT_ResetState(UT_KEY(CFE_PSP_Module_FindByName)); UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_FindByName), UtHandler_CFE_PSP_Module_FindByName, &CheckID); - UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_GetAPIEntry), UtHandler_CFE_PSP_Module_GetAPIEntry, + UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_GetAPIEntry), + UtHandler_CFE_PSP_Module_GetAPIEntry, (void *)&Ut_NoopAPI); UtAssert_INT32_EQ(CFE_PSP_IODriver_FindByName("UT", &ModuleID), CFE_PSP_INVALID_MODULE_NAME); - UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_GetAPIEntry), UtHandler_CFE_PSP_Module_GetAPIEntry, + UT_SetHandlerFunction(UT_KEY(CFE_PSP_Module_GetAPIEntry), + UtHandler_CFE_PSP_Module_GetAPIEntry, (void *)&CFE_PSP_StubWithMut_API); UtAssert_INT32_EQ(CFE_PSP_IODriver_FindByName("UT", &ModuleID), CFE_PSP_SUCCESS); UtAssert_INT32_EQ(ModuleID, CheckID); diff --git a/unit-test-coverage/modules/linux_sysmon/coveragetest-linux_sysmon.c b/unit-test-coverage/modules/linux_sysmon/coveragetest-linux_sysmon.c index 25c6fc6c..852884df 100644 --- a/unit-test-coverage/modules/linux_sysmon/coveragetest-linux_sysmon.c +++ b/unit-test-coverage/modules/linux_sysmon/coveragetest-linux_sysmon.c @@ -68,8 +68,8 @@ void ModuleTest_ResetState(void) int32 UTHOOK_vxTimeBaseGet(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { PSP_VxWorks_TimeBaseVal_t *val = UserObj; - uint32 * u = UT_Hook_GetArgValueByName(Context, "u", uint32 *); - uint32 * l = UT_Hook_GetArgValueByName(Context, "l", uint32 *); + uint32 *u = UT_Hook_GetArgValueByName(Context, "u", uint32 *); + uint32 *l = UT_Hook_GetArgValueByName(Context, "l", uint32 *); *u = val->u; *l = val->l; @@ -160,7 +160,8 @@ void Test_Reducible_1(void) CFE_PSP_GetTime(&OsTime); TestTime = OS_TimeGetTotalMicroseconds(OsTime); - UtAssert_True(TestTime == 10376293541461622, "CFE_PSP_GetTime() Microseconds (%lld) == 10376293541461622", + UtAssert_True(TestTime == 10376293541461622, + "CFE_PSP_GetTime() Microseconds (%lld) == 10376293541461622", (long long)TestTime); } @@ -191,7 +192,8 @@ void Test_Reducible_2(void) CFE_PSP_GetTime(&OsTime); TestTime = OS_TimeGetTotalMicroseconds(OsTime); - UtAssert_True(TestTime == 276701161105643274, "CFE_PSP_GetTime() Microseconds(%lld) == 276701161105643274", + UtAssert_True(TestTime == 276701161105643274, + "CFE_PSP_GetTime() Microseconds(%lld) == 276701161105643274", (long long)TestTime); } @@ -332,28 +334,28 @@ typedef struct linux_sysmon_state * Local Function Prototypes ********************************************************************/ -static void * linux_sysmon_Task(void *arg); +static void *linux_sysmon_Task(void *arg); static int32_t linux_sysmon_Start(linux_sysmon_cpuload_state_t *state); static int32_t linux_sysmon_Stop(linux_sysmon_cpuload_state_t *state); static void linux_sysmon_Init(uint32_t local_module_id); /* Function that starts up linux_sysmon driver. */ -static int32_t linux_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, - CFE_PSP_IODriver_Arg_t Arg); +static int32_t +linux_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, CFE_PSP_IODriver_Arg_t Arg); /******************************************************************** * Global Data ********************************************************************/ /* linux_sysmon device command that is called by iodriver to start up linux_sysmon */ -CFE_PSP_IODriver_API_t linux_sysmon_DevApi = {.DeviceCommand = linux_sysmon_DevCmd}; +CFE_PSP_IODriver_API_t linux_sysmon_DevApi = { .DeviceCommand = linux_sysmon_DevCmd }; CFE_PSP_MODULE_DECLARE_IODEVICEDRIVER(linux_sysmon); static linux_sysmon_state_t linux_sysmon_global; -static const char *linux_sysmon_subsystem_names[] = {"aggregate", "per-cpu", NULL}; -static const char *linux_sysmon_subchannel_names[] = {"cpu-load", NULL}; +static const char *linux_sysmon_subsystem_names[] = { "aggregate", "per-cpu", NULL }; +static const char *linux_sysmon_subchannel_names[] = { "cpu-load", NULL }; /*********************************************************************** * Global Functions @@ -369,7 +371,7 @@ void linux_sysmon_Init(uint32_t local_module_id) void linux_sysmon_read_cpuuse_line(const char *line_data, unsigned int *cpu_num, unsigned long *run_time) { unsigned long value; - const char * val_end; + const char *val_end; int val_count; /* each "cpu" line contains the cpu number followed by 9 values */ @@ -413,7 +415,7 @@ void linux_sysmon_update_schedstat(linux_sysmon_cpuload_state_t *state, int elap char line_data[256]; size_t line_size; ssize_t line_rdsz; - char * eol_p; + char *eol_p; linux_sysmon_cpuload_core_t *core_p; @@ -433,7 +435,7 @@ void linux_sysmon_update_schedstat(linux_sysmon_cpuload_state_t *state, int elap } /* check for newline char */ - eol_p = memchr(&line_data[line_size], '\n', line_rdsz); + eol_p = memchr(&line_data[line_size], '\n', line_rdsz); line_size += line_rdsz; while (eol_p != NULL) @@ -475,10 +477,12 @@ void linux_sysmon_update_schedstat(linux_sysmon_cpuload_state_t *state, int elap } else { - core_p->avg_load = (0x1000 * cpu_time_ms) / elapsed_ms; + core_p->avg_load = (0x1000 * cpu_time_ms) / elapsed_ms; core_p->avg_load |= (core_p->avg_load << 12); /* Expand from 12->24 bit */ } - LINUX_SYSMON_DEBUG("CFE_PSP(linux_sysmon): CPU%u time_ms=%u ms, load=%06x\n", cpu_num, cpu_time_ms, + LINUX_SYSMON_DEBUG("CFE_PSP(linux_sysmon): CPU%u time_ms=%u ms, load=%06x\n", + cpu_num, + cpu_time_ms, (unsigned int)core_p->avg_load); } } @@ -819,8 +823,8 @@ int32_t linux_sysmon_cpu_load_dispatch(uint32_t CommandCode, uint16_t Subchannel * \returns Status code * \retval #CFE_PSP_SUCCESS if successful */ -int32_t linux_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, - CFE_PSP_IODriver_Arg_t Arg) +int32_t +linux_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, CFE_PSP_IODriver_Arg_t Arg) { int32_t StatusCode; diff --git a/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon.h b/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon.h index 7f1d28da..bb67e719 100644 --- a/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon.h +++ b/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon.h @@ -55,5 +55,4 @@ */ #define ADD_TEST(test) UtTest_Add(test, ModuleTest_ResetState, NULL, #test) - #endif diff --git a/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon_utils.h b/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon_utils.h index 56f15a2d..cc54e36b 100644 --- a/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon_utils.h +++ b/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon_utils.h @@ -41,12 +41,12 @@ #include "coveragetest-rtems_sysmon.h" #include "PCS_tasks.h" -extern CFE_PSP_ModuleApi_t CFE_PSP_rtems_sysmon_API; -extern rtems_sysmon_state_t rtems_sysmon_global; +extern CFE_PSP_ModuleApi_t CFE_PSP_rtems_sysmon_API; +extern rtems_sysmon_state_t rtems_sysmon_global; typedef struct { - char Name[38]; + char Name[38]; size_t Size; } UT_ThreadGetNameData_t; diff --git a/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon.c b/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon.c index d2f51da2..8c63e869 100644 --- a/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon.c +++ b/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon.c @@ -45,9 +45,8 @@ /* * Reference to the API entry point for the module */ -const CFE_PSP_ModuleApi_t * TgtAPI = &CFE_PSP_rtems_sysmon_API; -PCS_Timestamp_Control PCS_CPU_usage_Uptime_at_last_reset; - +const CFE_PSP_ModuleApi_t *TgtAPI = &CFE_PSP_rtems_sysmon_API; +PCS_Timestamp_Control PCS_CPU_usage_Uptime_at_last_reset; void Test_Init_Nominal(void) { @@ -64,9 +63,10 @@ void Test_Task_Nominal(void) /* Nominal Case: rtems sysmon task */ rtems_sysmon_global.cpu_load.should_run = true; UT_SetHookFunction(UT_KEY(OS_TaskDelay), (UT_HookFunc_t)UT_TaskDelay_Hook, &DelayCounter); - rtems_sysmon_Task((rtems_task_argument) &rtems_sysmon_global.cpu_load); + rtems_sysmon_Task((rtems_task_argument)&rtems_sysmon_global.cpu_load); - UtAssert_True(rtems_sysmon_global.cpu_load.should_run == false && DelayCounter == 1, "Nominal Case: RTEMS Sysmon Task"); + UtAssert_True(rtems_sysmon_global.cpu_load.should_run == false && DelayCounter == 1, + "Nominal Case: RTEMS Sysmon Task"); } void Test_Entry_Nominal(void) @@ -93,10 +93,10 @@ void Test_Aggregate_Nominal(void) int32 IsRunningStatus; CFE_PSP_IODriver_AdcCode_t Sample; - CFE_PSP_IODriver_AnalogRdWr_t RdWr = {.NumChannels = 1, .Samples = &Sample}; - + CFE_PSP_IODriver_AnalogRdWr_t RdWr = { .NumChannels = 1, .Samples = &Sample }; + CFE_PSP_IODriver_Direction_t QueryDirArg; - CFE_PSP_IODriver_API_t * EntryAPI = TgtAPI->ExtendedApi; + CFE_PSP_IODriver_API_t *EntryAPI = TgtAPI->ExtendedApi; /* Nominal Case: Aggregate Dispatch Noop CMD (Not Impl) */ StatusCode = EntryAPI->DeviceCommand(CFE_PSP_IODriver_NOOP, 0, 0, CFE_PSP_IODriver_U32ARG(0)); /* Entry Point */ @@ -169,11 +169,11 @@ void Test_Aggregate_Nominal(void) void Test_Aggregate_Error(void) { - CFE_PSP_IODriver_API_t * EntryAPI = TgtAPI->ExtendedApi; + CFE_PSP_IODriver_API_t *EntryAPI = TgtAPI->ExtendedApi; int32 StatusCode; int32 IsRunningStatus; CFE_PSP_IODriver_AdcCode_t Sample; - CFE_PSP_IODriver_AnalogRdWr_t RdWr = {.NumChannels = 1, .Samples = &Sample}; + CFE_PSP_IODriver_AnalogRdWr_t RdWr = { .NumChannels = 1, .Samples = &Sample }; /* Error Case: Look Up Subsystem Not Found */ StatusCode = EntryAPI->DeviceCommand(CFE_PSP_IODriver_LOOKUP_SUBSYSTEM, 0, 0, CFE_PSP_IODriver_CONST_STR("Empty")); @@ -221,9 +221,9 @@ void Test_Aggregate_Error(void) void Test_Dispatch_Cpuload_Nominal(void) { - CFE_PSP_IODriver_API_t * EntryAPI = TgtAPI->ExtendedApi; + CFE_PSP_IODriver_API_t *EntryAPI = TgtAPI->ExtendedApi; CFE_PSP_IODriver_AdcCode_t Sample[2]; - CFE_PSP_IODriver_AnalogRdWr_t RdWr = {.NumChannels = 1, .Samples = Sample}; + CFE_PSP_IODriver_AnalogRdWr_t RdWr = { .NumChannels = 1, .Samples = Sample }; int32 StatusCode; /* Nominal Case: Dispatch IO Driver NOOP */ @@ -243,9 +243,9 @@ void Test_Dispatch_Cpuload_Nominal(void) void Test_Dispatch_Cpuload_Error(void) { - CFE_PSP_IODriver_API_t * EntryAPI = TgtAPI->ExtendedApi; + CFE_PSP_IODriver_API_t *EntryAPI = TgtAPI->ExtendedApi; CFE_PSP_IODriver_AdcCode_t Sample[2]; - CFE_PSP_IODriver_AnalogRdWr_t RdWr = {.NumChannels = 1, .Samples = Sample}; + CFE_PSP_IODriver_AnalogRdWr_t RdWr = { .NumChannels = 1, .Samples = Sample }; int StatusCode; /* Error Case: Dispatch Analog Read Channels, Subchannel >= Max Cpu */ @@ -269,11 +269,11 @@ void Test_Dispatch_Cpuload_Error(void) void Test_Cpu_Visitor_Nominal(void) { - PCS_Thread_Control Thread; - UT_ThreadGetNameData_t UT_ThreadGetNameData; + PCS_Thread_Control Thread; + UT_ThreadGetNameData_t UT_ThreadGetNameData; rtems_sysmon_cpuload_state_t Arg; - UT_TimeDivideData_t UT_TimeDivideData; - int32 AverageLoadCalc; + UT_TimeDivideData_t UT_TimeDivideData; + int32 AverageLoadCalc; UT_SetHookFunction(UT_KEY(PCS_Thread_Get_name), (UT_HookFunc_t)UT_ThreadGetName_Hook, &UT_ThreadGetNameData); UT_SetHookFunction(UT_KEY(PCS_Timestamp_Divide), (UT_HookFunc_t)UT_TimestampDivide_Hook, &UT_TimeDivideData); @@ -312,14 +312,14 @@ void Test_Cpu_Visitor_Nominal(void) strncpy(UT_ThreadGetNameData.Name, "IDLE", 4); UT_ThreadGetNameData.Size = 4; - UT_TimeDivideData.IntValue = 50; - UT_TimeDivideData.FraValue = 0; - UT_TimeDivideData.TotalElapsed = 10; + UT_TimeDivideData.IntValue = 50; + UT_TimeDivideData.FraValue = 0; + UT_TimeDivideData.TotalElapsed = 10; UT_TimeDivideData.IdleUptimeElapsed = 5; - UtAssert_BOOL_FALSE(rtems_cpu_usage_visitor(&Thread, &Arg)); + UtAssert_BOOL_FALSE(rtems_cpu_usage_visitor(&Thread, &Arg)); - AverageLoadCalc = 0x1000 * UT_TimeDivideData.IntValue / 100; + AverageLoadCalc = 0x1000 * UT_TimeDivideData.IntValue / 100; AverageLoadCalc |= (AverageLoadCalc << 12); UtAssert_True(Arg.per_core[0].avg_load == AverageLoadCalc, "Nominal Case: 50 percents cpu utilization"); @@ -332,18 +332,19 @@ void Test_Cpu_Visitor_Nominal(void) strncpy(UT_ThreadGetNameData.Name, "IDLE", 4); UT_ThreadGetNameData.Size = 4; - UT_TimeDivideData.IntValue = 50; - UT_TimeDivideData.FraValue = 9990; - UT_TimeDivideData.TotalElapsed = 10; /* placeholder */ - UT_TimeDivideData.IdleUptimeElapsed = 5; /* placeholder*/ + UT_TimeDivideData.IntValue = 50; + UT_TimeDivideData.FraValue = 9990; + UT_TimeDivideData.TotalElapsed = 10; /* placeholder */ + UT_TimeDivideData.IdleUptimeElapsed = 5; /* placeholder*/ - UtAssert_BOOL_FALSE(rtems_cpu_usage_visitor(&Thread, &Arg)); + UtAssert_BOOL_FALSE(rtems_cpu_usage_visitor(&Thread, &Arg)); - /* convert int and fra part of percentages into integer. - ** Then convert into an percentages and normalizes out of 0x1000 + /* convert int and fra part of percentages into integer. + ** Then convert into an percentages and normalizes out of 0x1000 */ - AverageLoadCalc = (UT_TimeDivideData.IntValue * 1000) + (UT_TimeDivideData.FraValue / 10); /* Combine fraction and int to one number */ - AverageLoadCalc = (0x1000 * (100000 - AverageLoadCalc)) / 100000; + AverageLoadCalc = (UT_TimeDivideData.IntValue * 1000) + + (UT_TimeDivideData.FraValue / 10); /* Combine fraction and int to one number */ + AverageLoadCalc = (0x1000 * (100000 - AverageLoadCalc)) / 100000; AverageLoadCalc |= (AverageLoadCalc << 12); UtAssert_True(Arg.per_core[0].avg_load == AverageLoadCalc, "Nominal Case: 49.001 percents cpu utilization"); @@ -356,12 +357,12 @@ void Test_Cpu_Visitor_Nominal(void) strncpy(UT_ThreadGetNameData.Name, "IDLE", 4); UT_ThreadGetNameData.Size = 4; - UT_TimeDivideData.IntValue = 0; - UT_TimeDivideData.FraValue = 0; - UT_TimeDivideData.TotalElapsed = 0; + UT_TimeDivideData.IntValue = 0; + UT_TimeDivideData.FraValue = 0; + UT_TimeDivideData.TotalElapsed = 0; UT_TimeDivideData.IdleUptimeElapsed = 0; - UtAssert_BOOL_FALSE(rtems_cpu_usage_visitor(&Thread, &Arg)); + UtAssert_BOOL_FALSE(rtems_cpu_usage_visitor(&Thread, &Arg)); UtAssert_True(Arg.per_core[0].avg_load == 0, "Nominal Case: 0 percents cpu utilization"); /* Nominal Case: polling cpu reaches RTEMS_SYSMON_MAX_CPUS */ @@ -371,9 +372,8 @@ void Test_Cpu_Visitor_Nominal(void) strncpy(UT_ThreadGetNameData.Name, "IDLE", 4); Arg.poll_core_no = RTEMS_SYSMON_MAX_CPUS; - UtAssert_BOOL_TRUE(rtems_cpu_usage_visitor(&Thread, &Arg)); + UtAssert_BOOL_TRUE(rtems_cpu_usage_visitor(&Thread, &Arg)); UtAssert_True(Arg.poll_core_no == 0, "Nominal Case: cpu number reseted"); - } /* @@ -389,5 +389,4 @@ void UtTest_Setup(void) ADD_TEST(Test_Dispatch_Cpuload_Error); ADD_TEST(Test_Cpu_Visitor_Nominal); ADD_TEST(Test_Task_Nominal); - } diff --git a/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon_utils.c b/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon_utils.c index 8d37d596..b5c78153 100644 --- a/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon_utils.c +++ b/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon_utils.c @@ -55,8 +55,8 @@ void UT_ThreadGetName_Hook(void *UserObj, int32 StubRetcode, uint32 CallCount, c { int i; - char * Name = UT_Hook_GetArgValueByName(Context, "buffer", char *); - UT_ThreadGetNameData_t * Data = (UT_ThreadGetNameData_t *) UserObj; + char *Name = UT_Hook_GetArgValueByName(Context, "buffer", char *); + UT_ThreadGetNameData_t *Data = (UT_ThreadGetNameData_t *)UserObj; for (i = 0; i < Data->Size; i++) { @@ -66,16 +66,15 @@ void UT_ThreadGetName_Hook(void *UserObj, int32 StubRetcode, uint32 CallCount, c void UT_TimestampDivide_Hook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { + UT_TimeDivideData_t *TimeDivideData = (UT_TimeDivideData_t *)UserObj; - UT_TimeDivideData_t * TimeDivideData = (UT_TimeDivideData_t *) UserObj; + uint32_t *IntValue = UT_Hook_GetArgValueByName(Context, "_ival_percentage", uint32_t *); + uint32_t *FraValue = UT_Hook_GetArgValueByName(Context, "_fval_percentage", uint32_t *); + int64_t *IdleUptimeElapsed = UT_Hook_GetArgValueByName(Context, "_lhs", int64_t *); + int64_t *TotalElapsed = UT_Hook_GetArgValueByName(Context, "_rhs", int64_t *); - uint32_t * IntValue = UT_Hook_GetArgValueByName(Context, "_ival_percentage", uint32_t *); - uint32_t * FraValue = UT_Hook_GetArgValueByName(Context, "_fval_percentage", uint32_t *); - int64_t * IdleUptimeElapsed = UT_Hook_GetArgValueByName(Context, "_lhs", int64_t *); - int64_t * TotalElapsed = UT_Hook_GetArgValueByName(Context, "_rhs", int64_t *); - - *IntValue = TimeDivideData->IntValue; - *FraValue = TimeDivideData->FraValue; + *IntValue = TimeDivideData->IntValue; + *FraValue = TimeDivideData->FraValue; *IdleUptimeElapsed = TimeDivideData->IdleUptimeElapsed; - *TotalElapsed = TimeDivideData->TotalElapsed; + *TotalElapsed = TimeDivideData->TotalElapsed; } \ No newline at end of file diff --git a/unit-test-coverage/modules/timebase_posix_clock/coveragetest-timebase_posix_clock.c b/unit-test-coverage/modules/timebase_posix_clock/coveragetest-timebase_posix_clock.c index 6f2396f1..0c3cedac 100644 --- a/unit-test-coverage/modules/timebase_posix_clock/coveragetest-timebase_posix_clock.c +++ b/unit-test-coverage/modules/timebase_posix_clock/coveragetest-timebase_posix_clock.c @@ -68,8 +68,8 @@ void ModuleTest_ResetState(void) int32 UTHOOK_vxTimeBaseGet(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { PSP_VxWorks_TimeBaseVal_t *val = UserObj; - uint32 * u = UT_Hook_GetArgValueByName(Context, "u", uint32 *); - uint32 * l = UT_Hook_GetArgValueByName(Context, "l", uint32 *); + uint32 *u = UT_Hook_GetArgValueByName(Context, "u", uint32 *); + uint32 *l = UT_Hook_GetArgValueByName(Context, "l", uint32 *); *u = val->u; *l = val->l; @@ -160,7 +160,8 @@ void Test_Reducible_1(void) CFE_PSP_GetTime(&OsTime); TestTime = OS_TimeGetTotalMicroseconds(OsTime); - UtAssert_True(TestTime == 10376293541461622, "CFE_PSP_GetTime() Microseconds (%lld) == 10376293541461622", + UtAssert_True(TestTime == 10376293541461622, + "CFE_PSP_GetTime() Microseconds (%lld) == 10376293541461622", (long long)TestTime); } @@ -191,7 +192,8 @@ void Test_Reducible_2(void) CFE_PSP_GetTime(&OsTime); TestTime = OS_TimeGetTotalMicroseconds(OsTime); - UtAssert_True(TestTime == 276701161105643274, "CFE_PSP_GetTime() Microseconds(%lld) == 276701161105643274", + UtAssert_True(TestTime == 276701161105643274, + "CFE_PSP_GetTime() Microseconds(%lld) == 276701161105643274", (long long)TestTime); } diff --git a/unit-test-coverage/modules/timebase_vxworks/src/coveragetest-timebase_vxworks.c b/unit-test-coverage/modules/timebase_vxworks/src/coveragetest-timebase_vxworks.c index 97521216..e0c95475 100644 --- a/unit-test-coverage/modules/timebase_vxworks/src/coveragetest-timebase_vxworks.c +++ b/unit-test-coverage/modules/timebase_vxworks/src/coveragetest-timebase_vxworks.c @@ -68,8 +68,8 @@ void ModuleTest_ResetState(void) int32 UTHOOK_vxTimeBaseGet(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { PSP_VxWorks_TimeBaseVal_t *val = UserObj; - uint32 * u = UT_Hook_GetArgValueByName(Context, "u", uint32 *); - uint32 * l = UT_Hook_GetArgValueByName(Context, "l", uint32 *); + uint32 *u = UT_Hook_GetArgValueByName(Context, "u", uint32 *); + uint32 *l = UT_Hook_GetArgValueByName(Context, "l", uint32 *); *u = val->u; *l = val->l; @@ -160,7 +160,8 @@ void Test_Reducible_1(void) CFE_PSP_GetTime(&OsTime); TestTime = OS_TimeGetTotalMicroseconds(OsTime); - UtAssert_True(TestTime == 10376293541461622, "CFE_PSP_GetTime() Microseconds (%lld) == 10376293541461622", + UtAssert_True(TestTime == 10376293541461622, + "CFE_PSP_GetTime() Microseconds (%lld) == 10376293541461622", (long long)TestTime); } @@ -191,7 +192,8 @@ void Test_Reducible_2(void) CFE_PSP_GetTime(&OsTime); TestTime = OS_TimeGetTotalMicroseconds(OsTime); - UtAssert_True(TestTime == 276701161105643274, "CFE_PSP_GetTime() Microseconds(%lld) == 276701161105643274", + UtAssert_True(TestTime == 276701161105643274, + "CFE_PSP_GetTime() Microseconds(%lld) == 276701161105643274", (long long)TestTime); } diff --git a/unit-test-coverage/modules/vxworks_sysmon/inc/coveragetest-vxworks_sysmon.h b/unit-test-coverage/modules/vxworks_sysmon/inc/coveragetest-vxworks_sysmon.h index 71de1a2b..5b7750de 100644 --- a/unit-test-coverage/modules/vxworks_sysmon/inc/coveragetest-vxworks_sysmon.h +++ b/unit-test-coverage/modules/vxworks_sysmon/inc/coveragetest-vxworks_sysmon.h @@ -47,7 +47,7 @@ #include "iodriver_impl.h" #include "vxworks_sysmon.h" -void UT_TaskDelay_Hook(void *UserObj); +void UT_TaskDelay_Hook(void *UserObj); void Test_Init_Nominal(void); void Test_Entry_Nominal(void); diff --git a/unit-test-coverage/modules/vxworks_sysmon/src/coveragetest-vxworks_sysmon.c b/unit-test-coverage/modules/vxworks_sysmon/src/coveragetest-vxworks_sysmon.c index 63350fe4..8aad082c 100644 --- a/unit-test-coverage/modules/vxworks_sysmon/src/coveragetest-vxworks_sysmon.c +++ b/unit-test-coverage/modules/vxworks_sysmon/src/coveragetest-vxworks_sysmon.c @@ -53,7 +53,7 @@ */ extern CFE_PSP_ModuleApi_t CFE_PSP_vxworks_sysmon_API; extern vxworks_sysmon_state_t vxworks_sysmon_global; -const CFE_PSP_ModuleApi_t * TgtAPI = &CFE_PSP_vxworks_sysmon_API; +const CFE_PSP_ModuleApi_t *TgtAPI = &CFE_PSP_vxworks_sysmon_API; /* Hook */ void UT_TaskDelay_Hook(void *UserObj) @@ -99,10 +99,10 @@ void Test_Aggregate_Nominal(void) int32 IsRunningStatus; CFE_PSP_IODriver_AdcCode_t Sample; - CFE_PSP_IODriver_AnalogRdWr_t RdWr = {.NumChannels = 1, .Samples = &Sample}; + CFE_PSP_IODriver_AnalogRdWr_t RdWr = { .NumChannels = 1, .Samples = &Sample }; CFE_PSP_IODriver_Direction_t QueryDirArg; - CFE_PSP_IODriver_API_t * EntryAPI = TgtAPI->ExtendedApi; + CFE_PSP_IODriver_API_t *EntryAPI = TgtAPI->ExtendedApi; /* Nominal Case: Aggregate Dispatch Noop CMD (Not Impl) */ StatusCode = EntryAPI->DeviceCommand(CFE_PSP_IODriver_NOOP, 0, 0, CFE_PSP_IODriver_U32ARG(0)); /* Entry Point */ @@ -175,12 +175,11 @@ void Test_Aggregate_Nominal(void) void Test_Aggregate_Error(void) { - CFE_PSP_IODriver_API_t * EntryAPI = TgtAPI->ExtendedApi; + CFE_PSP_IODriver_API_t *EntryAPI = TgtAPI->ExtendedApi; int32 StatusCode; int32 IsRunningStatus; CFE_PSP_IODriver_AdcCode_t Sample; - CFE_PSP_IODriver_AnalogRdWr_t RdWr = {.NumChannels = 1, .Samples = &Sample}; - + CFE_PSP_IODriver_AnalogRdWr_t RdWr = { .NumChannels = 1, .Samples = &Sample }; /* Error Case: Look Up Subsystem Not Found */ StatusCode = EntryAPI->DeviceCommand(CFE_PSP_IODriver_LOOKUP_SUBSYSTEM, 0, 0, CFE_PSP_IODriver_CONST_STR("Empty")); @@ -220,9 +219,9 @@ void Test_Aggregate_Error(void) void Test_Dispatch_Nominal(void) { - CFE_PSP_IODriver_API_t * EntryAPI = TgtAPI->ExtendedApi; + CFE_PSP_IODriver_API_t *EntryAPI = TgtAPI->ExtendedApi; CFE_PSP_IODriver_AdcCode_t Sample[2]; - CFE_PSP_IODriver_AnalogRdWr_t RdWr = {.NumChannels = 1, .Samples = Sample}; + CFE_PSP_IODriver_AnalogRdWr_t RdWr = { .NumChannels = 1, .Samples = Sample }; int32 StatusCode; /* Nominal Case: Dispatch IO Driver NOOP */ @@ -242,9 +241,9 @@ void Test_Dispatch_Nominal(void) void Test_Dispatch_Error(void) { - CFE_PSP_IODriver_API_t * EntryAPI = TgtAPI->ExtendedApi; + CFE_PSP_IODriver_API_t *EntryAPI = TgtAPI->ExtendedApi; CFE_PSP_IODriver_AdcCode_t Sample[2]; - CFE_PSP_IODriver_AnalogRdWr_t RdWr = {.NumChannels = 1, .Samples = Sample}; + CFE_PSP_IODriver_AnalogRdWr_t RdWr = { .NumChannels = 1, .Samples = Sample }; int StatusCode; /* Error Case: Dispatch Analog Read Channels, Subchannel >= Max Cpu */ @@ -276,7 +275,7 @@ void Test_UpdateStat_Nominal(void) IdleTaskLoad = 97; vxworks_sysmon_update_stat(fmt, "IDLE", "", "", "", 95, 7990, IdleTaskLoad, 1998); /* Function under test */ - AvgLoad = ((0x1000 * (100 - IdleTaskLoad)) / 100); + AvgLoad = ((0x1000 * (100 - IdleTaskLoad)) / 100); AvgLoad |= (AvgLoad << 12); UtAssert_True(vxworks_sysmon_global.cpu_load.per_core[0].avg_load == AvgLoad, "Nominal Case: 3 percents cpuload"); @@ -297,7 +296,7 @@ void Test_UpdateStat_Nominal(void) UtAssert_True(vxworks_sysmon_global.cpu_load.per_core[0].avg_load == AvgLoad, "Nominal Case: 100 percents cpuload"); /* Nominal Case: Max Cpu Num */ - IdleTaskLoad = 0; + IdleTaskLoad = 0; vxworks_sysmon_global.cpu_load.poll_core_no = 1 + VXWORKS_SYSMON_MAX_CPUS; vxworks_sysmon_update_stat(fmt, "IDLE", "", "", "", 95, 7990, IdleTaskLoad, 1998); /* Function under test */ UtAssert_UINT8_EQ(vxworks_sysmon_global.cpu_load.poll_core_no, 1); 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 index 6f3d9336..1ba054fd 100644 --- a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-support.c +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-support.c @@ -58,6 +58,8 @@ void Test_CFE_PSP_GetSpacecraftId(void) void Test_CFE_PSP_GetProcessorName(void) { - UtAssert_STRINGBUF_EQ(CFE_PSP_GetProcessorName(), UTASSERT_STRINGBUF_NULL_TERM, PCS_CONFIG_CPUNAME, + 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-psp-pc-rtems.c b/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.c index 3e5a8612..128983e7 100644 --- a/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.c +++ b/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.c @@ -23,7 +23,9 @@ void Psp_Test_Setup(void) UT_ResetState(0); } -void Psp_Test_Teardown(void) {} +void Psp_Test_Teardown(void) +{ +} void UtTest_Setup(void) { diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-cdsmem.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-cdsmem.h index 65066ace..5bf1f445 100644 --- a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-cdsmem.h +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-cdsmem.h @@ -43,7 +43,7 @@ void UT_CdsMemAdaptor_Init(void *mem_ptr, size_t mem_size); void UT_CdsMemAdaptor_CopyOut(void *dst, size_t num_bytes); void UT_CdsMemAdaptor_SetOffset(size_t offset, uint8 val); -void * UT_CdsMemAdaptor_GetAddress(void); +void *UT_CdsMemAdaptor_GetAddress(void); size_t UT_CdsMemAdaptor_GetSize(void); #endif diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-resetmem.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-resetmem.h index 3588e220..b7247956 100644 --- a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-resetmem.h +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-resetmem.h @@ -42,7 +42,7 @@ void UT_ResetMemAdaptor_Init(void *mem_ptr, size_t mem_size); void UT_ResetMemAdaptor_SetOffset(size_t offset, uint8 val); -void * UT_ResetMemAdaptor_GetAddress(void); +void *UT_ResetMemAdaptor_GetAddress(void); size_t UT_ResetMemAdaptor_GetSize(void); #endif diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-usermem.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-usermem.h index c347cf73..1232aa87 100644 --- a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-usermem.h +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-usermem.h @@ -43,7 +43,7 @@ void UT_UserMemAdaptor_Init(void *mem_ptr, size_t mem_size); void UT_UserMemAdaptor_CopyOut(void *dst, size_t num_bytes); void UT_UserMemAdaptor_SetOffset(size_t offset, uint8 val); -void * UT_UserMemAdaptor_GetAddress(void); +void *UT_UserMemAdaptor_GetAddress(void); size_t UT_UserMemAdaptor_GetSize(void); #endif diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-voldisk.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-voldisk.h index 2128937d..dca31d68 100644 --- a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-voldisk.h +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-voldisk.h @@ -43,7 +43,7 @@ void UT_VolDiskAdaptor_Init(void *mem_ptr, size_t mem_size); void UT_VolDiskAdaptor_CopyOut(void *dst, size_t num_bytes); void UT_VolDiskAdaptor_SetOffset(size_t offset, uint8 val); -void * UT_VolDiskAdaptor_GetAddress(void); +void *UT_VolDiskAdaptor_GetAddress(void); size_t UT_VolDiskAdaptor_GetSize(void); #endif diff --git a/unit-test-coverage/shared/adaptors/src/ut-adaptor-bootrec.c b/unit-test-coverage/shared/adaptors/src/ut-adaptor-bootrec.c index b98d88ee..79ce5cfa 100644 --- a/unit-test-coverage/shared/adaptors/src/ut-adaptor-bootrec.c +++ b/unit-test-coverage/shared/adaptors/src/ut-adaptor-bootrec.c @@ -41,7 +41,7 @@ static CFE_PSP_ReservedMemoryBootRecord_t UT_BOOTREC; -static const CFE_PSP_ReservedMemoryBootRecord_t UT_DEFAULT_BOOTREC = {0}; +static const CFE_PSP_ReservedMemoryBootRecord_t UT_DEFAULT_BOOTREC = { 0 }; void UT_BootRecAdaptor_InitDefault(void) { diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-error.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-error.c index bd129725..d99eb57d 100644 --- a/unit-test-coverage/shared/src/coveragetest-cfe-psp-error.c +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-error.c @@ -45,7 +45,7 @@ void Test_CFE_PSP_StatusToString(void) /* Test Case for: * char *CFE_PSP_StatusToString(CFE_PSP_Status_t status, CFE_PSP_StatusString_t *status_string) */ - CFE_PSP_StatusString_t MyString = {0}; + CFE_PSP_StatusString_t MyString = { 0 }; UtAssert_ADDRESS_EQ(CFE_PSP_StatusToString(CFE_PSP_STATUS_C(-1), &MyString), MyString); UtAssert_NONZERO(MyString[0]); diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c index fe861359..10533910 100644 --- a/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c @@ -56,8 +56,10 @@ void Test_CFE_PSP_Exception_GetBuffer(void) Ptr1 = CFE_PSP_Exception_GetBuffer(1); UtAssert_True(Ptr1 != NULL, "CFE_PSP_Exception_GetBuffer(1) (%p) != NULL", (void *)Ptr1); - UtAssert_True(Ptr0 != Ptr1, "CFE_PSP_Exception_GetBuffer(0) (%p) != CFE_PSP_Exception_GetBuffer(1) (%p)", - (void *)Ptr0, (void *)Ptr1); + UtAssert_True(Ptr0 != Ptr1, + "CFE_PSP_Exception_GetBuffer(0) (%p) != CFE_PSP_Exception_GetBuffer(1) (%p)", + (void *)Ptr0, + (void *)Ptr1); } void Test_CFE_PSP_Exception_GetNextContextBuffer(void) diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-memutils.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-memutils.c index 2aecb252..4b190137 100644 --- a/unit-test-coverage/shared/src/coveragetest-cfe-psp-memutils.c +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-memutils.c @@ -45,7 +45,7 @@ void Test_CFE_PSP_MemCpy(void) /* Test Case For: * int32 CFE_PSP_MemCpy(void *dest, const void *src, uint32 n) */ - const uint8 MySrcBuf[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + const uint8 MySrcBuf[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; uint8 MyDstBuf[16]; UtAssert_INT32_EQ(CFE_PSP_MemCpy(NULL, MySrcBuf, sizeof(MyDstBuf)), CFE_PSP_ERROR); diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-module.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-module.c index 6773476b..5eb16159 100644 --- a/unit-test-coverage/shared/src/coveragetest-cfe-psp-module.c +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-module.c @@ -46,18 +46,22 @@ static void InitStub(uint32 PspModuleId) UT_DEFAULT_IMPL(InitStub); } -CFE_PSP_ModuleApi_t UT_API_INVALID = {.ModuleType = CFE_PSP_MODULE_TYPE_INVALID}; -CFE_PSP_ModuleApi_t UT_API_SIMPLE_NO_INIT = {.ModuleType = CFE_PSP_MODULE_TYPE_SIMPLE}; -CFE_PSP_ModuleApi_t UT_API_SIMPLE_COMPLETE = {.ModuleType = CFE_PSP_MODULE_TYPE_SIMPLE, .Init = InitStub}; - -static CFE_StaticModuleLoadEntry_t UT_STATIC_MODULE_LIST1[] = {{.Name = "UT1", .Api = &UT_API_INVALID}, - {.Name = "UT2", .Api = &UT_API_SIMPLE_NO_INIT}, - {.Name = "UT3", .Api = &UT_API_SIMPLE_COMPLETE}, - {.Name = NULL, .Api = NULL}}; - -static CFE_StaticModuleLoadEntry_t UT_STATIC_MODULE_LIST2[] = {{.Name = "UT4", .Api = &UT_API_SIMPLE_COMPLETE}, - {.Name = "UT5", .Api = &UT_API_SIMPLE_NO_INIT}, - {.Name = NULL, .Api = NULL}}; +CFE_PSP_ModuleApi_t UT_API_INVALID = { .ModuleType = CFE_PSP_MODULE_TYPE_INVALID }; +CFE_PSP_ModuleApi_t UT_API_SIMPLE_NO_INIT = { .ModuleType = CFE_PSP_MODULE_TYPE_SIMPLE }; +CFE_PSP_ModuleApi_t UT_API_SIMPLE_COMPLETE = { .ModuleType = CFE_PSP_MODULE_TYPE_SIMPLE, .Init = InitStub }; + +static CFE_StaticModuleLoadEntry_t UT_STATIC_MODULE_LIST1[] = { + { .Name = "UT1", .Api = &UT_API_INVALID }, + { .Name = "UT2", .Api = &UT_API_SIMPLE_NO_INIT }, + { .Name = "UT3", .Api = &UT_API_SIMPLE_COMPLETE }, + { .Name = NULL, .Api = NULL } +}; + +static CFE_StaticModuleLoadEntry_t UT_STATIC_MODULE_LIST2[] = { + { .Name = "UT4", .Api = &UT_API_SIMPLE_COMPLETE }, + { .Name = "UT5", .Api = &UT_API_SIMPLE_NO_INIT }, + { .Name = NULL, .Api = NULL } +}; void Test_CFE_PSP_ModuleInitList(void) { @@ -93,9 +97,9 @@ void Test_CFE_PSP_Module_GetAPIEntry(void) CFE_PSP_ModuleApi_t *API; CFE_PSP_MODULE_LIST_GLOBAL.Std = - (CFE_PSP_ModuleListWrapper_t) {.BasePtr = UT_STATIC_MODULE_LIST1, .ListLen = 3, .BaseId = 0xAFF00}; + (CFE_PSP_ModuleListWrapper_t) { .BasePtr = UT_STATIC_MODULE_LIST1, .ListLen = 3, .BaseId = 0xAFF00 }; CFE_PSP_MODULE_LIST_GLOBAL.Ext = - (CFE_PSP_ModuleListWrapper_t) {.BasePtr = UT_STATIC_MODULE_LIST2, .ListLen = 2, .BaseId = 0xA0000}; + (CFE_PSP_ModuleListWrapper_t) { .BasePtr = UT_STATIC_MODULE_LIST2, .ListLen = 2, .BaseId = 0xA0000 }; UtAssert_INT32_EQ(CFE_PSP_Module_GetAPIEntry(0, &API), CFE_PSP_INVALID_MODULE_ID); UtAssert_NULL(API); @@ -120,7 +124,7 @@ void Test_CFE_PSP_Module_SearchNameInList(void) * const char *ModuleName); */ uint32 Id; - CFE_PSP_ModuleListWrapper_t ModList = {.BasePtr = UT_STATIC_MODULE_LIST1, .ListLen = 3, .BaseId = 0xC0000}; + CFE_PSP_ModuleListWrapper_t ModList = { .BasePtr = UT_STATIC_MODULE_LIST1, .ListLen = 3, .BaseId = 0xC0000 }; UtAssert_ZERO(CFE_PSP_Module_SearchNameInList(&ModList, "DoesNotExist")); UtAssert_NONZERO(Id = CFE_PSP_Module_SearchNameInList(&ModList, "UT2")); @@ -137,9 +141,9 @@ void Test_CFE_PSP_Module_FindByName(void) uint32 ModuleId; CFE_PSP_MODULE_LIST_GLOBAL.Std = - (CFE_PSP_ModuleListWrapper_t) {.BasePtr = UT_STATIC_MODULE_LIST1, .ListLen = 3, .BaseId = 0xDFF00}; + (CFE_PSP_ModuleListWrapper_t) { .BasePtr = UT_STATIC_MODULE_LIST1, .ListLen = 3, .BaseId = 0xDFF00 }; CFE_PSP_MODULE_LIST_GLOBAL.Ext = - (CFE_PSP_ModuleListWrapper_t) {.BasePtr = UT_STATIC_MODULE_LIST2, .ListLen = 2, .BaseId = 0xD0000}; + (CFE_PSP_ModuleListWrapper_t) { .BasePtr = UT_STATIC_MODULE_LIST2, .ListLen = 2, .BaseId = 0xD0000 }; UtAssert_INT32_EQ(CFE_PSP_Module_FindByName("NameDoesNotExist", &ModuleId), CFE_PSP_INVALID_MODULE_NAME); diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-version.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-version.c index 5c01bdef..b33be00e 100644 --- a/unit-test-coverage/shared/src/coveragetest-cfe-psp-version.c +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-version.c @@ -61,7 +61,7 @@ void Test_CFE_PSP_GetVersionNumber(void) /* Test Case For: * void CFE_PSP_GetVersionNumber(uint8 VersionNumbers[4]) */ - uint8 VersionNumbers[4] = {0, 0, 0, 0}; + uint8 VersionNumbers[4] = { 0, 0, 0, 0 }; UtAssert_VOIDCALL(CFE_PSP_GetVersionNumber(VersionNumbers)); diff --git a/unit-test-coverage/ut-stubs/inc/PCS_arpa_inet.h b/unit-test-coverage/ut-stubs/inc/PCS_arpa_inet.h index f8f7d949..e49e4b7c 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_arpa_inet.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_arpa_inet.h @@ -63,6 +63,6 @@ /* prototypes normally declared in arpa/inet.h */ /* ------------------------------------------- */ extern uint32_t PCS_inet_addr(const char *cp); -extern char * PCS_inet_ntoa(struct PCS_in_addr in); +extern char *PCS_inet_ntoa(struct PCS_in_addr in); #endif diff --git a/unit-test-coverage/ut-stubs/inc/PCS_cpuuse.h b/unit-test-coverage/ut-stubs/inc/PCS_cpuuse.h index baa4dd48..07f0899f 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_cpuuse.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_cpuuse.h @@ -20,6 +20,6 @@ #include "PCS_rtems.h" -void PCS_rtems_cpu_usage_reset( void ); +void PCS_rtems_cpu_usage_reset(void); #endif diff --git a/unit-test-coverage/ut-stubs/inc/PCS_fcntl.h b/unit-test-coverage/ut-stubs/inc/PCS_fcntl.h index af38672d..62844492 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_fcntl.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_fcntl.h @@ -83,7 +83,7 @@ #define PCS_S_IWUSR 0x0040 #define PCS_S_IFDIR 0x0001 -#define PCS_S_ISDIR(x) (((x)&PCS_S_IFDIR) == PCS_S_IFDIR) +#define PCS_S_ISDIR(x) (((x) & PCS_S_IFDIR) == PCS_S_IFDIR) #define PCS_O_RDONLY 0x1501 #define PCS_O_WRONLY 0x1502 diff --git a/unit-test-coverage/ut-stubs/inc/PCS_rtems.h b/unit-test-coverage/ut-stubs/inc/PCS_rtems.h index c1ef7096..d967495d 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_rtems.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_rtems.h @@ -36,9 +36,10 @@ typedef uint32_t PCS_rtems_mode; typedef uint32_t PCS_rtems_attribute; typedef PCS_CPU_Uint32ptr PCS_rtems_task_argument; -typedef struct { +typedef struct +{ /* Fake Thread control */ - char * Name; + char *Name; } PCS_Thread_Control_S; typedef PCS_Thread_Control_S PCS_rtems_tcb; @@ -49,9 +50,9 @@ 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; + char *ip_address; + char *ip_netmask; + void *hardware_address; }; struct PCS_rtems_bsdnet_config diff --git a/unit-test-coverage/ut-stubs/inc/PCS_spyLibP.h b/unit-test-coverage/ut-stubs/inc/PCS_spyLibP.h index 10ef01d8..b6c7fbf9 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_spyLibP.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_spyLibP.h @@ -38,5 +38,4 @@ void PCS_spyReportCommon(PCS_FUNCPTR print); void PCS_spyClkStopCommon(void); int PCS_spyClkStartCommon(int intsPerSec, PCS_FUNCPTR print); - #endif diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h b/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h index 3d23da3a..e8ee3a03 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h @@ -40,6 +40,6 @@ typedef struct #define PCS_va_start(ap, last) ap.p = &last #define PCS_va_end(ap) -#define PCS_va_arg(ap, type) (ap.p = (char *)ap.p + sizeof(type), (type) 0) /* FIXME */ +#define PCS_va_arg(ap, type) (ap.p = (char *)ap.p + sizeof(type), (type)0) /* FIXME */ #endif diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdio.h b/unit-test-coverage/ut-stubs/inc/PCS_stdio.h index a13490ad..68838c21 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_stdio.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdio.h @@ -37,7 +37,7 @@ typedef struct PCS_FILE PCS_FILE; /* ----------------------------------------- */ extern int PCS_fclose(PCS_FILE *stream); -extern char * PCS_fgets(char *s, int n, PCS_FILE *stream); +extern char *PCS_fgets(char *s, int n, PCS_FILE *stream); extern PCS_FILE *PCS_fopen(const char *filename, const char *modes); extern int PCS_fputs(const char *s, PCS_FILE *stream); extern int PCS_remove(const char *filename); diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h b/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h index 7142305b..e06fd34d 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h @@ -40,7 +40,7 @@ extern void PCS_exit(int status); extern unsigned long int PCS_strtoul(const char *nptr, char **endptr, int base); extern int PCS_system(const char *command); -extern void * PCS_malloc(size_t sz); +extern void *PCS_malloc(size_t sz); extern void PCS_free(void *ptr); extern void PCS_abort(void); extern int PCS_abs(int value); diff --git a/unit-test-coverage/ut-stubs/inc/PCS_string.h b/unit-test-coverage/ut-stubs/inc/PCS_string.h index f88f944f..5a9a7333 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_string.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_string.h @@ -35,18 +35,18 @@ /* ----------------------------------------- */ extern int PCS_memcmp(void *dest, const void *src, size_t n); -extern void * PCS_memcpy(void *dest, const void *src, size_t n); -extern void * PCS_memset(void *s, int c, size_t n); -extern void * PCS_memchr(const void *s, int c, size_t n); +extern void *PCS_memcpy(void *dest, const void *src, size_t n); +extern void *PCS_memset(void *s, int c, size_t n); +extern void *PCS_memchr(const void *s, int c, size_t n); extern int PCS_strcmp(const char *s1, const char *s2); -extern char * PCS_strcpy(char *dest, const char *src); +extern char *PCS_strcpy(char *dest, const char *src); extern size_t PCS_strlen(const char *s); extern int PCS_strncmp(const char *s1, const char *s2, size_t n); -extern char * PCS_strncpy(char *dest, const char *src, size_t n); -extern char * PCS_strchr(const char *s, int c); -extern char * PCS_strrchr(const char *s, int c); -extern char * PCS_strcat(char *dest, const char *src); -extern char * PCS_strncat(char *dest, const char *src, size_t n); -extern char * PCS_strerror(int errnum); +extern char *PCS_strncpy(char *dest, const char *src, size_t n); +extern char *PCS_strchr(const char *s, int c); +extern char *PCS_strrchr(const char *s, int c); +extern char *PCS_strcat(char *dest, const char *src); +extern char *PCS_strncat(char *dest, const char *src, size_t n); +extern char *PCS_strerror(int errnum); #endif diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sys_select.h b/unit-test-coverage/ut-stubs/inc/PCS_sys_select.h index 3ab888bd..61eeb2b6 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sys_select.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sys_select.h @@ -68,8 +68,8 @@ typedef struct /* prototypes normally declared in sys/select.h */ /* ----------------------------------------- */ -extern int PCS_select(int nfds, PCS_fd_set *readfds, PCS_fd_set *writefds, PCS_fd_set *exceptfds, - struct PCS_timeval *timeout); +extern int +PCS_select(int nfds, PCS_fd_set *readfds, PCS_fd_set *writefds, PCS_fd_set *exceptfds, struct PCS_timeval *timeout); extern void PCS_FD_SET(int fd, PCS_fd_set *set); extern int PCS_FD_ISSET(int fd, PCS_fd_set *set); extern void PCS_FD_CLR(int fd, PCS_fd_set *set); diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sys_socket.h b/unit-test-coverage/ut-stubs/inc/PCS_sys_socket.h index 61390a80..2cad5811 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sys_socket.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sys_socket.h @@ -92,17 +92,17 @@ enum /* prototypes normally declared in sys/socket.h */ /* ----------------------------------------- */ -extern int PCS_accept(int fd, struct PCS_sockaddr *addr, PCS_socklen_t *addr_len); -extern int PCS_bind(int fd, const struct PCS_sockaddr *addr, PCS_socklen_t len); -extern int PCS_connect(int fd, const struct PCS_sockaddr *addr, PCS_socklen_t len); -extern int PCS_getsockopt(int fd, int level, int optname, void *optval, PCS_socklen_t *optlen); -extern int PCS_listen(int fd, int n); -extern PCS_ssize_t PCS_recvfrom(int fd, void *buf, size_t n, int flags, struct PCS_sockaddr *addr, - PCS_socklen_t *addr_len); -extern PCS_ssize_t PCS_sendto(int fd, const void *buf, size_t n, int flags, const struct PCS_sockaddr *addr, - PCS_socklen_t addr_len); -extern int PCS_setsockopt(int fd, int level, int optname, const void *optval, PCS_socklen_t optlen); -extern int PCS_shutdown(int fd, int how); -extern int PCS_socket(int domain, int type, int protocol); +extern int PCS_accept(int fd, struct PCS_sockaddr *addr, PCS_socklen_t *addr_len); +extern int PCS_bind(int fd, const struct PCS_sockaddr *addr, PCS_socklen_t len); +extern int PCS_connect(int fd, const struct PCS_sockaddr *addr, PCS_socklen_t len); +extern int PCS_getsockopt(int fd, int level, int optname, void *optval, PCS_socklen_t *optlen); +extern int PCS_listen(int fd, int n); +extern PCS_ssize_t +PCS_recvfrom(int fd, void *buf, size_t n, int flags, struct PCS_sockaddr *addr, PCS_socklen_t *addr_len); +extern PCS_ssize_t +PCS_sendto(int fd, const void *buf, size_t n, int flags, const struct PCS_sockaddr *addr, PCS_socklen_t addr_len); +extern int PCS_setsockopt(int fd, int level, int optname, const void *optval, PCS_socklen_t optlen); +extern int PCS_shutdown(int fd, int how); +extern int PCS_socket(int domain, int type, int protocol); #endif /* PCS_SYS_SOCKET_H */ diff --git a/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h b/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h index 1baf7b13..21ad4fa4 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h @@ -68,13 +68,39 @@ extern PCS_STATUS PCS_taskSuspend(PCS_TASK_ID tid); extern PCS_STATUS PCS_taskResume(PCS_TASK_ID tid); extern PCS_STATUS PCS_taskPrioritySet(PCS_TASK_ID tid, int newPriority); extern PCS_STATUS PCS_taskPriorityGet(PCS_TASK_ID tid, int *pPriority); -extern PCS_TASK_ID PCS_taskSpawn(char *name, int priority, int options, int stackSize, PCS_FUNCPTR entryPt, int arg1, - int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, - int arg10); +extern PCS_TASK_ID PCS_taskSpawn(char *name, + int priority, + int options, + int stackSize, + PCS_FUNCPTR entryPt, + int arg1, + int arg2, + int arg3, + int arg4, + int arg5, + int arg6, + int arg7, + int arg8, + int arg9, + int arg10); -PCS_STATUS PCS_taskInit(PCS_WIND_TCB *pTcb, char *name, int priority, int options, char *pStackBase, int stackSize, - PCS_FUNCPTR entryPt, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, - int arg8, int arg9, int arg10); +PCS_STATUS PCS_taskInit(PCS_WIND_TCB *pTcb, + char *name, + int priority, + int options, + char *pStackBase, + int stackSize, + PCS_FUNCPTR entryPt, + int arg1, + int arg2, + int arg3, + int arg4, + int arg5, + int arg6, + int arg7, + int arg8, + int arg9, + int arg10); PCS_WIND_TCB *PCS_taskTcb(PCS_TASK_ID tid); diff --git a/unit-test-coverage/ut-stubs/inc/PCS_tasks.h b/unit-test-coverage/ut-stubs/inc/PCS_tasks.h index ff9f4ab3..23591716 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_tasks.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_tasks.h @@ -22,15 +22,18 @@ #include "PCS_rtems.h" -typedef bool( * PCS_rtems_task_visitor) (PCS_rtems_tcb *tcb, void *arg); -typedef PCS_rtems_task( * PCS_rtems_task_entry) (PCS_rtems_task_argument); - -void PCS_rtems_task_iterate (PCS_rtems_task_visitor visitor, void *arg); -PCS_rtems_status_code PCS_rtems_task_delete (PCS_rtems_id id); -PCS_rtems_status_code PCS_rtems_task_create (PCS_rtems_name name, PCS_rtems_task_priority initial_priority, size_t stack_size, - PCS_rtems_mode initial_modes, PCS_rtems_attribute attribute_set, PCS_rtems_id *id); -PCS_rtems_status_code PCS_rtems_task_start (PCS_rtems_id id, PCS_rtems_task_entry entry_point, PCS_rtems_task_argument argument); - +typedef bool (*PCS_rtems_task_visitor)(PCS_rtems_tcb *tcb, void *arg); +typedef PCS_rtems_task (*PCS_rtems_task_entry)(PCS_rtems_task_argument); +void PCS_rtems_task_iterate(PCS_rtems_task_visitor visitor, void *arg); +PCS_rtems_status_code PCS_rtems_task_delete(PCS_rtems_id id); +PCS_rtems_status_code PCS_rtems_task_create(PCS_rtems_name name, + PCS_rtems_task_priority initial_priority, + size_t stack_size, + PCS_rtems_mode initial_modes, + PCS_rtems_attribute attribute_set, + PCS_rtems_id *id); +PCS_rtems_status_code +PCS_rtems_task_start(PCS_rtems_id id, PCS_rtems_task_entry entry_point, PCS_rtems_task_argument argument); #endif \ No newline at end of file diff --git a/unit-test-coverage/ut-stubs/inc/PCS_threadimpl.h b/unit-test-coverage/ut-stubs/inc/PCS_threadimpl.h index 0e253fef..ae265a1b 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_threadimpl.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_threadimpl.h @@ -22,7 +22,7 @@ #include "PCS_rtems.h" -size_t PCS_Thread_Get_name(const PCS_Thread_Control *the_thread, char *buffer, size_t buffer_size); +size_t PCS_Thread_Get_name(const PCS_Thread_Control *the_thread, char *buffer, size_t buffer_size); PCS_Timestamp_Control PCS_Thread_Get_CPU_time_used_after_last_reset(PCS_Thread_Control *the_thread); #endif \ No newline at end of file diff --git a/unit-test-coverage/ut-stubs/inc/PCS_timestampimpl.h b/unit-test-coverage/ut-stubs/inc/PCS_timestampimpl.h index f95c2b71..3058f588 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_timestampimpl.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_timestampimpl.h @@ -22,8 +22,12 @@ #include "PCS_rtems.h" -void PCS_Timestamp_Subtract (const PCS_Timestamp_Control *_start, const PCS_Timestamp_Control *_end, PCS_Timestamp_Control *_result); -void PCS_Timestamp_Divide (const PCS_Timestamp_Control *_lhs, const PCS_Timestamp_Control *_rhs, uint32_t *_ival_percentage, uint32_t *_fval_percentage); - +void PCS_Timestamp_Subtract(const PCS_Timestamp_Control *_start, + const PCS_Timestamp_Control *_end, + PCS_Timestamp_Control *_result); +void PCS_Timestamp_Divide(const PCS_Timestamp_Control *_lhs, + const PCS_Timestamp_Control *_rhs, + uint32_t *_ival_percentage, + uint32_t *_fval_percentage); #endif \ No newline at end of file diff --git a/unit-test-coverage/ut-stubs/inc/PCS_todimpl.h b/unit-test-coverage/ut-stubs/inc/PCS_todimpl.h index f52121ad..5defda31 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_todimpl.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_todimpl.h @@ -22,7 +22,6 @@ #include "PCS_rtems.h" -void PCS_TOD_Get_uptime (PCS_Timestamp_Control *time); - +void PCS_TOD_Get_uptime(PCS_Timestamp_Control *time); #endif \ No newline at end of file diff --git a/unit-test-coverage/ut-stubs/override_inc/private/spyLibP.h b/unit-test-coverage/ut-stubs/override_inc/private/spyLibP.h index 63dcdee0..e5f2f9d2 100644 --- a/unit-test-coverage/ut-stubs/override_inc/private/spyLibP.h +++ b/unit-test-coverage/ut-stubs/override_inc/private/spyLibP.h @@ -26,8 +26,8 @@ /* ----------------------------------------- */ /* mappings for declarations in spyLibP.h */ /* ----------------------------------------- */ -#define spyReportCommon PCS_spyReportCommon -#define spyClkStartCommon PCS_spyClkStartCommon -#define spyClkStopCommon PCS_spyClkStopCommon +#define spyReportCommon PCS_spyReportCommon +#define spyClkStartCommon PCS_spyClkStartCommon +#define spyClkStopCommon PCS_spyClkStopCommon #endif diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems.h b/unit-test-coverage/ut-stubs/override_inc/rtems.h index 82d98800..2d14a044 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rtems.h +++ b/unit-test-coverage/ut-stubs/override_inc/rtems.h @@ -26,19 +26,19 @@ #include "rtems/score/timestampimpl.h" #include "rtems/rtems/object.h" -#define rtems_task_priority PCS_rtems_task_priority -#define rtems_id PCS_rtems_id -#define rtems_name PCS_rtems_name -#define CPU_Uint32ptr PCS_CPU_Uint32ptr -#define rtems_task PCS_rtems_task -#define rtems_task_argument PCS_rtems_task_argument -#define Timestamp_Control PCS_Timestamp_Control -#define Thread_Control PCS_Thread_Control -#define _Thread_Control PCS_Thread_Control_S -#define rtems_task_visitor PCS_rtems_task_visitor -#define rtems_mode PCS_rtems_mode -#define rtems_attribute PCS_rtems_attribute -#define rtems_task_entry PCS_rtems_task_entry +#define rtems_task_priority PCS_rtems_task_priority +#define rtems_id PCS_rtems_id +#define rtems_name PCS_rtems_name +#define CPU_Uint32ptr PCS_CPU_Uint32ptr +#define rtems_task PCS_rtems_task +#define rtems_task_argument PCS_rtems_task_argument +#define Timestamp_Control PCS_Timestamp_Control +#define Thread_Control PCS_Thread_Control +#define _Thread_Control PCS_Thread_Control_S +#define rtems_task_visitor PCS_rtems_task_visitor +#define rtems_mode PCS_rtems_mode +#define rtems_attribute PCS_rtems_attribute +#define rtems_task_entry PCS_rtems_task_entry #define rtems_status_code PCS_rtems_status_code #define RTEMS_SUCCESSFUL PCS_RTEMS_SUCCESSFUL diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/score/timestampimpl.h b/unit-test-coverage/ut-stubs/override_inc/rtems/score/timestampimpl.h index 01603b24..b2f50535 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rtems/score/timestampimpl.h +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/score/timestampimpl.h @@ -21,7 +21,7 @@ #define OVERRIDE_TIMESTAMPIMPL_H #include "PCS_timestampimpl.h" - + #define _Timestamp_Subtract PCS_Timestamp_Subtract #define _Timestamp_Divide PCS_Timestamp_Divide diff --git a/unit-test-coverage/ut-stubs/override_inc/spyLib.h b/unit-test-coverage/ut-stubs/override_inc/spyLib.h index b2775fbd..f3f4846a 100644 --- a/unit-test-coverage/ut-stubs/override_inc/spyLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/spyLib.h @@ -26,6 +26,6 @@ /* ----------------------------------------- */ /* mappings for declarations in spyLib.h */ /* ----------------------------------------- */ -#define spyLibInit PCS_spyLibInit +#define spyLibInit PCS_spyLibInit #endif diff --git a/unit-test-coverage/ut-stubs/src/PCS_arpa_inet_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_arpa_inet_handlers.c index 2299259c..4b0ef9c7 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_arpa_inet_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_arpa_inet_handlers.c @@ -44,7 +44,7 @@ void UT_DefaultHandler_PCS_inet_ntoa(void *UserObj, UT_EntryKey_t FuncKey, const { /* char *PCS_inet_ntoa(struct PCS_in_addr in) */ static char Buf[MAX_NTOA_LEN] = ""; - char * pBuf = Buf; + char *pBuf = Buf; if (!UT_Stub_GetInt32StatusCode(Context, NULL)) { diff --git a/unit-test-coverage/ut-stubs/src/PCS_bsdnet_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_bsdnet_handlers.c index e17db460..5212a2eb 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_bsdnet_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_bsdnet_handlers.c @@ -31,8 +31,8 @@ void UT_DefaultHandler_PCS_rtems_status_text(void *UserObj, UT_EntryKey_t FuncKe UT_Stub_GetInt32StatusCode(Context, &Status); - if (Status >= 0 && - UT_Stub_CopyToLocal(UT_KEY(PCS_rtems_status_text), &ReturnCode, sizeof(ReturnCode)) == sizeof(ReturnCode)) + if (Status >= 0 + && UT_Stub_CopyToLocal(UT_KEY(PCS_rtems_status_text), &ReturnCode, sizeof(ReturnCode)) == sizeof(ReturnCode)) { UT_Stub_SetReturnValue(FuncKey, ReturnCode); } diff --git a/unit-test-coverage/ut-stubs/src/PCS_bsdnet_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_bsdnet_stubs.c index 12eb9ee6..e84ff6e2 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_bsdnet_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_bsdnet_stubs.c @@ -34,7 +34,6 @@ void UT_DefaultHandler_PCS_rtems_status_text(void *, UT_EntryKey_t, const UT_Stu */ void PCS_rtems_bsdnet_do_dhcp_failsafe(void) { - UT_GenStub_Execute(PCS_rtems_bsdnet_do_dhcp_failsafe, Basic, NULL); } diff --git a/unit-test-coverage/ut-stubs/src/PCS_cfe_configdata_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_cfe_configdata_stubs.c index dc4aa234..59fbc41b 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_cfe_configdata_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_cfe_configdata_stubs.c @@ -32,7 +32,6 @@ */ void PCS_System1HzISR(void) { - UT_GenStub_Execute(PCS_System1HzISR, Basic, NULL); } @@ -58,6 +57,5 @@ void PCS_SystemMain(uint32_t StartType, uint32_t StartSubtype, uint32_t ModeId, */ void PCS_SystemNotify(void) { - UT_GenStub_Execute(PCS_SystemNotify, Basic, NULL); } diff --git a/unit-test-coverage/ut-stubs/src/PCS_cpuuse_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_cpuuse_stubs.c index 29ecac24..344747c2 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_cpuuse_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_cpuuse_stubs.c @@ -33,6 +33,5 @@ */ void PCS_rtems_cpu_usage_reset(void) { - UT_GenStub_Execute(PCS_rtems_cpu_usage_reset, Basic, NULL); } diff --git a/unit-test-coverage/ut-stubs/src/PCS_moduleLib_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_moduleLib_handlers.c index 984f9f87..9899efc4 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_moduleLib_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_moduleLib_handlers.c @@ -53,8 +53,8 @@ void UT_DefaultHandler_PCS_moduleInfoGet(void *UserObj, UT_EntryKey_t FuncKey, c UT_Stub_GetInt32StatusCode(Context, &Status); - if (Status >= 0 && - UT_Stub_CopyToLocal(UT_KEY(PCS_moduleInfoGet), pModuleInfo, sizeof(*pModuleInfo)) < sizeof(*pModuleInfo)) + if (Status >= 0 + && UT_Stub_CopyToLocal(UT_KEY(PCS_moduleInfoGet), pModuleInfo, sizeof(*pModuleInfo)) < sizeof(*pModuleInfo)) { memset(pModuleInfo, 0, sizeof(*pModuleInfo)); } diff --git a/unit-test-coverage/ut-stubs/src/PCS_spyLibP_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_spyLibP_stubs.c index 85e703f0..f47fdf7b 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_spyLibP_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_spyLibP_stubs.c @@ -49,7 +49,6 @@ int PCS_spyClkStartCommon(int intsPerSec, PCS_FUNCPTR print) */ void PCS_spyClkStopCommon(void) { - UT_GenStub_Execute(PCS_spyClkStopCommon, Basic, NULL); } diff --git a/unit-test-coverage/ut-stubs/src/PCS_stdio_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_stdio_handlers.c index 70d46dfd..2d1fc144 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_stdio_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_stdio_handlers.c @@ -39,7 +39,7 @@ void UT_DefaultHandler_PCS_fgets(void *UserObj, UT_EntryKey_t FuncKey, const UT_ int32 Status; uint32 CopySize; - void * DataBufferPtr; + void *DataBufferPtr; Status = 0; UT_GetDataBuffer(FuncKey, &DataBufferPtr, NULL, NULL); @@ -89,8 +89,8 @@ void UT_DefaultHandler_PCS_fgets(void *UserObj, UT_EntryKey_t FuncKey, const UT_ void UT_DefaultHandler_PCS_fopen(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* PCS_FILE *PCS_fopen(const char *filename, const char *modes) */ - PCS_FILE * retval; - static PCS_FILE FOPEN_FP = {0}; + PCS_FILE *retval; + static PCS_FILE FOPEN_FP = { 0 }; if (!UT_Stub_GetInt32StatusCode(Context, NULL)) { @@ -99,11 +99,13 @@ void UT_DefaultHandler_PCS_fopen(void *UserObj, UT_EntryKey_t FuncKey, const UT_ } } -void UT_DefaultHandler_PCS_snprintf(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context, - va_list ArgList) +void UT_DefaultHandler_PCS_snprintf(void *UserObj, + UT_EntryKey_t FuncKey, + const UT_StubContext_t *Context, + va_list ArgList) { /* int PCS_snprintf(char *s, size_t maxlen, const char *format, ...) */ - char * s = UT_Hook_GetArgValueByName(Context, "s", char *); + char *s = UT_Hook_GetArgValueByName(Context, "s", char *); size_t maxlen = UT_Hook_GetArgValueByName(Context, "maxlen", size_t); const char *format = UT_Hook_GetArgValueByName(Context, "format", const char *); int32 status; @@ -129,7 +131,7 @@ void UT_DefaultHandler_PCS_snprintf(void *UserObj, UT_EntryKey_t FuncKey, const void UT_DefaultHandler_PCS_vsnprintf(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* int PCS_vsnprintf(char *s, size_t maxlen, const char *format, PCS_va_list arg) */ - char * s = UT_Hook_GetArgValueByName(Context, "s", char *); + char *s = UT_Hook_GetArgValueByName(Context, "s", char *); size_t maxlen = UT_Hook_GetArgValueByName(Context, "maxlen", size_t); const char *format = UT_Hook_GetArgValueByName(Context, "format", const char *); @@ -144,7 +146,7 @@ void UT_DefaultHandler_PCS_vsnprintf(void *UserObj, UT_EntryKey_t FuncKey, const } } -static PCS_FILE LOCAL_FP[3] = {{10}, {11}, {12}}; +static PCS_FILE LOCAL_FP[3] = { { 10 }, { 11 }, { 12 } }; PCS_FILE *PCS_stdin = &LOCAL_FP[0]; PCS_FILE *PCS_stdout = &LOCAL_FP[1]; diff --git a/unit-test-coverage/ut-stubs/src/PCS_stdlib_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_stdlib_handlers.c index 2beef5ed..6a583ae5 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_stdlib_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_stdlib_handlers.c @@ -48,7 +48,7 @@ void UT_DefaultHandler_PCS_strtoul(void *UserObj, UT_EntryKey_t FuncKey, const U { /* unsigned long int PCS_strtoul(const char *nptr, char **endptr, int base) */ const char *nptr = UT_Hook_GetArgValueByName(Context, "nptr", const char *); - char ** endptr = UT_Hook_GetArgValueByName(Context, "endptr", char **); + char **endptr = UT_Hook_GetArgValueByName(Context, "endptr", char **); int base = UT_Hook_GetArgValueByName(Context, "base", int); unsigned long Result; @@ -67,14 +67,14 @@ void UT_DefaultHandler_PCS_malloc(void *UserObj, UT_EntryKey_t FuncKey, const UT size_t sz = UT_Hook_GetArgValueByName(Context, "sz", size_t); int32 Status; - void * PoolPtr; + void *PoolPtr; cpuaddr PoolStart; cpuaddr PoolEnd; cpuaddr NextBlock; size_t NextSize; size_t PoolSize; uint32 CallCnt; - void * BlockPtr; + void *BlockPtr; struct MPOOL_REC *Rec; Rec = NULL; @@ -95,9 +95,9 @@ void UT_DefaultHandler_PCS_malloc(void *UserObj, UT_EntryKey_t FuncKey, const UT */ if (PoolSize > (MPOOL_ALIGN * 2) && PoolStart < PoolEnd) { - Rec = (struct MPOOL_REC *)PoolStart; - NextBlock = PoolStart + MPOOL_ALIGN; - PoolSize -= MPOOL_ALIGN; + Rec = (struct MPOOL_REC *)PoolStart; + NextBlock = PoolStart + MPOOL_ALIGN; + PoolSize -= MPOOL_ALIGN; if (CallCnt == 1) { Rec->Magic = MPOOL_START_SIGNATURE; @@ -128,10 +128,10 @@ void UT_DefaultHandler_PCS_malloc(void *UserObj, UT_EntryKey_t FuncKey, const UT } else { - NextSize = (NextSize + MPOOL_ALIGN - 1) & ~((size_t)MPOOL_ALIGN - 1); - NextBlock = Rec->BlockAddr + MPOOL_ALIGN; + NextSize = (NextSize + MPOOL_ALIGN - 1) & ~((size_t)MPOOL_ALIGN - 1); + NextBlock = Rec->BlockAddr + MPOOL_ALIGN; Rec->BlockAddr += NextSize; - Rec->Size += NextSize; + Rec->Size += NextSize; Rec = (struct MPOOL_REC *)(NextBlock - sizeof(struct MPOOL_REC)); Rec->BlockAddr = NextBlock; @@ -152,7 +152,7 @@ void UT_DefaultHandler_PCS_free(void *UserObj, UT_EntryKey_t FuncKey, const UT_S int32 Status; cpuaddr BlockAddr; - void * PoolPtr; + void *PoolPtr; size_t PoolSize; struct MPOOL_REC *Rec; diff --git a/unit-test-coverage/ut-stubs/src/PCS_stdlib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_stdlib_stubs.c index 4658f402..e3caa956 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_stdlib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_stdlib_stubs.c @@ -36,7 +36,6 @@ void UT_DefaultHandler_PCS_strtoul(void *, UT_EntryKey_t, const UT_StubContext_t */ void PCS_abort(void) { - UT_GenStub_Execute(PCS_abort, Basic, NULL); } diff --git a/unit-test-coverage/ut-stubs/src/PCS_string_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_string_handlers.c index 7b57087d..ba3976bf 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_string_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_string_handlers.c @@ -35,7 +35,7 @@ void UT_DefaultHandler_PCS_memset(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* void *PCS_memset(void *s, int c, size_t n) */ - void * s = UT_Hook_GetArgValueByName(Context, "s", void *); + void *s = UT_Hook_GetArgValueByName(Context, "s", void *); int c = UT_Hook_GetArgValueByName(Context, "c", int); size_t n = UT_Hook_GetArgValueByName(Context, "n", size_t); @@ -52,7 +52,7 @@ void UT_DefaultHandler_PCS_memset(void *UserObj, UT_EntryKey_t FuncKey, const UT void UT_DefaultHandler_PCS_memcpy(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* void *PCS_memcpy(void *dest, const void *src, size_t n) */ - void * dest = UT_Hook_GetArgValueByName(Context, "dest", void *); + void *dest = UT_Hook_GetArgValueByName(Context, "dest", void *); const void *src = UT_Hook_GetArgValueByName(Context, "src", const void *); size_t n = UT_Hook_GetArgValueByName(Context, "n", size_t); @@ -69,7 +69,7 @@ void UT_DefaultHandler_PCS_memcpy(void *UserObj, UT_EntryKey_t FuncKey, const UT void UT_DefaultHandler_PCS_memchr(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* void * PCS_memchr(const void *s, int c, size_t n) */ - void * s = UT_Hook_GetArgValueByName(Context, "s", void *); + void *s = UT_Hook_GetArgValueByName(Context, "s", void *); int c = UT_Hook_GetArgValueByName(Context, "c", int); size_t n = UT_Hook_GetArgValueByName(Context, "n", size_t); @@ -86,7 +86,7 @@ void UT_DefaultHandler_PCS_memchr(void *UserObj, UT_EntryKey_t FuncKey, const UT void UT_DefaultHandler_PCS_memcmp(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* int PCS_memcmp(void *dest, const void *src, size_t n) */ - void * dest = UT_Hook_GetArgValueByName(Context, "dest", void *); + void *dest = UT_Hook_GetArgValueByName(Context, "dest", void *); const void *src = UT_Hook_GetArgValueByName(Context, "src", const void *); size_t n = UT_Hook_GetArgValueByName(Context, "n", size_t); @@ -150,7 +150,7 @@ void UT_DefaultHandler_PCS_strlen(void *UserObj, UT_EntryKey_t FuncKey, const UT void UT_DefaultHandler_PCS_strcat(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* char *PCS_strcat(char *dest, const char *src) */ - void * dest = UT_Hook_GetArgValueByName(Context, "dest", void *); + void *dest = UT_Hook_GetArgValueByName(Context, "dest", void *); const void *src = UT_Hook_GetArgValueByName(Context, "src", const void *); char *Result; @@ -166,9 +166,9 @@ void UT_DefaultHandler_PCS_strcat(void *UserObj, UT_EntryKey_t FuncKey, const UT void UT_DefaultHandler_PCS_strncat(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* char *PCS_strncat(char *dest, const char *src, size_t n) */ - void * dest = UT_Hook_GetArgValueByName(Context, "dest", void *); + void *dest = UT_Hook_GetArgValueByName(Context, "dest", void *); const void *src = UT_Hook_GetArgValueByName(Context, "src", const void *); - size_t n = UT_Hook_GetArgValueByName(Context, "n", size_t); + size_t n = UT_Hook_GetArgValueByName(Context, "n", size_t); char *Result; @@ -216,8 +216,8 @@ void UT_DefaultHandler_PCS_strcmp(void *UserObj, UT_EntryKey_t FuncKey, const UT void UT_DefaultHandler_PCS_strcpy(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* char *PCS_strcpy(char *dest, const char *src) */ - char * dest = UT_Hook_GetArgValueByName(Context, "dest", char *); - const char *src = UT_Hook_GetArgValueByName(Context, "src", const char *); + char *dest = UT_Hook_GetArgValueByName(Context, "dest", char *); + const char *src = UT_Hook_GetArgValueByName(Context, "src", const char *); char *Result; @@ -232,9 +232,9 @@ void UT_DefaultHandler_PCS_strcpy(void *UserObj, UT_EntryKey_t FuncKey, const UT void UT_DefaultHandler_PCS_strncpy(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* char *PCS_strncpy(char *dest, const char *src, size_t n) */ - char * dest = UT_Hook_GetArgValueByName(Context, "dest", char *); + char *dest = UT_Hook_GetArgValueByName(Context, "dest", char *); const char *src = UT_Hook_GetArgValueByName(Context, "src", const char *); - size_t n = UT_Hook_GetArgValueByName(Context, "n", size_t); + size_t n = UT_Hook_GetArgValueByName(Context, "n", size_t); char *Result; @@ -252,7 +252,7 @@ void UT_DefaultHandler_PCS_strerror(void *UserObj, UT_EntryKey_t FuncKey, const int errnum = UT_Hook_GetArgValueByName(Context, "errnum", int); static char str[16]; - char * ret = str; + char *ret = str; if (!UT_Stub_GetInt32StatusCode(Context, NULL)) { diff --git a/unit-test-coverage/ut-stubs/src/PCS_sysApi_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_sysApi_stubs.c index 5dca11a1..96827995 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sysApi_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sysApi_stubs.c @@ -92,7 +92,6 @@ PCS_SP0_BOARD_GENERATION_TYPE PCS_sysGetBoardGeneration(bool talkative) */ void PCS_sysPulseFpgaWdt(void) { - UT_GenStub_Execute(PCS_sysPulseFpgaWdt, Basic, NULL); } diff --git a/unit-test-coverage/ut-stubs/src/PCS_sys_socket_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_sys_socket_handlers.c index 251e0b80..882b6e20 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sys_socket_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sys_socket_handlers.c @@ -27,7 +27,7 @@ void UT_DefaultHandler_PCS_recvfrom(void *UserObj, UT_EntryKey_t FuncKey, const { /* PCS_ssize_t PCS_recvfrom(int fd, void *buf, size_t n, int flags, struct PCS_sockaddr *addr, PCS_socklen_t * *addr_len) */ - void * buf = UT_Hook_GetArgValueByName(Context, "buf", void *); + void *buf = UT_Hook_GetArgValueByName(Context, "buf", void *); size_t n = UT_Hook_GetArgValueByName(Context, "n", size_t); int32 iStatus; diff --git a/unit-test-coverage/ut-stubs/src/PCS_sys_socket_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_sys_socket_stubs.c index d727f9fd..7ed129dd 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sys_socket_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sys_socket_stubs.c @@ -144,8 +144,8 @@ PCS_ssize_t PCS_recvfrom(int fd, void *buf, size_t n, int flags, struct PCS_sock * Generated stub function for PCS_sendto() * ---------------------------------------------------- */ -PCS_ssize_t PCS_sendto(int fd, const void *buf, size_t n, int flags, const struct PCS_sockaddr *addr, - PCS_socklen_t addr_len) +PCS_ssize_t +PCS_sendto(int fd, const void *buf, size_t n, int flags, const struct PCS_sockaddr *addr, PCS_socklen_t addr_len) { UT_GenStub_SetupReturnBuffer(PCS_sendto, PCS_ssize_t); diff --git a/unit-test-coverage/ut-stubs/src/PCS_taskLib_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_taskLib_handlers.c index e1d58c4a..9c7db376 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_taskLib_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_taskLib_handlers.c @@ -24,12 +24,12 @@ #include "PCS_taskLib.h" #include "PCS_errnoLib.h" -static PCS_WIND_TCB PCS_LOCAL_TASK = {0}; +static PCS_WIND_TCB PCS_LOCAL_TASK = { 0 }; void UT_DefaultHandler_PCS_taskPriorityGet(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* PCS_STATUS PCS_taskPriorityGet(PCS_TASK_ID tid, int *pPriority) */ - int * pPriority = UT_Hook_GetArgValueByName(Context, "pPriority", int *); + int *pPriority = UT_Hook_GetArgValueByName(Context, "pPriority", int *); int32 iStatus; UT_Stub_GetInt32StatusCode(Context, &iStatus); @@ -44,7 +44,7 @@ void UT_DefaultHandler_PCS_taskName(void *UserObj, UT_EntryKey_t FuncKey, const /* const char *PCS_taskName(PCS_TASK_ID task_id) */ const char *retval; - void * bufptr; + void *bufptr; size_t bufsz; int32 status; diff --git a/unit-test-coverage/ut-stubs/src/PCS_taskLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_taskLib_stubs.c index fefba218..a60ce356 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_taskLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_taskLib_stubs.c @@ -160,9 +160,23 @@ PCS_TASK_ID PCS_taskIdSelf(void) * Generated stub function for PCS_taskInit() * ---------------------------------------------------- */ -PCS_STATUS PCS_taskInit(PCS_WIND_TCB *pTcb, char *name, int priority, int options, char *pStackBase, int stackSize, - PCS_FUNCPTR entryPt, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, - int arg8, int arg9, int arg10) +PCS_STATUS PCS_taskInit(PCS_WIND_TCB *pTcb, + char *name, + int priority, + int options, + char *pStackBase, + int stackSize, + PCS_FUNCPTR entryPt, + int arg1, + int arg2, + int arg3, + int arg4, + int arg5, + int arg6, + int arg7, + int arg8, + int arg9, + int arg10) { UT_GenStub_SetupReturnBuffer(PCS_taskInit, PCS_STATUS); @@ -308,8 +322,21 @@ PCS_STATUS PCS_taskResume(PCS_TASK_ID tid) * Generated stub function for PCS_taskSpawn() * ---------------------------------------------------- */ -PCS_TASK_ID PCS_taskSpawn(char *name, int priority, int options, int stackSize, PCS_FUNCPTR entryPt, int arg1, int arg2, - int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10) +PCS_TASK_ID PCS_taskSpawn(char *name, + int priority, + int options, + int stackSize, + PCS_FUNCPTR entryPt, + int arg1, + int arg2, + int arg3, + int arg4, + int arg5, + int arg6, + int arg7, + int arg8, + int arg9, + int arg10) { UT_GenStub_SetupReturnBuffer(PCS_taskSpawn, PCS_TASK_ID); diff --git a/unit-test-coverage/ut-stubs/src/PCS_tasks_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_tasks_stubs.c index 45ecc199..fa4fe145 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_tasks_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_tasks_stubs.c @@ -30,9 +30,12 @@ * Generated stub function for PCS_rtems_task_create() * ---------------------------------------------------- */ -PCS_rtems_status_code PCS_rtems_task_create(PCS_rtems_name name, PCS_rtems_task_priority initial_priority, - size_t stack_size, PCS_rtems_mode initial_modes, - PCS_rtems_attribute attribute_set, PCS_rtems_id *id) +PCS_rtems_status_code PCS_rtems_task_create(PCS_rtems_name name, + PCS_rtems_task_priority initial_priority, + size_t stack_size, + PCS_rtems_mode initial_modes, + PCS_rtems_attribute attribute_set, + PCS_rtems_id *id) { UT_GenStub_SetupReturnBuffer(PCS_rtems_task_create, PCS_rtems_status_code); @@ -82,8 +85,8 @@ void PCS_rtems_task_iterate(PCS_rtems_task_visitor visitor, void *arg) * Generated stub function for PCS_rtems_task_start() * ---------------------------------------------------- */ -PCS_rtems_status_code PCS_rtems_task_start(PCS_rtems_id id, PCS_rtems_task_entry entry_point, - PCS_rtems_task_argument argument) +PCS_rtems_status_code +PCS_rtems_task_start(PCS_rtems_id id, PCS_rtems_task_entry entry_point, PCS_rtems_task_argument argument) { UT_GenStub_SetupReturnBuffer(PCS_rtems_task_start, PCS_rtems_status_code); diff --git a/unit-test-coverage/ut-stubs/src/PCS_timestampimpl_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_timestampimpl_stubs.c index dc3855d0..945ed1e8 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_timestampimpl_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_timestampimpl_stubs.c @@ -30,8 +30,10 @@ * Generated stub function for PCS_Timestamp_Divide() * ---------------------------------------------------- */ -void PCS_Timestamp_Divide(const PCS_Timestamp_Control *_lhs, const PCS_Timestamp_Control *_rhs, - uint32_t *_ival_percentage, uint32_t *_fval_percentage) +void PCS_Timestamp_Divide(const PCS_Timestamp_Control *_lhs, + const PCS_Timestamp_Control *_rhs, + uint32_t *_ival_percentage, + uint32_t *_fval_percentage) { UT_GenStub_AddParam(PCS_Timestamp_Divide, const PCS_Timestamp_Control *, _lhs); UT_GenStub_AddParam(PCS_Timestamp_Divide, const PCS_Timestamp_Control *, _rhs); @@ -46,8 +48,9 @@ void PCS_Timestamp_Divide(const PCS_Timestamp_Control *_lhs, const PCS_Timestamp * Generated stub function for PCS_Timestamp_Subtract() * ---------------------------------------------------- */ -void PCS_Timestamp_Subtract(const PCS_Timestamp_Control *_start, const PCS_Timestamp_Control *_end, - PCS_Timestamp_Control *_result) +void PCS_Timestamp_Subtract(const PCS_Timestamp_Control *_start, + const PCS_Timestamp_Control *_end, + PCS_Timestamp_Control *_result) { UT_GenStub_AddParam(PCS_Timestamp_Subtract, const PCS_Timestamp_Control *, _start); UT_GenStub_AddParam(PCS_Timestamp_Subtract, const PCS_Timestamp_Control *, _end); diff --git a/unit-test-coverage/ut-stubs/src/PCS_unistd_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_unistd_handlers.c index b2b09120..fcea129f 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_unistd_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_unistd_handlers.c @@ -50,7 +50,7 @@ void UT_DefaultHandler_PCS_gethostname(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* int PCS_gethostname(char *name, size_t len) */ - char * name = UT_Hook_GetArgValueByName(Context, "name", char *); + char *name = UT_Hook_GetArgValueByName(Context, "name", char *); size_t len = UT_Hook_GetArgValueByName(Context, "len", size_t); int32 Status; @@ -66,7 +66,7 @@ void UT_DefaultHandler_PCS_gethostname(void *UserObj, UT_EntryKey_t FuncKey, con void UT_DefaultHandler_PCS_read(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* PCS_ssize_t PCS_read(int fd, void *buf, size_t nbytes) */ - void * buf = UT_Hook_GetArgValueByName(Context, "buf", void *); + void *buf = UT_Hook_GetArgValueByName(Context, "buf", void *); size_t nbytes = UT_Hook_GetArgValueByName(Context, "nbytes", size_t); int32 Status; size_t CopySize; diff --git a/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c b/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c index 9d0b020d..1197d70a 100644 --- a/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c +++ b/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c @@ -27,7 +27,7 @@ #include "PCS_cfe_configdata.h" -CFE_StaticModuleLoadEntry_t CFE_PSP_BASE_MODULE_LIST[] = {{NULL}}; +CFE_StaticModuleLoadEntry_t CFE_PSP_BASE_MODULE_LIST[] = { { NULL } }; Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = { @@ -44,18 +44,19 @@ Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = { /** * Notification function. Called from PSP after async event handling. */ - .SystemNotify = PCS_SystemNotify}; + .SystemNotify = PCS_SystemNotify +}; -Target_ConfigData GLOBAL_CONFIGDATA = {.MissionVersion = PCS_CONFIG_MISSIONVERSION, - .CfeVersion = PCS_CONFIG_CFEVERSION, - .OsalVersion = PCS_CONFIG_OSALVERSION, - .Config = PCS_CONFIG_CONFIGSTR, - .Date = PCS_CONFIG_DATESTR, - .User = PCS_CONFIG_USERSTR, - .Default_CpuName = PCS_CONFIG_CPUNAME, - .Default_CpuId = PCS_CONFIG_CPUNUMBER, - .Default_SpacecraftId = PCS_CONFIG_SPACECRAFT, - .CfeConfig = &GLOBAL_CFE_CONFIGDATA}; +Target_ConfigData GLOBAL_CONFIGDATA = { .MissionVersion = PCS_CONFIG_MISSIONVERSION, + .CfeVersion = PCS_CONFIG_CFEVERSION, + .OsalVersion = PCS_CONFIG_OSALVERSION, + .Config = PCS_CONFIG_CONFIGSTR, + .Date = PCS_CONFIG_DATESTR, + .User = PCS_CONFIG_USERSTR, + .Default_CpuName = PCS_CONFIG_CPUNAME, + .Default_CpuId = PCS_CONFIG_CPUNUMBER, + .Default_SpacecraftId = PCS_CONFIG_SPACECRAFT, + .CfeConfig = &GLOBAL_CFE_CONFIGDATA }; /** * Stub for the main system entry function implemented in CFE ES diff --git a/unit-test-coverage/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c b/unit-test-coverage/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c index 6db738c1..9e6ff46a 100644 --- a/unit-test-coverage/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c +++ b/unit-test-coverage/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c @@ -30,8 +30,9 @@ * Generated stub function for CFE_PSP_ExceptionGetSummary_Impl() * ---------------------------------------------------- */ -int32 CFE_PSP_ExceptionGetSummary_Impl(const struct CFE_PSP_Exception_LogData *Buffer, char *ReasonBuf, - uint32 ReasonSize) +int32 CFE_PSP_ExceptionGetSummary_Impl(const struct CFE_PSP_Exception_LogData *Buffer, + char *ReasonBuf, + uint32 ReasonSize) { UT_GenStub_SetupReturnBuffer(CFE_PSP_ExceptionGetSummary_Impl, int32); @@ -81,7 +82,6 @@ struct CFE_PSP_Exception_LogData *CFE_PSP_Exception_GetNextContextBuffer(void) */ void CFE_PSP_Exception_Reset(void) { - UT_GenStub_Execute(CFE_PSP_Exception_Reset, Basic, NULL); } @@ -92,6 +92,5 @@ void CFE_PSP_Exception_Reset(void) */ void CFE_PSP_Exception_WriteComplete(void) { - UT_GenStub_Execute(CFE_PSP_Exception_WriteComplete, Basic, NULL); } diff --git a/unit-test-coverage/ut-stubs/src/cfe_psp_memory_stubs.c b/unit-test-coverage/ut-stubs/src/cfe_psp_memory_stubs.c index 5aa3f0ed..355f70aa 100644 --- a/unit-test-coverage/ut-stubs/src/cfe_psp_memory_stubs.c +++ b/unit-test-coverage/ut-stubs/src/cfe_psp_memory_stubs.c @@ -32,7 +32,6 @@ */ void CFE_PSP_DeleteProcessorReservedMemory(void) { - UT_GenStub_Execute(CFE_PSP_DeleteProcessorReservedMemory, Basic, NULL); } @@ -59,6 +58,5 @@ int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) */ void CFE_PSP_SetupReservedMemoryMap(void) { - UT_GenStub_Execute(CFE_PSP_SetupReservedMemoryMap, Basic, NULL); } diff --git a/unit-test-coverage/ut-stubs/src/cfe_psp_module_stubs.c b/unit-test-coverage/ut-stubs/src/cfe_psp_module_stubs.c index 8d6f1a70..02546ba1 100644 --- a/unit-test-coverage/ut-stubs/src/cfe_psp_module_stubs.c +++ b/unit-test-coverage/ut-stubs/src/cfe_psp_module_stubs.c @@ -32,7 +32,6 @@ */ void CFE_PSP_ModuleInit(void) { - UT_GenStub_Execute(CFE_PSP_ModuleInit, Basic, NULL); } diff --git a/ut-stubs/src/cfe_psp_cds_api_handlers.c b/ut-stubs/src/cfe_psp_cds_api_handlers.c index c061428a..0f36f131 100644 --- a/ut-stubs/src/cfe_psp_cds_api_handlers.c +++ b/ut-stubs/src/cfe_psp_cds_api_handlers.c @@ -98,7 +98,7 @@ void UT_DefaultHandler_CFE_PSP_WriteToCDS(void *UserObj, UT_EntryKey_t FuncKey, void UT_DefaultHandler_CFE_PSP_ReadFromCDS(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* int32 CFE_PSP_ReadFromCDS(void *PtrToDataFromRead, uint32 CDSOffset, uint32 NumBytes) */ - void * PtrToDataFromRead = UT_Hook_GetArgValueByName(Context, "PtrToDataFromRead", void *); + void *PtrToDataFromRead = UT_Hook_GetArgValueByName(Context, "PtrToDataFromRead", void *); uint32 CDSOffset = UT_Hook_GetArgValueByName(Context, "CDSOffset", uint32); uint32 NumBytes = UT_Hook_GetArgValueByName(Context, "NumBytes", uint32); diff --git a/ut-stubs/src/cfe_psp_exception_api_handlers.c b/ut-stubs/src/cfe_psp_exception_api_handlers.c index 3efdafec..7af4b93f 100644 --- a/ut-stubs/src/cfe_psp_exception_api_handlers.c +++ b/ut-stubs/src/cfe_psp_exception_api_handlers.c @@ -37,14 +37,15 @@ #include "target_config.h" -void UT_DefaultHandler_CFE_PSP_Exception_GetSummary(void *UserObj, UT_EntryKey_t FuncKey, +void UT_DefaultHandler_CFE_PSP_Exception_GetSummary(void *UserObj, + UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char *ReasonBuf, uint32 ReasonSize) */ - uint32 * ContextLogId = UT_Hook_GetArgValueByName(Context, "ContextLogId", uint32 *); + uint32 *ContextLogId = UT_Hook_GetArgValueByName(Context, "ContextLogId", uint32 *); osal_id_t *TaskId = UT_Hook_GetArgValueByName(Context, "TaskId", osal_id_t *); - char * ReasonBuf = UT_Hook_GetArgValueByName(Context, "ReasonBuf", char *); + char *ReasonBuf = UT_Hook_GetArgValueByName(Context, "ReasonBuf", char *); uint32 ReasonSize = UT_Hook_GetArgValueByName(Context, "ReasonSize", uint32); int32 status; @@ -73,11 +74,12 @@ void UT_DefaultHandler_CFE_PSP_Exception_GetSummary(void *UserObj, UT_EntryKey_t } } -void UT_DefaultHandler_CFE_PSP_Exception_CopyContext(void *UserObj, UT_EntryKey_t FuncKey, +void UT_DefaultHandler_CFE_PSP_Exception_CopyContext(void *UserObj, + UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint32 ContextSize) */ - void * ContextBuf = UT_Hook_GetArgValueByName(Context, "ContextBuf", void *); + void *ContextBuf = UT_Hook_GetArgValueByName(Context, "ContextBuf", void *); uint32 ContextSize = UT_Hook_GetArgValueByName(Context, "ContextSize", uint32); int32 status; diff --git a/ut-stubs/src/cfe_psp_exception_api_stubs.c b/ut-stubs/src/cfe_psp_exception_api_stubs.c index fd89d032..c3a39e03 100644 --- a/ut-stubs/src/cfe_psp_exception_api_stubs.c +++ b/ut-stubs/src/cfe_psp_exception_api_stubs.c @@ -35,7 +35,6 @@ void UT_DefaultHandler_CFE_PSP_Exception_GetSummary(void *, UT_EntryKey_t, const */ void CFE_PSP_AttachExceptions(void) { - UT_GenStub_Execute(CFE_PSP_AttachExceptions, Basic, NULL); } @@ -97,6 +96,5 @@ int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char */ void CFE_PSP_SetDefaultExceptionEnvironment(void) { - UT_GenStub_Execute(CFE_PSP_SetDefaultExceptionEnvironment, Basic, NULL); } diff --git a/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c b/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c index 6db738c1..9e6ff46a 100644 --- a/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c +++ b/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c @@ -30,8 +30,9 @@ * Generated stub function for CFE_PSP_ExceptionGetSummary_Impl() * ---------------------------------------------------- */ -int32 CFE_PSP_ExceptionGetSummary_Impl(const struct CFE_PSP_Exception_LogData *Buffer, char *ReasonBuf, - uint32 ReasonSize) +int32 CFE_PSP_ExceptionGetSummary_Impl(const struct CFE_PSP_Exception_LogData *Buffer, + char *ReasonBuf, + uint32 ReasonSize) { UT_GenStub_SetupReturnBuffer(CFE_PSP_ExceptionGetSummary_Impl, int32); @@ -81,7 +82,6 @@ struct CFE_PSP_Exception_LogData *CFE_PSP_Exception_GetNextContextBuffer(void) */ void CFE_PSP_Exception_Reset(void) { - UT_GenStub_Execute(CFE_PSP_Exception_Reset, Basic, NULL); } @@ -92,6 +92,5 @@ void CFE_PSP_Exception_Reset(void) */ void CFE_PSP_Exception_WriteComplete(void) { - UT_GenStub_Execute(CFE_PSP_Exception_WriteComplete, Basic, NULL); } diff --git a/ut-stubs/src/cfe_psp_globaldata_stubs.c b/ut-stubs/src/cfe_psp_globaldata_stubs.c index 85aafd1b..fd2511e9 100644 --- a/ut-stubs/src/cfe_psp_globaldata_stubs.c +++ b/ut-stubs/src/cfe_psp_globaldata_stubs.c @@ -35,7 +35,7 @@ #include "target_config.h" -Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = {0}; +Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = { 0 }; /** * Instantiation of global system-wide configuration struct @@ -43,13 +43,13 @@ Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = {0}; * configuration structures. Everything will be linked together * in the final executable. */ -Target_ConfigData GLOBAL_CONFIGDATA = {.MissionVersion = "MissionUnitTest", - .CfeVersion = "CfeUnitTest", - .OsalVersion = "OsalUnitTest", - .Config = "MissionConfig", - .Date = "MissionBuildDate", - .User = "MissionBuildUser", - .Default_CpuName = "UnitTestCpu", - .Default_CpuId = 1, - .Default_SpacecraftId = 0x42, - .CfeConfig = &GLOBAL_CFE_CONFIGDATA}; +Target_ConfigData GLOBAL_CONFIGDATA = { .MissionVersion = "MissionUnitTest", + .CfeVersion = "CfeUnitTest", + .OsalVersion = "OsalUnitTest", + .Config = "MissionConfig", + .Date = "MissionBuildDate", + .User = "MissionBuildUser", + .Default_CpuName = "UnitTestCpu", + .Default_CpuId = 1, + .Default_SpacecraftId = 0x42, + .CfeConfig = &GLOBAL_CFE_CONFIGDATA }; diff --git a/ut-stubs/src/cfe_psp_id_api_handlers.c b/ut-stubs/src/cfe_psp_id_api_handlers.c index b81c00fb..60d54cde 100644 --- a/ut-stubs/src/cfe_psp_id_api_handlers.c +++ b/ut-stubs/src/cfe_psp_id_api_handlers.c @@ -39,7 +39,7 @@ void UT_DefaultHandler_CFE_PSP_GetProcessorName(void *UserObj, UT_EntryKey_t Fun { /* const char *CFE_PSP_GetProcessorName(void) */ static const char default_retval[] = "UT"; - const char * ptr; + const char *ptr; int32 status; diff --git a/ut-stubs/src/cfe_psp_memaccess_api_handlers.c b/ut-stubs/src/cfe_psp_memaccess_api_handlers.c index 9616b18c..dd0b68ea 100644 --- a/ut-stubs/src/cfe_psp_memaccess_api_handlers.c +++ b/ut-stubs/src/cfe_psp_memaccess_api_handlers.c @@ -43,7 +43,7 @@ void UT_DefaultHandler_CFE_PSP_MemCpy(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* CFE_PSP_MemCpy(void *dest, const void *src, uint32 n) */ - void * dest = UT_Hook_GetArgValueByName(Context, "dest", void *); + void *dest = UT_Hook_GetArgValueByName(Context, "dest", void *); const void *src = UT_Hook_GetArgValueByName(Context, "src", const void *); uint32 n = UT_Hook_GetArgValueByName(Context, "n", uint32); int32 Status; @@ -63,7 +63,7 @@ void UT_DefaultHandler_CFE_PSP_MemCpy(void *UserObj, UT_EntryKey_t FuncKey, cons void UT_DefaultHandler_CFE_PSP_MemSet(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* int32 CFE_PSP_MemSet(void *dest, uint8 value, uint32 n) */ - void * dest = UT_Hook_GetArgValueByName(Context, "dest", void *); + void *dest = UT_Hook_GetArgValueByName(Context, "dest", void *); uint8 value = UT_Hook_GetArgValueByName(Context, "value", uint8); uint32 n = UT_Hook_GetArgValueByName(Context, "n", uint32); int32 Status; diff --git a/ut-stubs/src/cfe_psp_memory_stubs.c b/ut-stubs/src/cfe_psp_memory_stubs.c index 5aa3f0ed..355f70aa 100644 --- a/ut-stubs/src/cfe_psp_memory_stubs.c +++ b/ut-stubs/src/cfe_psp_memory_stubs.c @@ -32,7 +32,6 @@ */ void CFE_PSP_DeleteProcessorReservedMemory(void) { - UT_GenStub_Execute(CFE_PSP_DeleteProcessorReservedMemory, Basic, NULL); } @@ -59,6 +58,5 @@ int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) */ void CFE_PSP_SetupReservedMemoryMap(void) { - UT_GenStub_Execute(CFE_PSP_SetupReservedMemoryMap, Basic, NULL); } diff --git a/ut-stubs/src/cfe_psp_memrange_api_handlers.c b/ut-stubs/src/cfe_psp_memrange_api_handlers.c index 1437df25..5f7cfdca 100644 --- a/ut-stubs/src/cfe_psp_memrange_api_handlers.c +++ b/ut-stubs/src/cfe_psp_memrange_api_handlers.c @@ -43,11 +43,11 @@ void UT_DefaultHandler_CFE_PSP_GetResetArea(void *UserObj, UT_EntryKey_t FuncKey { /* int32 CFE_PSP_GetResetArea() */ cpuaddr *PtrToResetArea = UT_Hook_GetArgValueByName(Context, "PtrToResetArea", cpuaddr *); - uint32 * SizeOfResetArea = UT_Hook_GetArgValueByName(Context, "SizeOfResetArea", uint32 *); + uint32 *SizeOfResetArea = UT_Hook_GetArgValueByName(Context, "SizeOfResetArea", uint32 *); int32 status; size_t TempSize; - void * TempAddr; + void *TempAddr; UT_Stub_GetInt32StatusCode(Context, &status); @@ -64,11 +64,11 @@ void UT_DefaultHandler_CFE_PSP_GetVolatileDiskMem(void *UserObj, UT_EntryKey_t F { /* int32 CFE_PSP_GetVolatileDiskMem() */ cpuaddr *PtrToVolDisk = UT_Hook_GetArgValueByName(Context, "PtrToVolDisk", cpuaddr *); - uint32 * SizeOfVolDisk = UT_Hook_GetArgValueByName(Context, "SizeOfVolDisk", uint32 *); + uint32 *SizeOfVolDisk = UT_Hook_GetArgValueByName(Context, "SizeOfVolDisk", uint32 *); int32 status; size_t TempSize; - void * TempAddr; + void *TempAddr; UT_Stub_GetInt32StatusCode(Context, &status); @@ -81,16 +81,17 @@ void UT_DefaultHandler_CFE_PSP_GetVolatileDiskMem(void *UserObj, UT_EntryKey_t F } } -void UT_DefaultHandler_CFE_PSP_GetCFETextSegmentInfo(void *UserObj, UT_EntryKey_t FuncKey, +void UT_DefaultHandler_CFE_PSP_GetCFETextSegmentInfo(void *UserObj, + UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* int32 CFE_PSP_GetCFETextSegmentInfo() */ cpuaddr *PtrToCFESegment = UT_Hook_GetArgValueByName(Context, "PtrToCFESegment", cpuaddr *); - uint32 * SizeOfCFESegment = UT_Hook_GetArgValueByName(Context, "SizeOfCFESegment", uint32 *); + uint32 *SizeOfCFESegment = UT_Hook_GetArgValueByName(Context, "SizeOfCFESegment", uint32 *); static uint32 LocalTextSegment; int32 status; - void * TempAddr; + void *TempAddr; size_t TempSize; UT_Stub_GetInt32StatusCode(Context, &status); @@ -112,16 +113,17 @@ void UT_DefaultHandler_CFE_PSP_GetCFETextSegmentInfo(void *UserObj, UT_EntryKey_ } } -void UT_DefaultHandler_CFE_PSP_GetKernelTextSegmentInfo(void *UserObj, UT_EntryKey_t FuncKey, +void UT_DefaultHandler_CFE_PSP_GetKernelTextSegmentInfo(void *UserObj, + UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *SizeOfKernelSegment) */ cpuaddr *PtrToKernelSegment = UT_Hook_GetArgValueByName(Context, "PtrToKernelSegment", cpuaddr *); - uint32 * SizeOfKernelSegment = UT_Hook_GetArgValueByName(Context, "SizeOfKernelSegment", uint32 *); + uint32 *SizeOfKernelSegment = UT_Hook_GetArgValueByName(Context, "SizeOfKernelSegment", uint32 *); static uint32 LocalTextSegment; int32 status; - void * TempAddr; + void *TempAddr; size_t TempSize; UT_Stub_GetInt32StatusCode(Context, &status); diff --git a/ut-stubs/src/cfe_psp_memrange_api_stubs.c b/ut-stubs/src/cfe_psp_memrange_api_stubs.c index be54bc72..8392b549 100644 --- a/ut-stubs/src/cfe_psp_memrange_api_stubs.c +++ b/ut-stubs/src/cfe_psp_memrange_api_stubs.c @@ -120,8 +120,12 @@ int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) * Generated stub function for CFE_PSP_MemRangeGet() * ---------------------------------------------------- */ -int32 CFE_PSP_MemRangeGet(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) { UT_GenStub_SetupReturnBuffer(CFE_PSP_MemRangeGet, int32); @@ -142,8 +146,12 @@ int32 CFE_PSP_MemRangeGet(uint32 RangeNum, uint32 *MemoryType, cpuaddr *StartAdd * Generated stub function for CFE_PSP_MemRangeSet() * ---------------------------------------------------- */ -int32 CFE_PSP_MemRangeSet(uint32 RangeNum, uint32 MemoryType, cpuaddr StartAddr, size_t Size, size_t WordSize, - uint32 Attributes) +int32 CFE_PSP_MemRangeSet(uint32 RangeNum, + uint32 MemoryType, + cpuaddr StartAddr, + size_t Size, + size_t WordSize, + uint32 Attributes) { UT_GenStub_SetupReturnBuffer(CFE_PSP_MemRangeSet, int32); diff --git a/ut-stubs/src/cfe_psp_module_stubs.c b/ut-stubs/src/cfe_psp_module_stubs.c index 12838163..c634f4e8 100644 --- a/ut-stubs/src/cfe_psp_module_stubs.c +++ b/ut-stubs/src/cfe_psp_module_stubs.c @@ -32,7 +32,6 @@ */ void CFE_PSP_ModuleInit(void) { - UT_GenStub_Execute(CFE_PSP_ModuleInit, Basic, NULL); } diff --git a/ut-stubs/src/cfe_psp_stubs.c b/ut-stubs/src/cfe_psp_stubs.c index d88a4e1f..b58a57dc 100644 --- a/ut-stubs/src/cfe_psp_stubs.c +++ b/ut-stubs/src/cfe_psp_stubs.c @@ -34,7 +34,6 @@ */ void CFE_PSP_Main(void) { - UT_GenStub_Execute(CFE_PSP_Main, Basic, NULL); } diff --git a/ut-stubs/src/cfe_psp_timertick_api_handlers.c b/ut-stubs/src/cfe_psp_timertick_api_handlers.c index 60e143f2..825b12a0 100644 --- a/ut-stubs/src/cfe_psp_timertick_api_handlers.c +++ b/ut-stubs/src/cfe_psp_timertick_api_handlers.c @@ -56,7 +56,8 @@ void UT_DefaultHandler_CFE_PSP_GetTime(void *UserObj, UT_EntryKey_t FuncKey, con } } -void UT_DefaultHandler_CFE_PSP_GetTimerTicksPerSecond(void *UserObj, UT_EntryKey_t FuncKey, +void UT_DefaultHandler_CFE_PSP_GetTimerTicksPerSecond(void *UserObj, + UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* uint32 CFE_PSP_GetTimerTicksPerSecond(void) */ @@ -68,7 +69,8 @@ void UT_DefaultHandler_CFE_PSP_GetTimerTicksPerSecond(void *UserObj, UT_EntryKey } } -void UT_DefaultHandler_CFE_PSP_GetTimerLow32Rollover(void *UserObj, UT_EntryKey_t FuncKey, +void UT_DefaultHandler_CFE_PSP_GetTimerLow32Rollover(void *UserObj, + UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { /* uint32 CFE_PSP_GetTimerLow32Rollover(void) */ diff --git a/ut-stubs/src/cfe_psp_version_api_handlers.c b/ut-stubs/src/cfe_psp_version_api_handlers.c index 7f47c55d..0512b6dd 100644 --- a/ut-stubs/src/cfe_psp_version_api_handlers.c +++ b/ut-stubs/src/cfe_psp_version_api_handlers.c @@ -43,8 +43,8 @@ void UT_DefaultHandler_CFE_PSP_GetVersionString(void *UserObj, UT_EntryKey_t Fun { /* const char *CFE_PSP_GetVersionString(void) */ static const char DEFAULT[] = "UT"; - void * Buffer; - const char * RetVal; + void *Buffer; + const char *RetVal; UT_GetDataBuffer(UT_KEY(CFE_PSP_GetVersionString), &Buffer, NULL, NULL); if (Buffer == NULL) @@ -63,8 +63,8 @@ void UT_DefaultHandler_CFE_PSP_GetVersionCodeName(void *UserObj, UT_EntryKey_t F { /* const char *CFE_PSP_GetVersionCodeName(void) */ static const char DEFAULT[] = "UT"; - void * Buffer; - const char * RetVal; + void *Buffer; + const char *RetVal; UT_GetDataBuffer(UT_KEY(CFE_PSP_GetVersionCodeName), &Buffer, NULL, NULL); if (Buffer == NULL) diff --git a/ut-stubs/src/cfe_psp_version_api_stubs.c b/ut-stubs/src/cfe_psp_version_api_stubs.c index a65d32b2..844163b1 100644 --- a/ut-stubs/src/cfe_psp_version_api_stubs.c +++ b/ut-stubs/src/cfe_psp_version_api_stubs.c @@ -63,7 +63,6 @@ const char *CFE_PSP_GetVersionCodeName(void) */ void CFE_PSP_GetVersionNumber(uint8 VersionNumbers[4]) { - UT_GenStub_Execute(CFE_PSP_GetVersionNumber, Basic, NULL); } diff --git a/ut-stubs/src/cfe_psp_watchdog_api_stubs.c b/ut-stubs/src/cfe_psp_watchdog_api_stubs.c index 9e05477c..0b608525 100644 --- a/ut-stubs/src/cfe_psp_watchdog_api_stubs.c +++ b/ut-stubs/src/cfe_psp_watchdog_api_stubs.c @@ -75,7 +75,6 @@ void CFE_PSP_Restart(uint32 resetType) */ void CFE_PSP_WatchdogDisable(void) { - UT_GenStub_Execute(CFE_PSP_WatchdogDisable, Basic, NULL); } @@ -86,7 +85,6 @@ void CFE_PSP_WatchdogDisable(void) */ void CFE_PSP_WatchdogEnable(void) { - UT_GenStub_Execute(CFE_PSP_WatchdogEnable, Basic, NULL); } @@ -111,7 +109,6 @@ uint32 CFE_PSP_WatchdogGet(void) */ void CFE_PSP_WatchdogInit(void) { - UT_GenStub_Execute(CFE_PSP_WatchdogInit, Basic, NULL); } @@ -122,7 +119,6 @@ void CFE_PSP_WatchdogInit(void) */ void CFE_PSP_WatchdogService(void) { - UT_GenStub_Execute(CFE_PSP_WatchdogService, Basic, NULL); }