diff --git a/README.md b/README.md index 2d56cc70..26b2430d 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,11 @@ This is a collection of APIs abstracting platform specific functionality to be l ## Version History +### Development Build: 1.5.0-rc1+dev50 + +- Instead of accessing `OS_time_t` member values directly, use the OSAL-provided conversion and access methods. This provides independence and abstraction from the specific `OS_time_t` definition and allows OSAL to transition to a 64 bit value. +- See + ### Development Build: 1.5.0-rc1+dev46 - Add cppcheck GitHub Actions workflow file diff --git a/fsw/mcp750-vxworks/inc/psp_version.h b/fsw/mcp750-vxworks/inc/psp_version.h index 88df53bc..d018fde5 100644 --- a/fsw/mcp750-vxworks/inc/psp_version.h +++ b/fsw/mcp750-vxworks/inc/psp_version.h @@ -29,7 +29,7 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 46 +#define CFE_PSP_IMPL_BUILD_NUMBER 50 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/mcp750-vxworks/src/cfe_psp_timer.c b/fsw/mcp750-vxworks/src/cfe_psp_timer.c index 9c7ddaad..b71a6205 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_timer.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_timer.c @@ -92,13 +92,15 @@ IMPORT void sysPciRead32 (UINT32, UINT32 *); void CFE_PSP_GetTime( OS_time_t *LocalTime) { uint32 DecCount; + uint32 Seconds; /* Reads the time from the hardware register, then converts it - * into usable seconds and microseconds */ + * into an OS_time_t value */ sysPciRead32(0xFC0011C0, (UINT32 *)(&DecCount)); DecCount = DecCount & 0x7FFFFFFF; DecCount = ((uint32) 0x0D6937E5) - DecCount; - LocalTime->seconds = DecCount / 8333311; + + Seconds = DecCount / 8333311; /* Get subseconds (discard seconds) */ DecCount = DecCount % 8333311; @@ -111,8 +113,15 @@ void CFE_PSP_GetTime( OS_time_t *LocalTime) * - Approximation: ((300 * DecCount) + (DecCount / 1244)) / 2500 * At cost of up to 2us error (at max value): * - Approximation: (DecCount * 3) / 25 + * + * Same basic ratio but adjusted to produce units in nanoseconds + * instead of microseconds: + * - ((480 * DecCount) + (DecCount / 777)) / 4 */ - LocalTime->microsecs = ((300 * DecCount) + (DecCount / 1244)) / 2500; + + DecCount = ((480 * DecCount) + (DecCount / 777)) / 4; + + *LocalTime = OS_TimeAssembleFromNanoseconds(Seconds, DecCount); }/* end CFE_PSP_GetLocalTime */ diff --git a/fsw/pc-linux/inc/psp_version.h b/fsw/pc-linux/inc/psp_version.h index 9d2070ca..9029b145 100644 --- a/fsw/pc-linux/inc/psp_version.h +++ b/fsw/pc-linux/inc/psp_version.h @@ -29,7 +29,7 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 46 +#define CFE_PSP_IMPL_BUILD_NUMBER 50 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/pc-linux/src/cfe_psp_timer.c b/fsw/pc-linux/src/cfe_psp_timer.c index 550b0c92..487e308d 100644 --- a/fsw/pc-linux/src/cfe_psp_timer.c +++ b/fsw/pc-linux/src/cfe_psp_timer.c @@ -164,8 +164,8 @@ void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32* Tbl) OS_time_t time; OS_GetLocalTime(&time); - *Tbu = time.seconds; - *Tbl = time.microsecs; + *Tbu = OS_TimeGetTotalSeconds(time); + *Tbl = OS_TimeGetMicrosecondsPart(time); } /****************************************************************************** diff --git a/fsw/pc-rtems/inc/psp_version.h b/fsw/pc-rtems/inc/psp_version.h index a6c2047d..53c56a14 100644 --- a/fsw/pc-rtems/inc/psp_version.h +++ b/fsw/pc-rtems/inc/psp_version.h @@ -29,7 +29,7 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 46 +#define CFE_PSP_IMPL_BUILD_NUMBER 50 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/pc-rtems/src/cfe_psp_timer.c b/fsw/pc-rtems/src/cfe_psp_timer.c index caeba548..1760d5ff 100644 --- a/fsw/pc-rtems/src/cfe_psp_timer.c +++ b/fsw/pc-rtems/src/cfe_psp_timer.c @@ -158,8 +158,8 @@ void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32* Tbl) OS_time_t time; OS_GetLocalTime(&time); - *Tbu = time.seconds; - *Tbl = time.microsecs; + *Tbu = OS_TimeGetTotalSeconds(time); + *Tbl = OS_TimeGetMicrosecondsPart(time); } /****************************************************************************** @@ -180,4 +180,3 @@ uint32 CFE_PSP_Get_Dec(void) { return(0); } - diff --git a/ut-stubs/ut_psp_stubs.c b/ut-stubs/ut_psp_stubs.c index c77a788a..8a07aa1e 100644 --- a/ut-stubs/ut_psp_stubs.c +++ b/ut-stubs/ut_psp_stubs.c @@ -200,8 +200,7 @@ void CFE_PSP_GetTime(OS_time_t *LocalTime) { if (UT_Stub_CopyToLocal(UT_KEY(CFE_PSP_GetTime), (uint8*)LocalTime, sizeof(*LocalTime)) < sizeof(*LocalTime)) { - LocalTime->seconds = 100; - LocalTime->microsecs = 200; + *LocalTime = OS_TimeAssembleFromNanoseconds(100,200000); } } }