Example Code For Query Semaphore - Analog Devices Blackfin ADSP-BF537 Hardware Reference Manual

Hide thumbs Also See for Blackfin ADSP-BF537:
Table of Contents

Advertisement

Semaphore coherency is guaranteed by using the test and set byte (atomic)
instruction (
TESTSET
• 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
• 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
memory where the address is located is acquired and not relinquished
until the store operation completes. In multithreaded systems, the
instruction is required to maintain semaphore consistency.
To ensure that the store operation is flushed through any store or write
buffers, issue an
The
instruction can be used to implement binary semaphores or
TESTSET
any other type of mutual exclusion method. The
ports a system-level requirement for a multicycle bus lock mechanism.
The processor restricts use of the
ory region only. Use of the
of the memory map may result in unreliable behavior.

Example Code for Query Semaphore

Listing 21-1
provides an example of a query semaphore that checks the
availability of a shared resource.
ADSP-BF537 Blackfin Processor Hardware Reference
). The
TESTSET
if the value is equal to zero.
TESTSET
instruction immediately after semaphore release.
SSYNC
TESTSET
instruction performs these functions.
are atomic operations. The bus for the
TESTSET
instruction to the external mem-
TESTSET
instruction to address any other area
System Design
TESTSET
instruction sup-
21-3

Advertisement

Table of Contents
loading

Table of Contents