<div dir="ltr">Thanks this is very helpful.<div>But has anyone an existing example of a similar driver?</div><div>I wasn't able find one in /bsps, maybe I didn't search long enough.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 15 Jul 2019 at 08:47, Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 14/07/2019 01:34, Joel Sherrill wrote:<br>
> On Sat, Jul 13, 2019 at 1:42 PM Chris Johns <<a href="mailto:chrisj@rtems.org" target="_blank">chrisj@rtems.org</a> <br>
> <mailto:<a href="mailto:chrisj@rtems.org" target="_blank">chrisj@rtems.org</a>>> wrote:<br>
> <br>
> <br>
> <br>
>     On 13/7/19 5:16 pm, Nils Hölscher wrote:<br>
>      > Hi,<br>
>      ><br>
>      > After I made sure that my fdt is correct I wondered why the pruss<br>
>     was still not<br>
>      > accessible.<br>
>      > When I researched more about userspace drivers in Linux I found<br>
>     out, that I have<br>
>      > overseen the pru UIO module in Linux.<br>
>      > This is the part that links the PRUs to the /dev/uio[0-7].<br>
>      > Which then would be used by the sources I currently use.<br>
>      > The UIO source is available here:<br>
>      > <a href="https://github.com/beagleboard/linux/blob/3.8/drivers/uio/uio_pruss.c" rel="noreferrer" target="_blank">https://github.com/beagleboard/linux/blob/3.8/drivers/uio/uio_pruss.c</a><br>
>      > However this requires the linux UIO lib to load the modules and<br>
>     abstract the<br>
>      > device into a file.<br>
>      ><br>
>      > While researching I also found that BSD has a PRU driver.<br>
>      > Also this driver is more feature rich as it support PRU debugging.<br>
>      > The sources can be found her:<br>
>      > <a href="https://bitbucket.org/rpaulo/libpru/src/default/" rel="noreferrer" target="_blank">https://bitbucket.org/rpaulo/libpru/src/default/</a><br>
>      > Additionally I found these sources in the FreeBSD tree:<br>
>      ><br>
>     <a href="https://github.com/freebsd/freebsd/blob/250e158ddf52459661439141407bca505d199c19/sys/arm/ti/ti_pruss.c" rel="noreferrer" target="_blank">https://github.com/freebsd/freebsd/blob/250e158ddf52459661439141407bca505d199c19/sys/arm/ti/ti_pruss.c</a><br>
>      > This code also registers the PRUs in /dev/.<br>
>      > On the other hand the BSD drivers have no documentation at all.<br>
>      ><br>
>      > These are the code lines that will fail without a file in /dev.<br>
>      > Linux:<br>
>     <a href="https://github.com/nilhoel1/rtems-pru/blob/master/ti/prussdrv.c#L265" rel="noreferrer" target="_blank">https://github.com/nilhoel1/rtems-pru/blob/master/ti/prussdrv.c#L265</a><br>
>      > BSD:<br>
>     <a href="https://bitbucket.org/rpaulo/libpru/src/5cb7271533a96d177e73492f7cc40fa4b28396a5/ti-pru.c#lines-614" rel="noreferrer" target="_blank">https://bitbucket.org/rpaulo/libpru/src/5cb7271533a96d177e73492f7cc40fa4b28396a5/ti-pru.c#lines-614</a><br>
>      ><br>
>      > So my questions are:<br>
>      > 1. How are drivers registered to /dev in RTEMS? (examples)<br>
> <br>
>     I suggest you look at cpukit/include/rtems/io.h and then for<br>
>     examples of this<br>
>     interface being used in the bsp directory.<br>
> <br>
> <br>
> There is a helper in the IO Manager which is implemented as a call to <br>
> mknod()<br>
> which is a standard call.<br>
<br>
<br>
In libbsd devices should be added with IMFS_make_generic_node():<br>
<br>
freebsd/sys/net/bpf.c:  rv = IMFS_make_generic_node("/dev/bpf", mode, <br>
&bpf_imfs_control, NULL);<br>
freebsd/sys/kern/uipc_usrreq.c: rv = IMFS_make_generic_node(soun->sun_path,<br>
rtemsbsd/sys/fs/devfs/devfs_devs.c:     rv = <br>
IMFS_make_generic_node(dev->si_path, mode, &devfs_imfs_control,<br>
<br>
-- <br>
Sebastian Huber, embedded brains GmbH<br>
<br>
Address : Dornierstr. 4, D-82178 Puchheim, Germany<br>
Phone   : +49 89 189 47 41-16<br>
Fax     : +49 89 189 47 41-09<br>
E-Mail  : <a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a><br>
PGP     : Public key available on request.<br>
<br>
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a></blockquote></div>