4 ms·
I didn't end up writing the kernel module, so this might be an anti use case: I was working on an embedded system and needed to have fast I2C access (mostly ju
by sly010 9y ago
I didn't end up writing the kernel module, so this might be an anti use case:
I was working on an embedded system and needed to have fast I2C access (mostly just wanted very small latency bc it's an instrument). I2C from Linux userspace (using ioctls) adds a lot of overhead. I started looking into kernel modules but after a day of research I found out that you can access hardware registers from userspace using mmap("/dev/mem") which is even faster than a kernel module.
Edit:typos
- zeusk 9y ago> mmap("/dev/mem") but that would only work if some kernel module or the kernel itself hasn't mapped that IO space, right?
- sly010 9y agoI don't think mmap stops you from mapping the same memory twice, nor does linux. In my case I didn't even disable the system I2C driver. If course if I tried to use it I would get io errors and if I am not careful I can crash the kernel, but that's what you get for poking around. This was a raspberry pi.
- zeusk 9y agoYeah, that's what I meant since i2c is a serial protocol and most drivers assume mutual exclusion on device registers.