From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Wed, 31 Aug 2016 12:40:42 +0200 From: cinap_lenrek@felloff.net To: 9fans@9fans.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] devsegment usage examples Topicbox-Message-UUID: 9aa4f7d2-ead9-11e9-9d60-3106f5b1d025 > 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