On 2 November 2015 at 04:33, William Hermans <[email protected]> wrote:

> I honestly do not know the eCAP / PWM modules at all, but I suspect that
> you would not necessarily need to use the PRU to access these modules.


Although I haven't yet tried to use the eCAP in PRUSS, I don't think
there's any particular obstacle to using it directly. You don't need to get
the PRU cores involved if you don't want to. I just mentioned them as a way
to create *even more* PWM outputs (via PRU's GPOs) if you'd need them.


> Pretty much anything that can be accessed via the PRU's can be accessed
> from a C program through /dev/mem/ + mmap().


Correct, pretty much anything can be used from userspace like that,
although some people will frown at you for bypassing the kernel if you do.

A bit more elegant than using /dev/mem is using the uio_pdrv_genirq driver,
which lets you set the permissions of the device using udev hence avoid the
need to be root, and also allows you to receive irqs in userspace. If the
device tree node(s) also have the appropriate ti,hwmods property (e.g. if
you simply reuse an existing DT node but alter it to use uio) then the
kernel will also enable the module clocks for you when you open the device,
saving you from manually fiddling with PRCM.  This is an example I made
earlier for doing this for the ADC, but other modules are similar:
http://pastebin.com/GrHwgYiR

Beware btw that the eHRPWM modules have an additional little complication:
their counters also need to be ungated via a control module register. The
purpose of this is to allow the modules to run synchronized by configuring
them to the same frequency and then ungating their counters simultaneously.
The control module however requires privileged writes, and any write
performed in a normal way from userspace gets ignored. Fortunately, you can
easily get the kernel to perform the write for you, e.g.
using process_vm_readv( getpid(), ... ).

Matthijs

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to