I'm sampling data from the ADC and doing some processing on the PRU unit. 
After that, I pass the processed data to a linux app in the ARM processor 
using shared memory. Sometimes when the ARM processor is busy, I miss some 
of the samples so I'd like to use a ring buffer.
I was reading this 
<http://www.codeproject.com/Articles/43510/Lock-Free-Single-Producer-Single-Consumer-Circular>
 
which explains clearly how to implement a single reader, single writer 
circular buffer. I think I can translate that to C without problems. 
However, they state that read and write operations to the head and tail 
indexes MUST be atomic for the buffer to work correctly.  

If I'm writing and reading from the PRU and the ARM to a position in shared 
ram, how do I make sure I'm doing it atomically? 

Perhaps there is already a circular buffer implementation for ARM+PRU that 
I can take a look at for reference?

I also found this this 
<http://stackoverflow.com/questions/9289243/read-and-write-atomic-operation-implementation-in-the-linux-kernel>
 
which suggests read operations are atomic on the linux side and write 
operations should be atomic on most platforms. Is that the case here? 

Thanks!

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to