9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] devsegment usage examples
@ 2016-08-31  9:34 Giacomo Tesio
  2016-08-31 10:40 ` cinap_lenrek
  0 siblings, 1 reply; 3+ messages in thread
From: Giacomo Tesio @ 2016-08-31  9:34 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs, 9front

[-- Attachment #1: Type: text/plain, Size: 180 bytes --]

Hi, I'm looking for an usage example of devsegment.

I cannot find anything neither in bhro's plan9 nor in 9front.

Can anybody share a real usage world example?


Giacomo

[-- Attachment #2: Type: text/html, Size: 271 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] devsegment usage examples
  2016-08-31  9:34 [9fans] devsegment usage examples Giacomo Tesio
@ 2016-08-31 10:40 ` cinap_lenrek
  2016-08-31 12:57   ` Giacomo Tesio
  0 siblings, 1 reply; 3+ messages in thread
From: cinap_lenrek @ 2016-08-31 10:40 UTC (permalink / raw)
  To: 9fans

> Hi, I'm looking for an usage example of devsegment.
>
> I cannot find anything neither in bhro's plan9 nor in 9front.
>
> Can anybody share a real usage world example?
>
>
> Giacomo

its just creating named segments of some shared memory.

segment(3) has an example. read it.

on 9front, you can also allocate physically continuous segments *and*
get the physical base address for it :)

one application for it is on the zynq. the displayport graphics is
implemented using the fpga and userspace uses devsegment
to allocate 5MB of physically continous memory for the framebuffer:

#!/bin/rc
rfork en
bind -c '#g' /mnt/segment
if(! test -d /mnt/segment/fb){
	mkdir /mnt/segment/fb
	echo 'va 0x00500000 0x00500000 fixed' > /mnt/segment/fb/ctl
}

bind -b '#P' /dev
audio/pcmconv -i 'c1u32r1' -o 'c1U32r1' < ./build/out.bin > /dev/pl

then some c code programs the graphics register and hands the
loaded core the physical address for DMA.

--
cinap



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] devsegment usage examples
  2016-08-31 10:40 ` cinap_lenrek
@ 2016-08-31 12:57   ` Giacomo Tesio
  0 siblings, 0 replies; 3+ messages in thread
From: Giacomo Tesio @ 2016-08-31 12:57 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1711 bytes --]

Neat, thanks!
I wonder if a similar approach could be used to move some device drivers
out of kernel...

Btw, I did read the sample in segment(3) but I was looking for a real world
example.
What I'm trying to understand is not *how* to use devsegment, but *when* to
use it.
Which problems is it designed to solve?

Moreover, Zinq's graphics use a very smart approach, but it's specific to
9front evolution of the device with the "fixed" type.
I'm also looking for the general use case, when segments are not used for
DMA, as designed in the original Plan9.


Giacomo

2016-08-31 12:40 GMT+02:00 <cinap_lenrek@felloff.net>:

> > Hi, I'm looking for an usage example of devsegment.
> >
> > I cannot find anything neither in bhro's plan9 nor in 9front.
> >
> > Can anybody share a real usage world example?
> >
> >
> > Giacomo
>
> its just creating named segments of some shared memory.
>
> segment(3) has an example. read it.
>
> on 9front, you can also allocate physically continuous segments *and*
> get the physical base address for it :)
>
> one application for it is on the zynq. the displayport graphics is
> implemented using the fpga and userspace uses devsegment
> to allocate 5MB of physically continous memory for the framebuffer:
>
> #!/bin/rc
> rfork en
> bind -c '#g' /mnt/segment
> if(! test -d /mnt/segment/fb){
>         mkdir /mnt/segment/fb
>         echo 'va 0x00500000 0x00500000 fixed' > /mnt/segment/fb/ctl
> }
>
> bind -b '#P' /dev
> audio/pcmconv -i 'c1u32r1' -o 'c1U32r1' < ./build/out.bin > /dev/pl
>
> then some c code programs the graphics register and hands the
> loaded core the physical address for DMA.
>
> --
> cinap
>
>

[-- Attachment #2: Type: text/html, Size: 2370 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-31 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-31  9:34 [9fans] devsegment usage examples Giacomo Tesio
2016-08-31 10:40 ` cinap_lenrek
2016-08-31 12:57   ` Giacomo Tesio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).