106
11100B–ATARM–31-Jul-12
SAM4S Series [Preliminary]
Condition Flags
These instructions do not change the flags.
Examples
MOV
R1, #0x1
; Initialize the ‘lock taken’ value
try
LDREX
R0, [LockAddr]
; Load the lock value
CMP
R0, #0
; Is the lock free?
ITT EQ
; IT instruction for STREXEQ and CMPEQ
STREXEQ R0, R1, [LockAddr]
; Try and claim the lock
CMPEQ
R0, #0
; Did this succeed?
BNE
try
; No – try again
....
; Yes – we have the lock
11.6.4.9
CLREX
Clear Exclusive.
Syntax
CLREX{cond}
where:
cond
is an optional condition code, see
.
Operation
Use CLREX to make the next STREX, STREXB, or STREXH instruction write 1 to its destination
register and fail to perform the store. It is useful in exception handler code to force the failure of
the store exclusive if the exception occurs between a load exclusive instruction and the match-
ing store exclusive instruction in a synchronization operation.
for more information.
Condition Flags
These instructions do not change the flags.
Examples
CLREX
Summary of Contents for SAM4S Series
Page 44: ...44 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 412: ...412 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 1105: ...1105 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 1143: ...1143 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 4 64 lead LQFP Package Drawing ...
Page 1145: ...1145 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 5 64 lead QFN Package Drawing ...