Thanks Randy.
So you are basically suggesting me that I should put my code into some ram-based fs, like debugfs/tmpfs/ramfs
in order to avoid file write cycles. Is this any better than mmaping my gpio’s file descriptors ?
I’m not quite sure what timer should I use to collect interruptions in userspace app: dmtimer or dmtimer2 ?
I’m gonna play around with poll/select/epoll eventually. Thanks for the tip.
The main issue bothering me is that
I cannot possibly get ubuntu arm to interrupt my userspace app in periods smaller than ~30ms.
Even if I blank out the loop internals (i.e., delete the entire gpio read code overhead),
I cannot get better interruption periods, even when with dmtimer2 mmaped.
Do you think plain poll/select/epoll techniques or another (patched) distro can be of any use here ?
To clarify, an interrupt snippet in my code would be something like this (got it in some topic here… can’t find the link right now) :
`
#define PERIOD 1000
int fd = open("/dev/mem", O_RDWR | O_SYNC);
volatile u_int32_t *dmtimer2_regs = (u_int32_t *)mmap(NULL, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0x48040000);
u_int32_t t0 = 0, t1 = 0;
dmtimer2_regs[0x3c / 4] = 0;
while ((t1 - t0) < PERIOD) {
t1 = dmtimer2_regs[0x3c / 4];
}
printf(“delta=%u. t0=%u. t1=%u\n”, t1 - t0, t0, t1);
`
Or something like this (via clock_gettime):
`
struct sched_param sch; sch.sched_priority = sched_get_priority_max(SCHED_FIFO);
if (sched_setscheduler(0, SCHED_FIFO, &sch) == -1) perror(“Scheduling error”);
struct timespec spec_start, spec_end;
clock_gettime(CLOCK_REALTIME, &spec_start);
clock_gettime(CLOCK_REALTIME, &spec_end);
printf(“delta_gettime=%lf us\n”, diff_nsec(&spec_start, &spec_end) / 1000.0);
`
Anyway, in my computer (arch linux 64b) I can get results down to 0.5us.
In the bbone (w/ ubuntu arm 32b) I cannot go further 30ms.
Thank you