Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #266, psp module to implement timebase #285

Merged
merged 1 commit into from
Apr 7, 2021

Conversation

jphickey
Copy link
Contributor

Describe the contribution
Implements two PSP modules to provide CFE_PSP_GetTime and CFE_PSP_GetTimeBase, one for POSIX-compliant RTOS using clock_gettime() and the other specifically for PowerPC processors on VxWorks that have the vxTimeBaseGet() routine.

This also clarifies and documents the difference/use cases for CFE_PSP_GetTime and CFE_PSP_GetTimeBase.

Finally this includes a coverage test for the VxWorks PSP timebase module, providing an example of how this can be implemented for other modules.

Fixes #266

Testing performed
Build and sanity check CFE, run all unit tests
Confirmed timebase operation on MCP750

Expected behavior changes
No impact to behavior

System(s) tested on
Ubuntu 20.04
MCP750 / vxworks 6.9

Additional context
This included a fair bit of investigation as to what the CFE_PSP_GetTime and CFE_PSP_Get_Timebase functions actually do on MCP750, and why they both exist to begin with.

For compatibility, this keeps things mostly as they were as far as API goes (i.e. neither function is removed/deprecated at this time). However now that it is documented what the difference between these functions is, CFE should probably focus on using only CFE_PSP_GetTime() since it is more platform-agnostic. Once existing use cases of CFE_PSP_Get_Timebase() have been transitioned away, it would be a good idea to deprecate it.

When using this implementation the time reported by CFE_PSP_GetTime() is sourced by the same underlying function as CFE_PSP_Get_Timebase() uses. It no longer uses the separate countdown timer within the Raven PCI device on the MCP750.

This should be more efficient because vxTimeBaseGet() simply reads a local CPU register, whereas reading the Raven register requires PCI access and obscure conversion logic. The other benefit is that it does not wrap every 27 seconds, thereby allowing CFE time to be simplified at a future date, too.

Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey force-pushed the fix-266-psp-timebase branch 2 times, most recently from 7526dfd to 0dc1cf0 Compare March 30, 2021 23:40
@jphickey jphickey added the CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) label Mar 30, 2021
@jphickey
Copy link
Contributor Author

The build failure here is because it depends on a fix currently in #282. Once merged together it builds fine.

Clarifies the use case for CFE_PSP_GetTime and CFE_PSP_GetTimeBase.

Moves the implementation of these to separate PSP modules, so MCP750
on VxWorks can use the optimized vxTimeBaseGet() routine while
Linux and RTEMS can use the generic posix CLOCK_MONOTONIC.
@jphickey
Copy link
Contributor Author

Update to remove some leftover commented code.

@astrogeco astrogeco changed the base branch from main to integration-candidate April 7, 2021 15:37
@astrogeco
Copy link
Contributor

@jphickey can you fix the conflicts here?

jphickey added a commit that referenced this pull request Apr 7, 2021
Fix #266, psp module to implement timebase
@jphickey jphickey merged commit 7c5e6cb into nasa:integration-candidate Apr 7, 2021
@jphickey
Copy link
Contributor Author

jphickey commented Apr 7, 2021

@jphickey can you fix the conflicts here?

Fixed!

@astrogeco astrogeco removed CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) conflicts labels Apr 8, 2021
astrogeco added a commit to nasa/cFS that referenced this pull request Apr 8, 2021
Combines:

nasa/cFE#1284
nasa/osal#951
nasa/PSP#289

Including:

nasa/cFE#1251 - ES Info API Functional test

nasa/osal#931 - Scrub include guards
nasa/osal#937 - Switch to use CLOCK_REALTIME
nasa/osal#938 - specify shell name in ShellOutputToFile

nasa/PSP#286 - use OSAL timebase for CFE timers
nasa/PSP#282 - modularize the ram, port, and eenasa/psp#om access
nasa/PSP#285 - add psp module to implement timebase
@jphickey jphickey deleted the fix-266-psp-timebase branch April 29, 2021 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should not use OS_GetLocalTime() for PSP timebase
2 participants