p1020 time base atomicity

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

p1020 time base atomicity

跳至解决方案
775 次查看
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 解答
690 次查看
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!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

1 回复
691 次查看
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!
-----------------------------------------------------------------------------------------------------------------------