On Thu, Sep 8, 2016 at 6:36 AM, Charles Steinkuehler < [email protected]> wrote:
> On 9/7/2016 7:50 PM, William Hermans wrote: > > > > SETDATAOUT -> |= BITx > > CLEARDATAOUT -> &=(~BITx) > > > > I gues I'll have to reread the TRM again. > > The set/clear registers only affect the bits that are written with a > '1' value, all other bits remain unchanged, while writing directly to > the DATAOUT register affects the value of all 32 bits in the GPIO > bank. Using the set/clear registers allows a single atomic write > operation to affect the specific bit(s) you want to change without > having to perform a non-atomic read-modify-write cycle. > > Since the write to the set or clear register is atomic, if both the > ARM and the PRU both use this method, no locks or other hand-shaking > is required to prevent corruption. > > -- > Charles Steinkuehler > [email protected] It has long been programing technique to use DATAOUT |= BITx to set a register bit DATAOUT &= (~BITx) to clear a register bit, or something like if(DATAOUT & BITx){} or if((DATAOUT &BITx) == 0 or 1) to read a bit from a register. So I'm having a very hard time taking what you're saying without a grain of salt. Especially after having read that section of the TRM in detail, and not getting what you got from it. But I do feel that if you read a gpio register bit first, before writing to it there should be no contention as to what the register should be. With that said, I've only ever used /dev/mem + mmap(), but have never done this with a PRU to date. So, while I do firmly believe in what I say above, I do have respect for what you're saying. Plus I do know you have hands on with the PRU . . . I wonder if anyone could whip up a test case for others to play around with- to demonstrate this ? -- 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/CALHSORr_8zckA59v6qwp50D3mookqT2Sr2tg1-3Vi2gQZjGzdw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
