Fix #266, psp module to implement timebase #285
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thevxTimeBaseGet()
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.