It turns out the answer is in page 250 of Chapter 9 of LDD 3 (
https://lwn.net/Kernel/LDD3/).
#include <asm/io.h>
void **ioremap*(unsigned long phys_addr, unsigned long size);
void iounmap(void * addr);
unsigned int ioread32(void *addr);
So I used:
#include <asm/io.h>
#define PRU_ADDR 0x4A300000 // Start of PRU memory Page 184 am335x TRM
#define PRU_SHAREDMEM 0x10000 // Offset to shared memory
#define PRU_SHAREDMEM_LEN 0x3000 // Length of shared memory
void *shared_mem;
shared_mem = ioremap(PRU_ADDR+PRU_SHAREDMEM, 0x3000);
and then to read the 0th shared memory:
ioread32(shared_mem+0);
I'll soon post the simple kernel driver I have working...
--Mark
On Sunday, July 31, 2016 at 12:58:43 AM UTC-4, ZeekHuge wrote:
>
>
> oops ! Sorry. Somehow I just read *'PRUs' shared RAM'* and didnt read the
> *'within
> a kernel driver'* part of the main question, and then thought he was
> asking about PRU's shared memory usage, to share data between the two PRUs.
> So the answer was to be able to use shared mem for PRU to PRU
> communication.
>
> On Saturday, 30 July 2016 20:14:06 UTC+5:30, ZeekHuge wrote:
>>
>>
>> You can probably use it as an attribute.
>> something like this :
>>
>>
>> __far __attribute__((cregister("PRU_SHAREDMEM", near))) volatile
>> uint32_t variable_1;
>> __far __attribute__((cregister("PRU_SHAREDMEM", near))) volatile
>> uint32_t variable_2;
>>
>>
>> //Somewhere In code
>>
>> variable_1 = data;
>> variable_2 = _2_data;
>>
>>
>> So basically, the compiler allocates memory to these variables somewhere
>> in the shared mem and you have no control over where it gets allocated. So
>> if you wish to share data between the two PRUs, you can probably
>> define the variable in a common file and then use this exact same
>> variable in the two source codes.
>>
>> I haven't actually tried this way. Please let us know if this works.
>>
>>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/f34a8ee0-cd4d-48eb-b832-6eacce003674%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.