6#include "dawn/porting/pulsecount.hxx"
10#include <nuttx/timers/pulsecount.h>
14#include "dawn/debug.hxx"
16int pulsecount_open(
const char *path)
20 fd = open(path, O_WRONLY | O_NONBLOCK);
21 DAWNINFO(
"pulsecount: open %s %d\n", path, fd);
24 DAWNERR(
"Failed to open pulsecount file %s (error %d)\n", path, fd);
31void pulsecount_close(
int fd)
39void pulsecount_init(
int fd)
44int pulsecount_start(
int fd)
46 return ioctl(fd, PULSECOUNTIOC_START, 0);
49int pulsecount_stop(
int fd)
51 return ioctl(fd, PULSECOUNTIOC_STOP, 0);
56 struct pulsecount_info_s info = {0};
59 info.high_ns = pulsecount->high_ns;
60 info.low_ns = pulsecount->low_ns;
61 info.count = pulsecount->count;
63 ret = ioctl(fd, PULSECOUNTIOC_SETCHARACTERISTICS,
reinterpret_cast<unsigned long>(&info));
66 DAWNERR(
"PULSECOUNTIOC_SETCHARACTERISTICS failed %d\n", -errno);
Pulse-count output settings.