p1020 time base atomicity

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

p1020 time base atomicity

Jump to solution
772 Views
bataliero
Contributor III

Hi,

I have just started working with P1020 PowerPC IC and have my first problem. I was looking into P1020 reference manual and e500 ppc documentation and cannot find answer for my question. 

How can I read 64bit value - created as two 32bit lower TBL and 32bit upper TBU registers of Time Base module - and prevent race condition? Is it guaranteed that the value will be correct (registers are latched?). Is there any assembler instruction that can read both registers in atomic way?  Where I can find this kind of info in the doc?

Regards

1 Solution
687 Views
alexander_yakov
NXP Employee
NXP Employee

Please use the following sequence:

1. Read upper part

2. Read lower part

3. Read upper part once again and compare with value, returned on step 1. If the value is the same, than you can be sure upper part is not changed during step 2, so the resulting 64-bit value is consistent.


Have a great day,
Alexander
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

1 Reply
688 Views
alexander_yakov
NXP Employee
NXP Employee

Please use the following sequence:

1. Read upper part

2. Read lower part

3. Read upper part once again and compare with value, returned on step 1. If the value is the same, than you can be sure upper part is not changed during step 2, so the resulting 64-bit value is consistent.


Have a great day,
Alexander
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------