• Vladimir Oltean's avatar
    testptp: add new options for perout phase and pulse width · 7570ebe0
    Vladimir Oltean authored
    Extend the example program for PTP ancillary functionality with the
    ability to configure not only the periodic output's period (frequency),
    but also the phase and duty cycle (pulse width) which were newly
    introduced.
    
    The ioctl level also needs to be updated to the new PTP_PEROUT_REQUEST2,
    since the original PTP_PEROUT_REQUEST doesn't support this
    functionality. For an in-tree testing program, not having explicit
    backwards compatibility is fine, as it should always be tested with the
    current kernel headers and sources.
    
    Tested with an oscilloscope on the felix switch PHC:
    
    echo '2 0' > /sys/class/ptp/ptp1/pins/switch_1588_dat0
    ./testptp -d /dev/ptp1 -p 1000000000 -w 100000000 -H 1000 -i 0
    Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
    Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    7570ebe0
testptp.c 11.9 KB