From fd76823e4cbbb4339358fc335dab67d70fcae564 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Fri, 10 Apr 2020 16:45:13 -0400 Subject: [PATCH] Fix #366, Deprecated exception handling APIs Never fully implemented and more appropriate in PSP layer due to platform dependencies --- src/os/inc/osapi-os-core.h | 4 +- src/os/posix/osapi.c | 4 + src/os/rtems/osapi.c | 4 + src/os/shared/os-impl.h | 4 +- src/os/shared/osapi-fpu.c | 3 +- src/os/vxworks/osapi.c | 4 + .../posix/src/coveragetest-osapi.c | 46 ------ .../shared/src/coveragetest-fpu.c | 134 ------------------ .../ut-stubs/src/osapi-base-impl-stubs.c | 2 + .../vxworks/src/coveragetest-osapi.c | 51 ------- src/ut-stubs/osapi-utstub-fpu.c | 2 + 11 files changed, 21 insertions(+), 237 deletions(-) delete mode 100644 src/unit-test-coverage/shared/src/coveragetest-fpu.c diff --git a/src/os/inc/osapi-os-core.h b/src/os/inc/osapi-os-core.h index 2378ed5f3..daa0f3904 100644 --- a/src/os/inc/osapi-os-core.h +++ b/src/os/inc/osapi-os-core.h @@ -1058,6 +1058,8 @@ int32 OS_GetLocalTime (OS_time_t *time_struct); int32 OS_SetLocalTime (OS_time_t *time_struct); /**@}*/ +#ifndef OSAL_OMIT_DEPRECATED + /** * @defgroup OSAPIExc OSAL Exception APIs * @@ -1180,8 +1182,6 @@ int32 OS_FPUExcSetMask (uint32 mask); int32 OS_FPUExcGetMask (uint32 *mask); /**@}*/ -#ifndef OSAL_OMIT_DEPRECATED - /** @defgroup OSAPIInterrupt OSAL Interrupt APIs * @{ * @deprecated Platform dependencies diff --git a/src/os/posix/osapi.c b/src/os/posix/osapi.c index 5a73f141e..81a8638b6 100644 --- a/src/os/posix/osapi.c +++ b/src/os/posix/osapi.c @@ -2322,6 +2322,8 @@ static int OS_PriorityRemap(uint32 InputPri) return OutputPri; } /* end OS_PriorityRemap */ +#ifndef OSAL_OMIT_DEPRECATED + /*---------------------------------------------------------------- * * Function: OS_FPUExcAttachHandler_Impl @@ -2406,6 +2408,8 @@ int32 OS_FPUExcGetMask_Impl(uint32 *mask) return(OS_ERR_NOT_IMPLEMENTED); } /* end OS_FPUExcGetMask_Impl */ +#endif /* OSAL_OMIT_DEPRECATED */ + /********************************************************************/ /* CONSOLE OUTPUT */ /********************************************************************/ diff --git a/src/os/rtems/osapi.c b/src/os/rtems/osapi.c index 62b672c04..a5aea428f 100644 --- a/src/os/rtems/osapi.c +++ b/src/os/rtems/osapi.c @@ -1596,6 +1596,8 @@ int32 OS_HeapGetInfo_Impl (OS_heap_prop_t *heap_prop) return (OS_SUCCESS); } /* end OS_HeapGetInfo_Impl */ +#ifndef OSAL_OMIT_DEPRECATED + /*---------------------------------------------------------------- * * Function: OS_FPUExcAttachHandler_Impl @@ -1679,6 +1681,8 @@ int32 OS_FPUExcGetMask_Impl(uint32 *mask) return(OS_ERR_NOT_IMPLEMENTED); } /* end OS_FPUExcGetMask_Impl */ +#endif /* OSAL_OMIT_DEPRECATED */ + /********************************************************************/ /* CONSOLE OUTPUT */ /********************************************************************/ diff --git a/src/os/shared/os-impl.h b/src/os/shared/os-impl.h index 02cabb57b..482cee3f3 100644 --- a/src/os/shared/os-impl.h +++ b/src/os/shared/os-impl.h @@ -1867,8 +1867,6 @@ int32 OS_IntSetMask_Impl ( uint32 MaskSetting ); ------------------------------------------------------------------*/ int32 OS_IntGetMask_Impl ( uint32 * MaskSettingPtr ); -#endif /* OSAL_OMIT_DEPRECATED */ - /**************************************************************************************** FLOATING POINT CONFIG/EXCEPTION API LOW-LEVEL IMPLEMENTATION FUNCTIONS ****************************************************************************************/ @@ -1900,7 +1898,7 @@ int32 OS_FPUExcSetMask_Impl(uint32 mask); ------------------------------------------------------------------*/ int32 OS_FPUExcGetMask_Impl(uint32 *mask); - +#endif /* OSAL_OMIT_DEPRECATED */ /**************************************************************************************** MEMORY HEAP API LOW-LEVEL IMPLEMENTATION FUNCTIONS diff --git a/src/os/shared/osapi-fpu.c b/src/os/shared/osapi-fpu.c index 48cbddd28..9b5740ebf 100644 --- a/src/os/shared/osapi-fpu.c +++ b/src/os/shared/osapi-fpu.c @@ -25,6 +25,7 @@ #include #include +#ifndef OSAL_OMIT_DEPRECATED /* * User defined include files @@ -110,4 +111,4 @@ int32 OS_FPUExcDisable (int32 ExceptionNumber) return OS_FPUExcDisable_Impl(ExceptionNumber); } /* end OS_FPUExcDisable */ - +#endif /* OSAL_OMIT_DEPRECATED */ diff --git a/src/os/vxworks/osapi.c b/src/os/vxworks/osapi.c index 8bf49d6c2..180f4b660 100644 --- a/src/os/vxworks/osapi.c +++ b/src/os/vxworks/osapi.c @@ -1532,6 +1532,8 @@ int32 OS_HeapGetInfo_Impl (OS_heap_prop_t *heap_prop) return (OS_SUCCESS); } /* end OS_HeapGetInfo_Impl */ + +#ifndef OSAL_OMIT_DEPRECATED /*---------------------------------------------------------------- * @@ -1631,6 +1633,8 @@ int32 OS_FPUExcGetMask_Impl(uint32 *mask) return Status; } /* end OS_FPUExcGetMask_Impl */ +#endif /* OSAL_OMIT_DEPRECATED */ + /********************************************************************/ /* CONSOLE OUTPUT */ /********************************************************************/ diff --git a/src/unit-test-coverage/posix/src/coveragetest-osapi.c b/src/unit-test-coverage/posix/src/coveragetest-osapi.c index 79f11c479..ade6d754a 100644 --- a/src/unit-test-coverage/posix/src/coveragetest-osapi.c +++ b/src/unit-test-coverage/posix/src/coveragetest-osapi.c @@ -408,47 +408,6 @@ void Test_OS_CompAbsDelayTime(void) */ } -void Test_OS_FPUExcAttachHandler_Impl(void) -{ - /* - * Test Case For: - * int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, void * ExceptionHandler, - * int32 parameter) - */ -} - -void Test_OS_FPUExcEnable_Impl(void) -{ - /* - * Test Case For: - * int32 OS_FPUExcEnable_Impl(int32 ExceptionNumber) - */ -} - -void Test_OS_FPUExcDisable_Impl(void) -{ - /* - * Test Case For: - * int32 OS_FPUExcDisable_Impl(int32 ExceptionNumber) - */ -} - -void Test_OS_FPUExcSetMask_Impl(void) -{ - /* - * Test Case For: - * int32 OS_FPUExcSetMask_Impl(uint32 mask) - */ -} - -void Test_OS_FPUExcGetMask_Impl(void) -{ - /* - * Test Case For: - * int32 OS_FPUExcGetMask_Impl(uint32 *mask) - */ -} - /* ------------------- End of test cases --------------------------------------*/ /* Osapi_Task_Setup @@ -528,11 +487,6 @@ void UtTest_Setup(void) ADD_TEST(OS_MutSemGetInfo_Impl); ADD_TEST(OS_HeapGetInfo_Impl); ADD_TEST(OS_CompAbsDelayTime); - ADD_TEST(OS_FPUExcAttachHandler_Impl); - ADD_TEST(OS_FPUExcEnable_Impl); - ADD_TEST(OS_FPUExcDisable_Impl); - ADD_TEST(OS_FPUExcSetMask_Impl); - ADD_TEST(OS_FPUExcGetMask_Impl); } diff --git a/src/unit-test-coverage/shared/src/coveragetest-fpu.c b/src/unit-test-coverage/shared/src/coveragetest-fpu.c deleted file mode 100644 index 9d7bd13a4..000000000 --- a/src/unit-test-coverage/shared/src/coveragetest-fpu.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Filename: osapi_testcase_common.c - * - * Purpose: This file contains unit test cases for items in the "osapi-common" file - * - * Notes: - * - */ - - -/* - * Includes - */ - -#include "os-shared-coveragetest.h" -#include "ut-osapi-fpu.h" - -void dummy_fpu_exception_handler(void) -{ -} - -/***************************************************************************** - * - * Test Case for OS_FPUExcAttachHandler() - * int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, void * ExceptionHandler , - int32 parameter) - * - * - *****************************************************************************/ -void Test_OS_FPUExcAttachHandler(void) -{ - int32 expected = OS_SUCCESS; - int32 actual = OS_FPUExcAttachHandler(1, &dummy_fpu_exception_handler, 0); - - UtAssert_True(actual == expected, "OS_FPUExcAttachHandler() (%ld) == OS_SUCCESS", (long)actual); - - expected = OS_INVALID_POINTER; - actual = OS_FPUExcAttachHandler(1, NULL, 0); - UtAssert_True(actual == expected, "OS_FPUExcAttachHandler() (%ld) == OS_INVALID_POINTER", (long)actual); -} - -/***************************************************************************** - * - * Test Case for OS_FPUExcEnable() - * int32 OS_FPUExcEnable (int32 ExceptionNumber) - * - *****************************************************************************/ -void Test_OS_FPUExcEnable(void) -{ - int32 expected = OS_SUCCESS; - int32 actual = OS_FPUExcEnable(1); - - UtAssert_True(actual == expected, "OS_FPUExcEnable() (%ld) == OS_SUCCESS", (long)actual); -} - -/***************************************************************************** - * - * Test Case for OS_FPUExcDisable() - * int32 OS_FPUExcDisable (int32 ExceptionNumber) - * - *****************************************************************************/ -void Test_OS_FPUExcDisable(void) -{ - int32 expected = OS_SUCCESS; - int32 actual = OS_FPUExcDisable(1); - - UtAssert_True(actual == expected, "OS_FPUExcDisable() (%ld) == OS_SUCCESS", (long)actual); -} - -/***************************************************************************** - * - * Test Case for OS_FPUExcSetMask() - * int32 OS_FPUExcSetMask (uint32 mask) - * - *****************************************************************************/ -void Test_OS_FPUExcSetMask(void) -{ - int32 expected = OS_SUCCESS; - int32 actual = OS_FPUExcSetMask(0x10); - - UtAssert_True(actual == expected, "OS_FPUExcSetMask() (%ld) == OS_SUCCESS", (long)actual); -} - -/***************************************************************************** - * - * Test Case for OS_FPUExcGetMask() - * int32 OS_FPUExcGetMask (uint32 *mask) - * - *****************************************************************************/ -void Test_OS_FPUExcGetMask(void) -{ - uint32 mask; - int32 expected = OS_SUCCESS; - int32 actual = OS_FPUExcGetMask(&mask); - - UtAssert_True(actual == expected, "OS_FPUExcGetMask() (%ld) == OS_SUCCESS", (long)actual); -} - -/* Osapi_Task_Setup - * - * Purpose: - * Called by the unit test tool to set up the app prior to each test - */ -void Osapi_Task_Setup(void) -{ - UT_ResetState(0); -} - -/* - * Osapi_TearDown - * - * Purpose: - * Called by the unit test tool to tear down the app after each test - */ -void Osapi_TearDown(void) -{ - -} - -/* - * Register the test cases to execute with the unit test tool - */ -void UtTest_Setup(void) -{ - ADD_TEST(OS_FPUExcAttachHandler); - ADD_TEST(OS_FPUExcEnable); - ADD_TEST(OS_FPUExcDisable); - ADD_TEST(OS_FPUExcSetMask); - ADD_TEST(OS_FPUExcGetMask); -} - - - - diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-base-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-base-impl-stubs.c index 4a89f2409..1c8328e3b 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-base-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-base-impl-stubs.c @@ -151,6 +151,7 @@ void OS_ApplicationExit_Impl(int32 Status) */ UT_DEFAULT_STUB(OS_HeapGetInfo_Impl,(OS_heap_prop_t *heap_prop)) +#ifndef OSAL_OMIT_DEPRECATED /* * FPU API low-level handlers */ @@ -159,4 +160,5 @@ UT_DEFAULT_STUB(OS_FPUExcEnable_Impl,(int32 ExceptionNumber)) UT_DEFAULT_STUB(OS_FPUExcDisable_Impl,(int32 ExceptionNumber)) UT_DEFAULT_STUB(OS_FPUExcSetMask_Impl,(uint32 mask)) UT_DEFAULT_STUB(OS_FPUExcGetMask_Impl,(uint32 *mask)) +#endif /* OSAL_OMIT_DEPRECATED */ diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-osapi.c b/src/unit-test-coverage/vxworks/src/coveragetest-osapi.c index e37cba1cd..1d2a6c4d2 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-osapi.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-osapi.c @@ -589,52 +589,6 @@ void Test_OS_HeapGetInfo_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_HeapGetInfo_Impl(&heap_prop), OS_ERROR); } -void Test_OS_FPUExcAttachHandler_Impl(void) -{ - /* - * Test Case For: - * int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, void * ExceptionHandler, - * int32 parameter) - */ - OSAPI_TEST_FUNCTION_RC(OS_FPUExcAttachHandler_Impl(0, NULL, 0), OS_ERR_NOT_IMPLEMENTED); -} - -void Test_OS_FPUExcEnable_Impl(void) -{ - /* - * Test Case For: - * int32 OS_FPUExcEnable_Impl(int32 ExceptionNumber) - */ - OSAPI_TEST_FUNCTION_RC(OS_FPUExcEnable_Impl(0), OS_SUCCESS); -} - -void Test_OS_FPUExcDisable_Impl(void) -{ - /* - * Test Case For: - * int32 OS_FPUExcDisable_Impl(int32 ExceptionNumber) - */ - OSAPI_TEST_FUNCTION_RC(OS_FPUExcDisable_Impl(0), OS_SUCCESS); -} - -void Test_OS_FPUExcSetMask_Impl(void) -{ - /* - * Test Case For: - * int32 OS_FPUExcSetMask_Impl(uint32 mask) - */ - OSAPI_TEST_FUNCTION_RC(OS_FPUExcSetMask_Impl(0), OS_ERR_NOT_IMPLEMENTED); -} - -void Test_OS_FPUExcGetMask_Impl(void) -{ - /* - * Test Case For: - * int32 OS_FPUExcGetMask_Impl(uint32 *mask) - */ - OSAPI_TEST_FUNCTION_RC(OS_FPUExcGetMask_Impl(0), OS_ERR_NOT_IMPLEMENTED); -} - /* ------------------- End of test cases --------------------------------------*/ /* Osapi_Task_Setup @@ -710,11 +664,6 @@ void UtTest_Setup(void) ADD_TEST(OS_MutSemTake_Impl); ADD_TEST(OS_MutSemGetInfo_Impl); ADD_TEST(OS_HeapGetInfo_Impl); - ADD_TEST(OS_FPUExcAttachHandler_Impl); - ADD_TEST(OS_FPUExcEnable_Impl); - ADD_TEST(OS_FPUExcDisable_Impl); - ADD_TEST(OS_FPUExcSetMask_Impl); - ADD_TEST(OS_FPUExcGetMask_Impl); } diff --git a/src/ut-stubs/osapi-utstub-fpu.c b/src/ut-stubs/osapi-utstub-fpu.c index 16000e9cd..49d6a429b 100644 --- a/src/ut-stubs/osapi-utstub-fpu.c +++ b/src/ut-stubs/osapi-utstub-fpu.c @@ -24,6 +24,7 @@ #include "utstub-helpers.h" +#ifndef OSAL_OMIT_DEPRECATED /***************************************************************************** * @@ -97,3 +98,4 @@ int32 OS_FPUExcGetMask (uint32 *mask) return status; } +#endif /* OSAL_OMIT_DEPRECATED */