ADSP-BF535 Blackfin Processor Hardware Reference
19-7
System Design
The
TESTSET
instruction can be used to implement binary semaphores or
any other type of mutual exclusion method (for example, counting
semaphores).
TESTSET
represents a system-level requirement for a multicy-
cle bus lock mechanism.
The ADSP-BF535 processor restricts use of the
TESTSET
instruction to the
L2 memory and external memory regions only. Use of the
TESTSET
instruction to address any other area of the ADSP-BF535 memory map
may result in unreliable behavior.
Example Code for Query Semaphore
Listing 19-1
provides an example of a query semaphore that checks the
availability of a shared resource.
Listing 19-1. Query Semaphore
/* Query semaphore. Denotes "Busy" if its value is non-zero. Wait
until free (or re-schedule thread-- see note below). P0 holds
address of semaphore. */
QUERY:
TESTSET ( P0 ) ;
IF !CC JUMP QUERY ;
/* At this point, semaphore has been granted to current thread,
and all other contending threads are postponed because semaphore
value at [P0] is non-zero. Current thread could write thread_id
to semaphore location to indicate current owner of resource. */
R0.L = THREAD_ID ;
B[P0]=R0 ;
/* When done using shared resource, write a zero-byte to [P0] */
R0 = 0 ;
B[P0] = R0 ;
SSYNC ;
Summary of Contents for ADSP-BF535 Blackfin
Page 80: ...Development Tools 1 26 ADSP BF535 Blackfin Processor Hardware Reference...
Page 312: ...Working With Memory 6 86 ADSP BF535 Blackfin Processor Hardware Reference...
Page 332: ...System Interfaces 7 20 ADSP BF535 Blackfin Processor Hardware Reference...
Page 360: ...Dynamic Power Management Controller 8 28 ADSP BF535 Blackfin Processor Hardware Reference...
Page 446: ...Beginning and Ending an SPI Transfer 10 40 ADSP BF535 Blackfin Processor Hardware Reference...
Page 522: ...Timing Examples 11 76 ADSP BF535 Blackfin Processor Hardware Reference...
Page 562: ...IrDA Support 12 40 ADSP BF535 Blackfin Processor Hardware Reference...
Page 608: ...PCI I O Issues 13 46 ADSP BF535 Blackfin Processor Hardware Reference...
Page 672: ...References 14 64 ADSP BF535 Blackfin Processor Hardware Reference...
Page 810: ...SDRAM Controller SDC 18 86 ADSP BF535 Blackfin Processor Hardware Reference...
Page 811: ...ADSP BF535 Blackfin Processor Hardware Reference 18 87 External Bus Interface Unit...
Page 812: ...SDRAM Controller SDC 18 88 ADSP BF535 Blackfin Processor Hardware Reference...
Page 860: ...DMA Bus Debug Registers 20 30 ADSP BF535 Blackfin Processor Hardware Reference...