Skip to content

Commit

Permalink
Merge pull request #240 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
psp Integration Candidate: 2021-01-13
  • Loading branch information
astrogeco authored Jan 13, 2021
2 parents bf5190d + 9ee7346 commit 2fcce6f
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 13 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/nasa/psp/pull/240>

### Development Build: 1.5.0-rc1+dev46

- Add cppcheck GitHub Actions workflow file
Expand Down
2 changes: 1 addition & 1 deletion fsw/mcp750-vxworks/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

/*
Expand Down
15 changes: 12 additions & 3 deletions fsw/mcp750-vxworks/src/cfe_psp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 */

Expand Down
2 changes: 1 addition & 1 deletion fsw/pc-linux/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

/*
Expand Down
4 changes: 2 additions & 2 deletions fsw/pc-linux/src/cfe_psp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/******************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion fsw/pc-rtems/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

/*
Expand Down
5 changes: 2 additions & 3 deletions fsw/pc-rtems/src/cfe_psp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/******************************************************************************
Expand All @@ -180,4 +180,3 @@ uint32 CFE_PSP_Get_Dec(void)
{
return(0);
}

3 changes: 1 addition & 2 deletions ut-stubs/ut_psp_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit 2fcce6f

Please sign in to comment.