nasa / PSP

The Core Flight System (cFS) Platform Support Package (PSP)
Apache License 2.0
68 stars 56 forks source link

PowerPC specific include in vxworks timebase #349

Open skliper opened 2 years ago

skliper commented 2 years ago

Is your feature request related to a problem? Please describe. There's a PowerPC specific include in the timbase_vxworks here: https://github.com/nasa/PSP/blob/4bf1eefc81738de9ed03d6ea0eb018ce03b0d92b/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c#L47

It would be good to make this module vxworks generic if possible.

Describe the solution you'd like I'm not sure what's needed from that include, but if it is necessary it would be nice to abstract it out or ifdef it in only for PPC.

Describe alternatives you've considered Nothing particular in mind, but any method to make that module generic vxworks would work.

Additional context None

Requester Info Jacob Hageman - NASA/GSFC

Ping @superolmo

jphickey commented 2 years ago

The problem is that the register used by this module is in fact PPC-specific - it is reading the timebase register directly in the powerPC CPU. Although there is a VxWorks-defined call to read it, its not really abstracted at all. (This is why it has to deal with the strange semantics of the register).

Suggestion is to rename this module to something like "vxworks_ppc_timebase" to better indicate that its use is limited to the VxWorks + PPC combination. A generic timebase could then be implemented separately for other CPUs.

superolmo commented 2 years ago

@jphickey For the LEON4 target I am working on, I defined my own vxTimeBaseGet function and added the following to cfe_psp_timebase_vxworks.c to make it work.

if defined(LEONCOMPAT_VERSION)

extern void vxTimeBaseGet(uint32 Tbu, uint32 Tbl);

endif

PSP could call a generic CFE_PSP_VXTimeBaseGet function that is implemented by the target specific implementation.