On 4 November 2015 at 05:01, William Hermans <yyrk...@gmail.com> wrote:

> Where would be a good start to read up on uio ? I've been reading around,
> but have not found anything of much use yet.
>

The official doc is the UIO Howto
<https://www.kernel.org/doc/htmldocs/uio-howto/>, but it's very
PCI-oriented. The basic assumption is that there are only a few irq lines
which are shared, hence even if you want to do most things in userspace a
tiny kernel driver is still needed to do whatever is necessary to get the
irq deasserted before delivering it to userspace. The uio kernel framework
is designed to facilitate that.

uio_pdrv_genirq is a simple uio driver which "handles" the irq simply by
disabling it (until reenabled by userspace), which requires that the irq
line isn't shared. This is fine since the AM335x doesn't use shared irq
lines, its interrupt controller for the cortex-A8 has 128 inputs.


> Also, that pastebin you gave, this is *everything* needed to use an uio
> adc ?
>

Yep. I don't think the device tree snippet works as overlay though, you may
need to add it to the main dts. (I never use overlays so I haven't tested
that.)


> But for instance, assuming the pastebin you gave is everything needed(
> which would be awesome ), how do I know how this adc uio "object" is set up
> ?
>

As the comment at the bottom says, /dev/uio/adc would appear.


> e.g. how would i write a userspace driver for it ?
>

open /dev/uio/adc, mmap() it (offset 0 size 4KB) to obtain access to its
registers. See TRM chapter 12 for usage (yes, "Touchscreen Controller",
that's the one).

If you want to receive interrupts, write (u32)1 to the fd to enable the
irq. When it occurs, the irq is disabled, the fd becomes readable and you
read an u32 from it (value will be 1).

A word of caution: once you've enabled the ADC, if you want to reconfigure
it, first disable all steps (set STEPENABLE to 0) and wait until it is idle
(check ADCSTAT register, STEP_ID and FSM_BUSY will both indicate idle).
Failure to do so can lock up the ADC state machine in a way that requires
reboot to clear. Most peripherals have some kind of reset functionality but
oddly the ADC does not.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to