Question about share DDR Data in PRU_memAccess_DDR_PRUsharedRAM included in am335x_pru_package

560 views
Skip to first unread message

Josnelihurt Rodriguez Barajas

unread,
Jun 25, 2013, 11:31:30 AM6/25/13
to beagl...@googlegroups.com
I'm reading about PRUs, I've activated it and successfully working on, but I wonder why in the PRU_memAccess_DDR_PRUsharedRAM example in function LOCAL_exampleInit was mapped so much memory?

Here is the code from the example

static int LOCAL_exampleInit (  )
{
   void *DDR_regaddr1, *DDR_regaddr2, *DDR_regaddr3;
    /* open the device */
   mem_fd = open("/dev/mem", O_RDWR);
   if (mem_fd < 0) {
       printf("Failed to open /dev/mem (%s)\n", strerror(errno));
       return -1;
   }  
    /* map the DDR memory */
   ddrMem = mmap(0, 0x0FFFFFFF, PROT_WRITE | PROT_READ, MAP_SHARED, mem_fd, DDR_BASEADDR);

http://man7.org/linux/man-pages/man2/mmap.2.html

ddrMem is the pointer to the mapped memory at DDR_BASEADDR = 0x80000000 




If I understand the mmap 2dn argument is size_t length so 0x0FFF FFFF = 268435455 bytes, so ((268435455÷1024)÷1024) = 255.99 MB !!!! 

I just wonder why so much?

Thanks



cmicali

unread,
Jun 25, 2013, 12:50:52 PM6/25/13
to beagl...@googlegroups.com
I don't think the provided DDR example does the right thing.  Thanks to Elias' hipstercircuits blog post about this I tried to make a better example: https://github.com/sagedevices/am335x_pru_package/blob/master/pru_sw/example_apps/ddr_access

BeagleInterest

unread,
Jun 27, 2013, 12:46:21 AM6/27/13
to beagl...@googlegroups.com
My general conclusion is that it's a bad idea to write to DDR memory under Linux which is a virtual memory system.  You need to allocate this memory in the Linux Kernel driver which prevents it from being used by any other program. 

Better to just write ping pong buffer into PRU Dataram.

Chris Micali

unread,
Jun 27, 2013, 7:25:24 AM6/27/13
to beagl...@googlegroups.com
That example uses a block if DDR that is allocated by the uio_priss kernel driver and passes its address to the PRU via PRU memory.  We had to use DDR because the 12k or PRU memory was not a big enough buffer for our data rates.

Source:
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/iqo3csrF93E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages