From e3ef871d189bdeb1f966b2d0b41b0cbefddc1c33 Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Wed, 11 Dec 2024 07:53:36 +0100 Subject: [PATCH] Fix #443, Correct minor bugs + typos in the VxWorks layer --- fsw/mcp750-vxworks/src/cfe_psp_memory.c | 18 ++++++++---------- fsw/mcp750-vxworks/src/cfe_psp_start.c | 4 ++-- .../src/coveragetest-cfe-psp-start.c | 4 ++-- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/fsw/mcp750-vxworks/src/cfe_psp_memory.c b/fsw/mcp750-vxworks/src/cfe_psp_memory.c index f326f00a..911c4d6a 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_memory.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_memory.c @@ -186,7 +186,7 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt return_code = CFE_PSP_ERROR; } - } /* end if PtrToDataToWrite == NULL */ + } /* end if PtrToDataToRead == NULL */ return return_code; } @@ -319,9 +319,7 @@ int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) */ int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) { - int32 return_code; - - if (RestartType != CFE_PSP_RST_TYPE_PROCESSOR) + if (RestartType == CFE_PSP_RST_TYPE_POWERON) { OS_printf("CFE_PSP: Clearing Processor Reserved Memory.\n"); memset(MCP750_ReservedMemBlock.BlockPtr, 0, MCP750_ReservedMemBlock.BlockSize); @@ -331,8 +329,8 @@ int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) */ CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_PROCESSOR; } - return_code = CFE_PSP_SUCCESS; - return return_code; + + return CFE_PSP_SUCCESS; } /****************************************************************************** @@ -478,7 +476,7 @@ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFES MODULE_ID cFEModuleId; MODULE_INFO cFEModuleInfo; cpuaddr GetModuleIdAddr; - MODULE_ID (*GetModuldIdFunc)(void); + MODULE_ID (*GetModuleIdFunc)(void); if (PtrToCFESegment == NULL || SizeOfCFESegment == NULL) { @@ -503,8 +501,8 @@ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFES return_code = OS_SymbolLookup(&GetModuleIdAddr, "GetCfeCoreModuleID"); if (return_code == OS_SUCCESS && GetModuleIdAddr != 0) { - GetModuldIdFunc = (MODULE_ID(*)(void))GetModuleIdAddr; - cFEModuleId = GetModuldIdFunc(); + GetModuleIdFunc = (MODULE_ID(*)(void))GetModuleIdAddr; + cFEModuleId = GetModuleIdFunc(); } /* @@ -538,4 +536,4 @@ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFES } return return_code; -} \ No newline at end of file +} diff --git a/fsw/mcp750-vxworks/src/cfe_psp_start.c b/fsw/mcp750-vxworks/src/cfe_psp_start.c index 9a105266..472f432e 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_start.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_start.c @@ -169,8 +169,8 @@ void OS_Application_Startup(void) else if (reset_register & SYS_REG_BLRR_FBTN) { OS_printf("CFE_PSP: POWERON Reset: Front Panel Push Button Reset.\n"); - reset_type = CFE_PSP_RST_SUBTYPE_PUSH_BUTTON; - reset_subtype = 3; + reset_type = CFE_PSP_RST_TYPE_POWERON; + reset_subtype = CFE_PSP_RST_SUBTYPE_PUSH_BUTTON; } else if (reset_register & SYS_REG_BLRR_WDT2) { diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c index 497c6e88..46d3d7ce 100644 --- a/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c @@ -120,8 +120,8 @@ void Test_OS_Application_Startup(void) *PCS_SYS_REG_BLRR = PCS_SYS_REG_BLRR_FBTN; UT_OS_Application_Startup(); UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_SystemMain)), 5); - UtAssert_INT32_EQ(StartType.StartType, CFE_PSP_RST_SUBTYPE_PUSH_BUTTON); - UtAssert_INT32_EQ(StartType.StartSubtype, 3); + UtAssert_INT32_EQ(StartType.StartType, CFE_PSP_RST_TYPE_POWERON); + UtAssert_INT32_EQ(StartType.StartSubtype, CFE_PSP_RST_SUBTYPE_PUSH_BUTTON); *PCS_SYS_REG_BLRR = PCS_SYS_REG_BLRR_WDT2; UT_OS_Application_Startup();