Skip to content
  • Philippe Gerum's avatar
    drivers/gpio: provide optional timestamped readouts · d35f3e41
    Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
    
    
    In timestamping mode, read() returns the timestamp of the latest event
    receipt on the pin based on CLOCK_MONOTONIC, along with the pin
    state. This is an optional pin readout mode controlled by the
    GPIO_RTIOC_TS request, e.g.:
    
    struct rtdm_gpio_readout rdo;
    int ret, on, val;
    
    on = 1;
    ret = ioctl(pinfd, GPIO_RTIOC_TS, &on);
    ret = read(pinfd, &rdo, sizeof(rdo));
    /* pin state changed to rdo.value at time rdo.timestamp */
    
    on = 0;
    ret = ioctl(pinfd, GPIO_RTIOC_TS, &on);
    ret = read(pinfd, &val, sizeof(val));
    /* pin state changed to value (time of change unspecified) */
    
    By default, timestamping mode is disabled, which corresponds to the
    original behavior.
    
    Signed-off-by: default avatarPhilippe Gerum <rpm@xenomai.org>
    Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
    d35f3e41