On Thu, Nov 12, 2015 at 10:15:04AM -0600, Bassam Alsanie wrote:
> and my custom clock I can compute the frequency shift as the following:
>
> __u16 fraction = ((__u64) tx.freq & 0x0000ffff);
> __u16 integer = (__u64) tx.freq >> 16;
> __u64 requestedPpb = (integer * 1000) + fraction;
>
> __s64 freqShiftInHz = (__u64) (currentFreq * requestedPpb) / kPpb;
>
> where, currentFreq is the current centrer frequency of the clock (mine is
> around 100 MHz)
>
>
> Thoughts?
Why would you do that? The kernel PHC subsystem already converts the
adjustment value into ppb for you.
Look at include/linux/ptp_clock_kernel.h:
/**
* struct ptp_clock_info - decribes a PTP hardware clock
*
...
* clock operations
*
* @adjfreq: Adjusts the frequency of the hardware clock.
* parameter delta: Desired frequency offset from nominal frequency
* in parts per billion
...
*/
struct ptp_clock_info {
...
int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta);
...
};
I suggest that you:
1. read the PHC header file to learn the API, and
2. look at a few PHC drivers to see how it is done.
Thanks,
Richard
------------------------------------------------------------------------------
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel