Example: Sharing A Dma Channel With Reflective Semaphores - Analog Devices ADSP-2106x SHARC User Manual

Table of Contents

Advertisement

7.6.1

Example: Sharing A DMA Channel With Reflective Semaphores

A single DMA channel can be shared by more than one ADSP-2106x
by using the channel's control register as a reflective semaphore. The
DMA channel control register is a memory-mapped IOP register on
each ADSP-2106x. If the control register is equal to zero, the channel is
disabled and is not being used by any processor. If the control register
is non-zero, the DMA channel is in use.
Before an ADSP-2106x can use the DMA channel, it must read the
semaphore to determine if the channel is in use. If not, the ADSP-2106x
can request bus lock and then execute a read-modify-write operation
to set the semaphore on each of the processors sharing the DMA
channel. Before performing the read-modify-write, though, the
ADSP-2106x should recheck the semaphore to assure that the DMA
channel is still free. Once this is done, the ADSP-2106x should clear the
BUSLK bit to unlock the bus and can proceed with the DMA
transfer(s). When the transfer(s) are completed, this ADSP-2106x must
clear the semaphore to tell the other processors that the channel is
available for use.
The following code performs the read-modify-write operation
described above:
#define semaphore 0x0038001C
...
BIT SET MODE2 BUSLK;
IF NOT BM JUMP(PC,0);
USTAT1=DM(SYSTAT);
BIT TST USTAT1 0X1000;
IF NE JUMP (PC,-2);
R0=DM(semaphore);
R0=PASS RO
IF NE JUMP(PC,3);
R0=R0+1;
DM(semaphore)=R0;
BIT CLR MODE2 BUSLK;
Notes:
1.) The IF NOT BM JUMP(PC,0) instruction through the IF NE JUMP (PC, -2)
instruction is only necessary for internal semaphores.
2.) The R0=DM(semaphore) instruction will not be executed until bus mastership is
acquired and locked.
3.) The DM(semaphore)=R0 instruction is a broadcast write.
www.BDTIC.com/ADI
Multiprocessing
/* Broadcast write to
/* DMAC6 control register */
/* on all ADSP-2106xs.
/* Request bus lock
/* Wait for bus mastership
/* Check Direct Write Pending */
/* Status to ensure no
writes happen
/* After bus lock
/* Read semaphore
/* Set condition codes
/* Test semaphore - don't write
if resource is unavailable.*/
/* Modify semaphore
/* Write semaphore
/* Release bus lock
7
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
7 – 31

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ADSP-2106x SHARC and is the answer not in the manual?

Questions and answers

Table of Contents