ADSP-BF537 Blackfin Processor Hardware Reference
21-3
System Design
Semaphore coherency is guaranteed by using the test and set byte (atomic)
instruction (
TESTSET
). The
TESTSET
instruction performs these functions.
• Loads the half word at memory location pointed to by a P-register.
The P-register must be aligned on a half-word boundary.
• Sets
CC
if the value is equal to zero.
• Stores the value back in its original location (but with the most sig-
nificant bit (MSB) of the low byte set to 1).
The events triggered by
TESTSET
are atomic operations. The bus for the
memory where the address is located is acquired and not relinquished
until the store operation completes. In multithreaded systems, the
TESTSET
instruction is required to maintain semaphore consistency.
To ensure that the store operation is flushed through any store or write
buffers, issue an
SSYNC
instruction immediately after semaphore release.
The
TESTSET
instruction can be used to implement binary semaphores or
any other type of mutual exclusion method. The
TESTSET
instruction sup-
ports a system-level requirement for a multicycle bus lock mechanism.
The processor restricts use of the
TESTSET
instruction to the external mem-
ory region only. Use of the
TESTSET
instruction to address any other area
of the memory map may result in unreliable behavior.
Example Code for Query Semaphore
provides an example of a query semaphore that checks the
availability of a shared resource.
Summary of Contents for Blackfin ADSP-BF537
Page 42: ...Contents xlii ADSP BF537 Blackfin Processor Hardware Reference ...
Page 90: ...Development Tools 1 32 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 138: ...Programming Examples 4 26 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 340: ...SDC Programming Examples 6 84 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 606: ...Programming Examples 9 94 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 660: ...Programming Examples 10 54 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 720: ...Electrical Specifications 11 60 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 840: ...Programming Examples 13 42 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 876: ...Programming Examples 14 36 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 938: ...Programming Examples 15 62 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 958: ...Programming Examples 17 12 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 986: ...Programming Examples 18 28 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 1162: ...G 26 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 1218: ...Index I 56 ADSP BF537 Blackfin Processor Hardware Reference ...