Discussion:
[Linuxptp-users] Read ptp clock from a C code ..
Baya Oussena
2016-07-19 08:42:20 UTC
Permalink
Hallo linuxptp-users,

I would like to use a C code to read the ptp clock of the running ptp4l
daemon.
I tried to compile the testptp.c but failed. Is there any one from you who
has a code I could adapt to my need or is it as sample as just opening and
reading /dev/ptp0 driver.

Thank you for your attention,,
Baya
Richard Cochran
2016-07-19 16:15:46 UTC
Permalink
Post by Baya Oussena
I tried to compile the testptp.c but failed. Is there any one from you who
has a code I could adapt to my need or is it as sample as just opening and
reading /dev/ptp0 driver.
The testptp.c program is the example for the PHC API. It should
compile without any trouble.

Here is how I would do it, taking the beagle bone as an example:

export ARCH=arm
export CROSS_COMPILE=/opt/x-tools/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-
export KBUILD_OUTPUT=/home/richard/kernel/beagle
# compile the kernel
make
# install the headers under ${KBUILD_OUTPUT}
make headers_install
# compile the test program
make -C Documentation/ptp -f testptp.mk

Easy, right?

Thanks,
Richard

Loading...