Harness the Power of EDMA3 - TI.com

87
Harness the Power of EDMA3 Randy Preskitt Sr. Member Technical Staff DSP Field Apps Dallas, Texas

Transcript of Harness the Power of EDMA3 - TI.com

Page 1: Harness the Power of EDMA3 - TI.com

Harness the Power of EDMA3

Randy PreskittSr. Member Technical StaffDSP Field AppsDallas, Texas

Page 2: Harness the Power of EDMA3 - TI.com

Harness the Power of EDMA3

• Does your DSP have EDMA3?• Introduction to EDMA3• Use CSL 3 to program EDMA3• Tips, tricks, tools, techniques

Page 3: Harness the Power of EDMA3 - TI.com

Harness the Power of EDMA3

• Does your DSP have EDMA3?• Introduction to EDMA3• Use CSL 3 to program EDMA3• Tips, tricks, tools, techniques

Page 4: Harness the Power of EDMA3 - TI.com

Which DSPs Have EDMA3?• All C64x+ devices:

– C6451, C6452, C6454, C6455

– TCI6482– DM6441, DM6443, DM6446– DM6431, DM6433, DM6435,

DM6437– DM647, DM648– C6421, C6424– LP64x– Any new C64x+ DSPs

Page 5: Harness the Power of EDMA3 - TI.com

Harness the Power of EDMA3

• Does your DSP have EDMA3?• Introduction to EDMA3• Use CSL 3 to program EDMA3• Tips, tricks, tools, techniques

Page 6: Harness the Power of EDMA3 - TI.com

Introduction to EDMA3

• Channel Controller (CC)– Accepts and coordinates events– Sends Transfer Requests (TRs) to TC

• Transfer Controller (TC)– Handles actual transfers– Optimizes transfers for both source and

destination• Can do all the data movement for the CPU

Page 7: Harness the Power of EDMA3 - TI.com

EDMA Events

TC0

TC1CC

System Architecture: DM644x• ARM, DSP and VPSS

have direct access to crossbar switch.

• Transfer Controllers have their own crossbar ports, too.

• Other master peripherals share a crossbar port.

• Slave peripherals are accessed by masters via the crossbar, aka Shared Central Resource (SCR).

ARM

C64+ CPU

IAHBDAHB

VFEVBEVP

SS

Masters

AR

MD

SPD

DR

CFG

CrossbarARM

Memory

C64+ Memory

DDR EMIF

IMX

CFG

1C

FG0

Slaves

Async EMIF

MMC/SDMcBSP

Mem Stk

UART(x3)

PWM(x3)SPIIIC

Timer/WDT(x3)

CFGXBAR

ARM

C64+ CPU

IAHBDAHB

VFEVBEVP

SS

EDMA Events

TC0

TC1CC

VLYNQ

UHPI

ATA/CFC

EMAC

USB

VLYNQ

UHPI

ATA/CFC

EMAC

USB

Shared Central Resource

(SCR)

Page 8: Harness the Power of EDMA3 - TI.com

C64+ CPU

Rapid IO

C64+ CPU

PCI66

HPI

EMAC

Rapid IO

EventsCC

TC0

TC1

TC0

TC1

PCI66

HPI

EMAC

System Architecture: C645x• C64x CPU and

RapidIO have their own SCR ports.

• Four Transfer Controllers have their own SCR ports.

• Lower-bandwidth master peripherals share a port.

• Slave peripheral ports are shared depending on VBUS frequencies and widths. EMIFshave their own ports.

Shared Central

Resource(SCR)

MastersSlaves

TCP

VCP

GEM

DDR EMIF

EMIF64

TCP

VCP

CFGXBAR

C64+ Memory

DDR EMIF

EMIF64

PCI66

McBSP

Utopia

EventsCC

TC0

TC1

TC0

TC1

TCP

VCP

GEM

DDR EMIF

EMIF64

TCP

VCP

CFGXBAR

C64+ Memory

DDR EMIF

EMIF64

PCI66

McBSP

Utopia

Page 9: Harness the Power of EDMA3 - TI.com

Channel Controller Architecture

Event RegisterEvent RegisterEvent EnableEvent Enable

RegisterRegister

Event SetEvent SetRegister (ESR)Register (ESR)

Chain EventChain EventRegister (CER)Register (CER)

QDMA EventQDMA EventRegister (QER)Register (QER)

PeripheralsPeripherals

88

64:164:1Priority Priority EncoderEncoder

8:18:1Priority Priority EncoderEncoder

6464

6464

6464

Interrupt Pending Register IPRInterrupt Pending Register IPR

Interrupt Enable Register IERInterrupt Enable Register IEREDMAINTEDMAINT TCTCCompletionCompletion

PSET1PSET1PSET2PSET2

PSET254PSET254PSET255PSET255

TCTCTRSubmit

PSET0PSET0MMaaPPPPIINNgg

Q0Q0

Q1Q1

Q2Q2

Q3Q3

MMaappppiinngg

Q0Q0

Q1Q1

Q2Q2

Q3Q3

Page 10: Harness the Power of EDMA3 - TI.com

EDMA3 Channel Trigger TypesEach of the 64 DMA channels can be triggered by any of the following:• Event Triggering:

– Used for peripheral driven transfers, such as McBSP, Utopia, etc.– “Triggered” by assertion of enabled Event Input signal.– Events captured in Event Register (ER[63:0]).– Events enabled in Event Enable Register (EER[63:0]).

• Chain Triggering: – Used to execute multiple Transfer Requests upon receipt of a single event.

For example: • Ch0 is “Event Triggered” by Event0. • Ch0 completion can “chain-trigger” to Ch1 by programming OPT.TCC=1.

– Chain Events captured in Chain Event Register (CER[63:0]).– Event does not need to be enabled.

• Manual Triggering: – Used to initiate a Transfer Request under CPU control.– Each Active Channel PaRAM entry can be “manually triggered” by the CPU

writing a “1” to the corresponding bit of the “Event Set Register” (ESR[63:0]).– Event does not need to be enabled.

Page 11: Harness the Power of EDMA3 - TI.com

C6455 EDMA3 Events

• McBSP XEVT0/1• McBSP REVT0/1• UREVT• UXEVT• RIOINT1• VCP2REVT• VCP2XEVT• TCP2REVT• TCP2XEVT

• TEVTLO0• TEVTHI0• TEVTLO1• TEVTHI1• GPINT[15:0]• DSP_EVT• ICREVT• ICXEVT

Page 12: Harness the Power of EDMA3 - TI.com

Transfer Controller ArchitectureSPRU966a• CC sends a

Transfer Request (TR).

• New TR waits in prog reg set.

• Current TR runs in active register set.

• Read ctlr pulls data into FIFOs.

• Write ctlroptimizes writes for dest.

• Multiple TR reads can be buffered in FIFOs waiting to write.

in EDMA3CC

Page 13: Harness the Power of EDMA3 - TI.com

Channel Controller Architecture

Event RegisterEvent RegisterEvent EnableEvent Enable

RegisterRegister

Event SetEvent SetRegister (ESR)Register (ESR)

Chain EventChain EventRegister (CER)Register (CER)

QDMA EventQDMA EventRegister (QER)Register (QER)

PeripheralsPeripherals

88

64:164:1Priority Priority EncoderEncoder

8:18:1Priority Priority EncoderEncoder

6464

6464

6464

Interrupt Pending Register IPRInterrupt Pending Register IPR

Interrupt Enable Register IERInterrupt Enable Register IEREDMAINTEDMAINT TCTCCompletionCompletion

PSET1PSET1PSET2PSET2

PSET254PSET254PSET255PSET255

TCTCTRSubmit

PSET0PSET0MMaaPPPPIINNgg

Q0Q0

Q1Q1

Q2Q2

Q3Q3

MMaappppiinngg

Q0Q0

Q1Q1

Q2Q2

Q3Q3

Page 14: Harness the Power of EDMA3 - TI.com

Event Mapping

E63E63

E1E1E2E2

......

E0E0

QDMA0QDMA0

……

……QDMA7QDMA7

PSET63PSET63

PSET 1PSET 1

PSET 2PSET 2

......

PSET 0PSET 0

PSET64PSET64

……

……

PSET 254PSET 254

PSET 255PSET 255

Default Mapping

PSET63PSET63

PSET 1PSET 1

PSET 2PSET 2

......

PSET 0PSET 0

QDMA0QDMA0

QDMA1QDMA1

……

LINKLINK

LINKLINK

• Default mapping:– E0 – PSET0– QDMA0 – PSET0

• Mapping of events to PSET controlled by registers.

Page 15: Harness the Power of EDMA3 - TI.com

Event Mapping

E63E63

E1E1E2E2

......

E0E0

QDMA0QDMA0

……

……QDMA7QDMA7

PSET63PSET63

PSET 1PSET 1

PSET 2PSET 2

......

PSET 0PSET 0

PSET64PSET64

……

……

PSET 254PSET 254

PSET 255PSET 255

PSET63PSET63

PSET 1PSET 1

PSET 2PSET 2

......

PSET 0PSET 0

QDMA0QDMA0

QDMA1QDMA1

……

LINKLINK

LINKLINK

Remapped• Default mapping:

– E0 – PSET0– QDMA0 – PSET0

• Mapping of events to PSET controlled by registers.

Page 16: Harness the Power of EDMA3 - TI.com

Parameter RAM Sets

• Up to 512 PSETs available (dependent on device, 256 in C6455).• Each PSET can be used for DMA, QDMA or link sets.

PSET63PSET63

PSET 1PSET 1

PSET 2PSET 2

......

PSET 0PSET 0

……

……

PSET 255PSET 255

OptionsOptionsSourceSource

DestinationDestination

3131 1616 1515 00

BCNTBCNT ACNTACNT

DSTBIDXDSTBIDX SRCBIDXSRCBIDX

DSTCIDXDSTCIDX SRCCIDXSRCCIDX

LINKLINKBCNTRLDBCNTRLD

RSVDRSVD CCNTCCNT

Page 17: Harness the Power of EDMA3 - TI.com

Parameter RAM Entries• Options• Source and Destination addresses• ACNT/BCNT/CCNT

– Number of bytes to transfer for each of the three dimensions.• SRCBIDX/DSTBIDX

– Number of bytes from start of one array to start of the next array, the second dimension.

• BCNTRLD– Parameter entry used to reload BCNT during three-dimensional transfers.

• SRCCIDX/DSTCIDX– Number of bytes from start of one frame to start of the next frame, the

third dimension.• LINK

– Pointer to another PSET to be copied when this one is exhausted.

Page 18: Harness the Power of EDMA3 - TI.com

EDMA Terminology• Truly orthogonal transfer defined in three dimensions.• Array 1st dimension that consists of contiguous ACNT bytes.• Frame 2nd dimension of BCNT arrays of ACNT bytes.• Block 3rd dimension of CCNT frames of BCNT arrays of ACNT bytes• Minimum transfer is one frame of one array of ACNT bytes.

Array 1Array 1 Array 2Array 2

Array 1Array 1

Array 1Array 1

Array BCNTArray BCNT

Array BCNTArray BCNT

Array BCNTArray BCNT

……..

……..

……..…….. …….. ……..

Frame 1

Frame 2

Frame CCNT

CCNTFrames

ACNT Bytes

BCNT Arrays

Array 2Array 2

Array 2Array 2

Page 19: Harness the Power of EDMA3 - TI.com

“A” Synchronized Transfer“A” synchronized transfers: Each event triggers the transfer of exactly one array of ACNT bytes.

Array 1Array 1 Array 2Array 2

Array 2Array 2Array 1Array 1

Array 1Array 1 Array 2Array 2

Array BCNTArray BCNT

Array BCNTArray BCNT

Array BCNTArray BCNT

……..

……..

……..

…….. …….. ……..

Frame 0

Frame 1

Frame CCNT

Page 20: Harness the Power of EDMA3 - TI.com

“AB” Synchronized Transfer“AB” synchronized transfer: Each event triggers a two-dimensional transfer of BCNT arrays of ACNT bytes.

Array 1Array 1 Array 2Array 2

Array 2Array 2Array 1Array 1

Array 1Array 1 Array 2Array 2

Array BCNTArray BCNT

Array BCNTArray BCNT

Array BCNTArray BCNT

……..

……..

……..

…….. …….. ……..

Frame 0

Frame 1

Frame CCNT

Page 21: Harness the Power of EDMA3 - TI.com

ELEIDXELEIDX

Indexed TransfersEDMA2 used a single set of element index (ELEIDX) and frame index (FRMIDX) for both source and destination.

159

13

371115

SRCSRC

ELEIDXELEIDX

1 35 79 1113 15

DSTDST159

13

371115

SRCSRCFRMIDXFRMIDXFRMIDXFRMIDX

Page 22: Harness the Power of EDMA3 - TI.com

EDMA3 is more flexible, and indexing is always “on.”• Four index fields for source and destination indexing in B and C

dimensionsSRCBIDXSRCBIDX

Indexed Transfers

159

13

371115

SRCSRC

DSTBIDXDSTBIDX

7

1

5

3

9 11

DSTDST

DSTCIDXDSTCIDXSRCCIDX SRCCIDX

• Even if you don’t need indexing, you will use indexing.Set BIDX=ACNT for continuously incrementing SRC or DST.

Page 23: Harness the Power of EDMA3 - TI.com

Linking Transfers: Set Up Three PSETs

PSET0

PSET1

PSET2

….

PSET254

PSET255

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCEOPTOPT

LINKOPTOPT

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCE

0xFFFF

PSET2

PSET42

PSET255

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCE

LINK

OPTOPT

Page 24: Harness the Power of EDMA3 - TI.com

PSET0

PSET1

PSET2

….

PSET254

PSET255

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCEOPTOPT

LINKOPTOPT

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCE

0xFFFF

PSET2

PSET42

PSET255

TR Submitted to TCTR Submitted to TC

PSET2

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCE

LINK

OPTOPTLinking Transfers: First Trigger Event

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCEOPTOPT

LINK

Page 25: Harness the Power of EDMA3 - TI.com

PSET0

PSET1

PSET2

….

PSET254

PSET255

PSET2PSET2

Linking Transfers: Second Trigger Event

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCEOPTOPT

LINKOPTOPT

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCE

0xFFFF

PSET42

PSET255

TR Submitted to TCTR Submitted to TC

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCEOPTOPT

LINK

OPTOPT

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCE

0xFFFF

Page 26: Harness the Power of EDMA3 - TI.com

OPTOPT

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCE

0xFFFF

OPTOPT

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCE

0xFFFF0 00 00 0 ffffffff0 00 00 00 0

000 00 0

0000

PSET0

PSET1

PSET2

….

PSET254

PSET255

PSET2

Linking Transfers: Third Trigger Event

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCEOPTOPT

LINKOPTOPT

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCE

0xFFFF

PSET42

PSET255

TR Submitted to TCTR Submitted to TC

Page 27: Harness the Power of EDMA3 - TI.com

Linking Transfers: If Another Event?

PSET0

PSET1

PSET2=0s

….

PSET254

PSET255

PSET 42

PSET255

Missed Event!

• Event Missed Register (EMR) set.• Secondary Event Register (SER) remains set.• You must clear these before more events on this channel.

Page 28: Harness the Power of EDMA3 - TI.com

• Linking updates event parameters to re-initialize the PSET.

• Linking is always enabled in EDMA3. All transfers must link to either:

– Valid link entry– NULL entry

• LINK entry points to PSET from which to load the next configuration.

• If linking is not desired, LINK field needs to be set to 0xFFFF, which causes CC to automatically generate a NULL entry. (User does not need to create a NULL entry in the PSET.) All fields are 0x0000 (LINK remains 0xFFFF).

• Link update occurs when event is extracted from event queue and submitted as TR packet to TC and the parameter configuration is exhausted.

Linking Transfers

PSET0

PSET1

PSET2

….

PSET254

PSET255

PSET 42

PSET255

Page 29: Harness the Power of EDMA3 - TI.com

Transfer Completion Code (TCC)

• Several fields in the OPT register define how and when a TCC is generated.

• Generated by the Channel Controller when a TR is submitted (early mode) or by the Transfer Controller when a transfer is completed (normal mode).

The transfer completion code (TCC) provides a signaling mechanism to generate an interrupt to the CPU and/or trigger another channel (chaining) when a transfer is completed.

Page 30: Harness the Power of EDMA3 - TI.com

• Transfer complete code (TCC)– Indicates that the whole transfer has completed.– Can be sent after submitting the last TR to TC (Early

mode) or peripheral acknowledgement (Normal mode).

– CER is set if selected by TCCHEN for chaining.– IPR is set if selected by TCINTEN for interrupting.

[Final] Transfer Complete CodeRSVD ITCCHEN TCC RSVD STATICFWIDRSVD

3781011121719202122232431TCCMODETCCHEN ITCINTEN TCINTEN RSVD

18RSVD

6SYNCDIM

2DAM

1SAM

0

Early Completion mode (TCC from Channel Controller)

TR TR TR TR TR TR TR TR TR

EVTx EVTx EVTx EVTx EVTx EVTx EVTx EVTx EVTx TCC

Page 31: Harness the Power of EDMA3 - TI.com

• Transfer complete code (TCC)– Indicates that the whole transfer has completed.– Can be sent after submitting the last TR to TC (Early

mode) or peripheral acknowledgement (Normal mode).

– CER is set if selected by TCCHEN for chaining.– IPR is set if selected by TCINTEN for interrupting.

[Final] Transfer Complete CodeRSVD ITCCHEN TCC RSVD STATICFWIDRSVD

3781011121719202122232431TCCMODETCCHEN ITCINTEN TCINTEN RSVD

18RSVD

6SYNCDIM

2DAM

1SAM

0

Normal Completion mode (TCC from Transfer Controller)

TR TR TR TR TR TR TR TR TR

EVTx EVTx EVTx EVTx EVTx EVTx EVTx EVTx EVTx TCC

TCAck

Page 32: Harness the Power of EDMA3 - TI.com

• Intermediate transfer complete code (ITCC)– Indicates a TR has been submitted (except the last).– Can be sent after submitting all but the last TR to TC

(Early mode) or all but the last peripheral acknowledgement through TC (Normal mode).

– CER is set if selected by ITCCHEN for chaining.– IPR is set if selected by ITCINTEN for interrupting.

Intermediate TCC

TR TR TR TR TR TR TR TR TR

EVTx EVTx EVTx EVTx EVTx EVTx EVTx EVTx EVTx

TCC[6:0] TCC[6:0] TCC[6:0] TCC[6:0] TCC[6:0] TCC[6:0] TCC[6:0] TCC[6:0]

Page 33: Harness the Power of EDMA3 - TI.com

“ABC” Synchronized Transfer?• “ABC” synchronized transfer: Would like a single

event to trigger the whole three-dimensional transfer.

• AB-sync + chaining to itself will work.• At the end, link to something new and chain to it, too!

Array 2Array 2 Array BCNTArray BCNT

Array BCNTArray BCNT

Array BCNTArray BCNT

……..

……..

……..…….. …….. ……..

Frame 1

Frame 2

Frame CCNT

Array 2Array 2

Array 2Array 2

Array 1Array 1

Array 1Array 1

Array 1Array 1

Page 34: Harness the Power of EDMA3 - TI.com

DMA, QDMA, IDMA• DMA

– Usually runs in background (pgm not waiting).– Peripheral/event driven.– Chaining and linking relieve CPU loading.

• QDMA– Can run in background (pgm not waiting). – Often runs in foreground (pgm waiting).– CSL DAT module uses QDMA for copy and fill operations.– Four QDMA channels on C6455.

• IDMA– Specialized for “internal” transfers.– IDMA0: L1/L2<->Config Bus

• Source and destination must be aligned to a 32-byte boundary.• Note: SPRU871d mistakenly says 32-word alignment.

– IDMA1: L2<->L1

Page 35: Harness the Power of EDMA3 - TI.com

QDMA Path Through CC

Event RegisterEvent RegisterEvent EnableEvent Enable

RegisterRegister

Event SetEvent SetRegister (ESR)Register (ESR)

Chain EventChain EventRegister (CER)Register (CER)

QDMA EventQDMA EventRegister (QER)Register (QER)

PeripheralsPeripherals

88

64:164:1Priority Priority EncoderEncoder

8:18:1Priority Priority EncoderEncoder

6464

6464

6464

Interrupt Pending Register IPRInterrupt Pending Register IPR

Interrupt Enable Register IERInterrupt Enable Register IEREDMAINTEDMAINT TCTCCompletionCompletion

PSET1PSET1PSET2PSET2

PSET254PSET254PSET255PSET255

TCTCTRSubmit

PSET0PSET0MMaaPPPPIINNgg

Q0Q0

Q1Q1

Q2Q2

Q3Q3

MMaappppiinngg

Q0Q0

Q1Q1

Q2Q2

Q3Q3

Page 36: Harness the Power of EDMA3 - TI.com

QDMA Channel MappingSPRU871d

Page 37: Harness the Power of EDMA3 - TI.com

QDMA Channel Trigger Types• Auto-Triggering

– QDMA Channels allow for CPU to initiate DMA transfers with a minimum number of writes. – QDMA Channel is “auto-triggered” when CPU writes to the “trigger” word of specified

QDMA Channel Entry. – Eliminates need to write to PaRAM entry and kick off transfer with separate write to ESR

(Event Set Register).– Trigger Word is user-programmed for each QDMA Channel to any location in PaRAM

address space (QCHMAP register).– Selection of Trigger Word allows CPU to modify only words of interest in a PaRAM Set.

For example, if CNT is typically static for a given algorithm, but SRC is different from transfer to transfer, then SRC could be defined as the trigger word. CPU can initiate a DMA transfer with as few as one write to SRC for the specified PaRAM Set.

– Assumes OPT.STATIC = 1. Count and address updates or linking not performed. Otherwise it could trigger unexpected transfer requests.

• LINK Triggering– If OPT.STATIC=0, copying the LINK PSET will write to the trigger word.– Should choose Trigger Word=7 (CCNT) so everything is copied before triggering.

• Optimized for C64x IDMA– C64x+ IDMA transfers to a linear range of memory with a mask to enable/disable transfers

to specific words within the linear range. – IDMA can stride across multiple QDMA Channels to perform several QDMA submissions.

Page 38: Harness the Power of EDMA3 - TI.com

QDMA Auto-Trigger: Set Channel Mapping

E63E63

E1E1E2E2

......

E0E0

QDMA0QDMA0

……

……QDMA7QDMA7

PSET63PSET63

PSET 1PSET 1

PSET 2PSET 2

......

PSET 0PSET 0

PSET64PSET64

……

……

PSET 254PSET 254

PSET 255PSET 255

PSET63PSET63

PSET 1PSET 1

PSET 2PSET 2

......

PSET 0PSET 0

PSET64PSET64

PSET65PSET65

……

LINKLINK

LINKLINK

Remapped • QDMA channels remapped– QDMA0 => PSET64

Page 39: Harness the Power of EDMA3 - TI.com

PSET0

PSET1

PSET2

PSET64

PSET254

PSET255

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCEOPTOPT

LINK

QDMA Auto-Trigger: Select Trigger Word

Trigger word

Page 40: Harness the Power of EDMA3 - TI.com

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCEOPT.staticOPT.static=1=1

LINK

TR submitted to TCTR submitted to TC

QDMA Auto-Trigger: Write 8 Words

Trigger word

CPU writes:Request to CC queueRequest to CC queue

thenthen

Page 41: Harness the Power of EDMA3 - TI.com

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCEOPT.staticOPT.static=1=1

LINK

TR Submitted to TCTR Submitted to TC

QDMA Auto-Trigger: Write 3 Words

Trigger word

CPU writes:Request to CC queueRequest to CC queue

thenthen

Page 42: Harness the Power of EDMA3 - TI.com

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCEOPTOPT

LINK

PSET0

PSET1

PSET2

PSET64

PSET254

PSET255

OPT.staticOPT.static=0=0

LINK

QDMA Auto-Trigger: Link Triggering 1

Trigger word

Trigger must be 7 because all 8 words will be written

Link to any filled PSET

STATIC=0 so link will occur

Page 43: Harness the Power of EDMA3 - TI.com

DSTBIDX SRCBIDXDSTBIDX SRCBIDXBCNTRLD LINKBCNTRLD LINK

DSTCIDX SRCCIDXDSTCIDX SRCCIDXRSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCEOPT.staticOPT.static=0=0

LINKDSTBIDX SRCBIDXDSTBIDX SRCBIDX

BCNTRLD LINKBCNTRLD LINKDSTCIDX SRCCIDXDSTCIDX SRCCIDX

RSVD CCNTRSVD CCNT

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCEOPT.staticOPT.static=1=1

LINK

QDMA Auto-Trigger: Link Triggering 2

Trigger word

CPU writes:

……thenthenTR submitted to TCTR submitted to TC

Request to CC queueRequest to CC queue

……thenthennew PSET copied to PSET64,new PSET copied to PSET64,including writing to triggerincluding writing to trigger

……thenthenTR submitted to TCTR submitted to TC

……thenthenRequest to CC queueRequest to CC queue

Page 44: Harness the Power of EDMA3 - TI.com

IDMA0#include <csl_idma.h>IDMA0_init( IDMA_INT_EN ); // enable interrupt, or notIDMA0_configArgs( Mask, Src, Dst, BlockCnt-1 );IDMA0_wait(); // optional

SPRU871d

0 = DO copy (not masked)

Page 45: Harness the Power of EDMA3 - TI.com

IDMA1#include <csl_idma.h>

IDMA1_init( IDMA_PRI_7, IDMA_INT_EN ); // set priority, enable interrupt

IDMA1_copy( Src, Dst, ByteCnt );

IDMA1_fill( Dst, ByteCnt, FillWord );

IDMA1_wait(); // optional

Page 46: Harness the Power of EDMA3 - TI.com

Comparison of ‘C6455 and ‘LP64x Channel Controller Features

No YesMemory Protection Support

No YesDMA Channel Mapping

28Number of Regions

34Number of Transfer Controllers

34Number of Queues

128256Number of PaRAM Entries

6464Number of Interrupt Channels (TCC)

84Number of QDMA Channels

6464Number of DMA Channels

‘LP64 *‘C6455Channel Controller Feature

* Preliminary Info – Subject to Change

Page 47: Harness the Power of EDMA3 - TI.com

Comparison of ‘C6455 and ‘LP64x Transfer Controller Features

x64 bytesDBS

x16 bytesBUSWIDTH

x256 bytesFIFOSIZE

TC3

64 bytes**64 bytesDBS

4 entries4 entriesDSTREGDEPTH

8 bytes16 bytesBUSWIDTH

128 bytes256 bytesFIFOSIZE

TC2

32 bytes**64 bytesDBS

4 entries4 entriesDSTREGDEPTH

8 bytes16 bytesBUSWIDTH

256 bytes128 bytesFIFOSIZE

TC1

16 bytes**64 bytesDBS

4 entries2 entriesDSTREGDEPTH

8 bytes16 bytesBUSWIDTH

128 bytes128 bytesFIFOSIZE

TC0

‘LP64 *‘C6455ConfigurationTransfer Controllers

* Preliminary Info – Subject to Change

** DBS is programmable on LP (16, 32 or 64 bytes). Defaults are shown.

Page 48: Harness the Power of EDMA3 - TI.com

Harness the Power of EDMA 3

• Does your DSP have EDMA3?• Introduction to EDMA3• Use CSL 3 to program EDMA3• Tips, tricks, tools, techniques

Page 49: Harness the Power of EDMA3 - TI.com

Use CSL 3 to Program EDMA3

• A simple transfer example using a global channel region

• The changes to use a shadow region• The changes to cause an interrupt

– Use EDMA interrupt dispatcher provided with CSL 3

• DAT CSL for QDMA transfers• QDMA CSL

Page 50: Harness the Power of EDMA3 - TI.com

A Single Transfer Using CSL 3CSL_edma3Init();CSL_edma3Open(&edmaObj,CSL_EDMA3,,);CSL_edma3HwSetup(hModule,);

CSL_edma3ChannelOpen(&chObj, CSL_EDMA3,,); CSL_edma3GetHwChannelSetupParam(hChannel,); CSL_edma3GetParamHandle(hChannel,,);CSL_edma3ParamSetup(hParam,);CSL_edma3HwChannelControl(hChannel,,);

CSL_edma3HwChannelControl(hChannel,,); CSL_edma3GetHwStatus(hModule,,);CSL_edma3HwControl(hModule,,);

CSL_edma3ChannelClose(hChannel);CSL_edma3Close(hModule);

Initialize EDMA3

Prepare channel

Run

Close, if needed

Page 51: Harness the Power of EDMA3 - TI.com

A Single Transfer: Initialize EDMA3#include <csl_edma3.h>

CSL_Edma3Context context;CSL_Status status;CSL_Edma3Handle hModule;CSL_Edma3Obj edmaObj;

// Init is a CSL placeholder function for consistency.status = CSL_edma3Init(&context);

// Open populates the Object and returns the Module handle.hModule = CSL_edma3Open(&edmaObj,CSL_EDMA3,NULL,&status);

Page 52: Harness the Power of EDMA3 - TI.com

A Single Transfer: Initialize EDMA3CSL_Edma3HwSetup hwSetup;CSL_Edma3HwDmaChannelSetup dmahwSetup [CSL_EDMA3_NUM_DMACH]

= CSL_EDMA3_DMACHANNELSETUP_DEFAULT;CSL_Edma3HwQdmaChannelSetup qdmahwSetup[CSL_EDMA3_NUM_QDMACH]

= CSL_EDMA3_QDMACHANNELSETUP_DEFAULT;

dmahwSetup[CSL_EDMA3_CHA_DSP_EVT].paramNum= CSL_EDMA3_CHA_DSP_EVT;

dmahwSetup[CSL_EDMA3_CHA_DSP_EVT].que= CSL_EDMA3_QUE_0;

hwSetup.dmaChaSetup = dmahwSetup;hwSetup.qdmaChaSetup = qdmahwSetup;

// HwSetup maps DMA/QDMA channels to CC PaRAM sets and to CC queues.status = CSL_edma3HwSetup(hModule,&hwSetup);

Page 53: Harness the Power of EDMA3 - TI.com

A Single Transfer: Prepare ChannelCSL_Edma3ChannelObj chObj;CSL_Edma3ChannelAttr chAttr;

// for global region, just open the channel and continue:chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;chAttr.chaNum = CSL_EDMA3_CHA_DSP_EVT;hChannel = CSL_edma3ChannelOpen(&chObj, CSL_EDMA3, &chAttr, &status);

Page 54: Harness the Power of EDMA3 - TI.com

A Single Transfer: Prepare ChannelCSL_Edma3ChannelObj chObj;CSL_Edma3ChannelAttr chAttr;

// for shadow region, enable shadow region access, then open the channel.// set bits in DRAEn/DRAEHn (OR function), use _DISABLE to clear bits.regionAccess.region = CSL_EDMA3_REGION_5 ;regionAccess.drae = (1 << CSL_EDMA3_CHA_DSP_EVT) // must have access

|(1 << CSL_EDMA3_CHA_8); // to channel and tccregionAccess.draeh = 0; // if differentstatus = CSL_edma3HwControl(hModule,

CSL_EDMA3_CMD_DMAREGION_ENABLE, &regionAccess);

/* Open the channel in context of shadow region 5 */chAttr.regionNum = CSL_EDMA3_REGION_5;chAttr.chaNum = CSL_EDMA3_CHA_DSP_EVT;hChannel = CSL_edma3ChannelOpen(&chObj, CSL_EDMA3, &chAttr, &status);

Page 55: Harness the Power of EDMA3 - TI.com

A Single Transfer: Prepare ChannelCSL_Edma3ParamSetup myParamSetup;

myParamSetup.option = CSL_EDMA3_OPT_MAKE( CSL_EDMA3_ITCCH_DIS, CSL_EDMA3_TCCH_EN, CSL_EDMA3_ITCINT_DIS, CSL_EDMA3_TCINT_EN,CSL_EDMA3_CHA_8, // TCCCSL_EDMA3_TCC_NORMAL,CSL_EDMA3_FIFOWIDTH_NONE, CSL_EDMA3_STATIC_DIS, CSL_EDMA3_SYNC_AB, CSL_EDMA3_ADDRMODE_INCR, CSL_EDMA3_ADDRMODE_INCR

);

Page 56: Harness the Power of EDMA3 - TI.com

A Single Transfer: Prepare ChannelmyParamSetup.srcAddr = (Uint32)srcBuf;

// note the order of the parameters is like the name: (ACNT, BCNT)// not like the PaRAM word: BCNT : ACNTmyParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(512,1);

myParamSetup.dstAddr = (Uint32)dstBuf;

// B/CIDX don’t matter in this case since BCNT = 1 and CCNT = 1myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(0,0); myParamSetup.linkBcntrld =

CSL_EDMA3_LINKBCNTRLD_MAKE(CSL_EDMA3_LINK_NULL,0); myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,0); myParamSetup.cCnt = 1;

Page 57: Harness the Power of EDMA3 - TI.com

A Single Transfer: Prepare ChannelmyParamSetup.srcAddr = (Uint32)srcBuf;

// note the order of the parameters is like the name: (ACNT, BCNT)// not like the PaRAM word: BCNT : ACNTmyParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(512,2);

myParamSetup.dstAddr = (Uint32)dstBuf;

// BIDX does matter since BCNT > 1myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(512, 512); myParamSetup.linkBcntrld =

CSL_EDMA3_LINKBCNTRLD_MAKE(CSL_EDMA3_LINK_NULL,0); myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,0); myParamSetup.cCnt = 1;

Page 58: Harness the Power of EDMA3 - TI.com

A Single Transfer: Prepare Channel// write the PaRAM setup values to PaRAM.status = CSL_edma3ParamSetup(hParamBasic, &myParamSetup);

// enable this channel by writing to EER via EESR.status = CSL_edma3HwChannelControl(hChannel,

CSL_EDMA3_CMD_CHANNEL_ENABLE, NULL);

Page 59: Harness the Power of EDMA3 - TI.com

A Single Transfer: RunCSL_edma3HwChannelControl(hChannel,

CSL_EDMA3_CMD_CHANNEL_SET,NULL);

do { /* Poll for IPR bit set */

CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);

regionIntr.intr &= 1 << CSL_EDMA3_CHA_8; // avoids clearing other IPR bits} while ( regionIntr.intr == 0 );

regionIntr.intrh = 0; // avoids clearing other IPR bitsstatus = CSL_edma3HwControl(hModule,

CSL_EDMA3_CMD_INTRPEND_CLEAR, &regionIntr);

Page 60: Harness the Power of EDMA3 - TI.com

A Single Transfer: Close// if you are done with a channel, close it.status = CSL_edma3ChannelClose(hChannel);

// if you are done with the EDMA3, close it.// (but who does except for example code?)status = CSL_edma3Close(hModule);

Page 61: Harness the Power of EDMA3 - TI.com

Cause an Interrupt When DoneCSL_intcInit(&intcContext); CSL_intcGlobalNmiEnable(); CSL_intcGlobalEnable(&state);

CSL_intcOpen (&intcObjEdma, …); CSL_intcPlugEventHandler(hIntcEdma,…);CSL_intcHwControl(hIntcEdma, …);

EdmaEventHook(tcc, isrFunctionName);

CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE, …);

[A good EDMA dispatcher is provided with CSL 3 examples.]

Initialize INTC

Prepare interrupt path from EDMA

Set up EDMA dispatcher

Enable intr from this channel in EDMA

Page 62: Harness the Power of EDMA3 - TI.com

Interrupt: Initialize INTC#include <csl_intc.h>

CSL_IntcContext intcContext; CSL_IntcEventHandlerRecord EventHandler[10];CSL_IntcGlobalEnableState state;

/* Intc module initialization */intcContext.eventhandlerRecord = EventHandler;intcContext.numEvtEntries = 10;CSL_intcInit(&intcContext);

/* Enable NMIs */CSL_intcGlobalNmiEnable();

/* Enable global interrupts */CSL_intcGlobalEnable(&state);

Page 63: Harness the Power of EDMA3 - TI.com

Interrupt: Prepare Path/* Create an INTC object, tie the event to a CPU interrupt */vectId = CSL_INTC_VECTID_4; // CPU interrupthIntcEdma = CSL_intcOpen ( &intcObjEdma,

CSL_INTC_EVENTID_EDMA3CC_INT1, // interrupt event&vectId , NULL );

/* Associate the EDMA dispatcher (event handler) with the INTC object */EventRecord.handler = &eventEdmaHandler; // eventEdmaHandler from CSL 3EventRecord.arg = (void*)( hModule ); // examples folderCSL_intcPlugEventHandler( hIntcEdma, &EventRecord );

/* Enable this interrupt within the INTC module */CSL_intcHwControl( hIntcEdma, CSL_INTC_CMD_EVTENABLE, NULL );

Page 64: Harness the Power of EDMA3 - TI.com

Interrupt: Set Up EDMA Dispatcherunsigned long long llTemp;

/* Enable interrupt in the EDMA module */regionIntr.region = CSL_EDMA3_REGION_GLOBAL;llTemp = (unsigned long long)1 << tccNumber;regionIntr.intr = _loll(llTemp); regionIntr.intrh = _hill(llTemp);status = CSL_edma3HwControl(hModule, CSL_EDMA3_CMD_INTR_ENABLE,

&regionIntr);

/* Hook up the EDMA event with an interrupt handler */EdmaEventHook(tccNumber, tccFxn);

void tccFxn(void) {

intFlag = 1;}

Page 65: Harness the Power of EDMA3 - TI.com

Interrupt: Enable Channel Interruptunsigned long long llTemp = (unsigned long long)1 << tcc;

regionIntr.region = CSL_EDMA3_REGION_1;regionIntr.intr = _loll(llTemp); // regionIntr.intr = 0x2 ;regionIntr.intrh = _hill(llTemp); // regionIntr.intrh = 0x0 ;

/* Enable interrupts by setting a bit in EDMA3’s IER/IERH */status = CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,

&regionIntr);

// make sure the channel will cause an interruptmyParamSetup.option = CSL_EDMA3_OPT_MAKE(

…CSL_EDMA3_TCINT_EN,…

Page 66: Harness the Power of EDMA3 - TI.com

DAT = QDMA Made Easy// open the DAT module, this gets one QDMA channel ready to use.DAT_open(&datSetup);

// fill function copies a single byte multiple times.DAT_fill(destAddr,byteCnt,(Uint32*)&fillVal);

// copy function does 1D copy.DAT_copy(&src1d,&dst1d,byteCnt);

// copy2d can do 1D2D, 2D1D, 2D2D copies.DAT_copy2d(DAT_1D2D,src1d,dst2d,16,8,20);

// wait, when needed.DAT_wait(tcc);

Page 67: Harness the Power of EDMA3 - TI.com

DAT Details: It’s This Easy#include <csl_dat.h>DAT_Setup datSetup;Uint8 fillVal = 0;

// initialize the DAT moduledatSetup.qchNum = CSL_DAT_QCHA_3; // pick a channeldatSetup.regionNum = CSL_DAT_REGION_GLOBAL ; // pick a regiondatSetup.tccNum = tccDat; // pick a channeldatSetup.paramNum = 255; // pick a PSETdatSetup.priority = CSL_DAT_PRI_1; // pick a CC/TC queDAT_open(&datSetup);

DAT_fill(destAddr,byteCnt,(Uint32*)&fillVal);

DAT_wait(tccDat);

Page 68: Harness the Power of EDMA3 - TI.com

QDMA CSL: Start From a Single EDMA3 Transfer

CSL_edma3Init();CSL_edma3Open(&edmaObj,CSL_EDMA3,,);CSL_edma3HwSetup(hModule,);

CSL_edma3ChannelOpen(&chObj, CSL_EDMA3,,); CSL_edma3GetHwChannelSetupParam(hChannel,); CSL_edma3GetParamHandle(hChannel,,);CSL_edma3ParamSetup(hParam,);CSL_edma3HwChannelControl(hChannel,,);

CSL_edma3HwChannelControl(hChannel,,); CSL_edma3GetHwStatus(hModule,,);CSL_edma3HwControl(hModule,,);

CSL_edma3ChannelClose(hChannel);CSL_edma3Close(hModule);

Initialize EDMA3

Prepare channel

Run

Close, if needed

Page 69: Harness the Power of EDMA3 - TI.com

QDMA via EDMA3 CSL: Changes#include <csl_edma3.h>CSL_edma3Init(&context);CSL_edma3Open(&edmaObj,CSL_EDMA3,NULL,&status);

qdmahwSetup[3].que = CSL_EDMA3_QUE_1;qdmahwSetup[3].triggerWord = 7;hwSetup.qdmaChaSetup = qdmahwSetup;CSL_edma3HwSetup(hModule,&hwSetup);

chAttr.chaNum = CSL_EDMA3_QCHA_3;CSL_edma3ChannelOpen(&chObj, CSL_EDMA3, &chAttr, &status);

CSL_edma3GetHwChannelSetupParam(hChannel,&paramNum);CSL_edma3GetParamHandle(hChannel,paramNum,NULL);

Page 70: Harness the Power of EDMA3 - TI.com

QDMA via EDMA3 CSL: Changes// this would cause the channel to run, if it were enabled.CSL_edma3ParamSetup(hParam, &myParamSetup);

// after this enable, the QDMA is ready to run. CSL_edma3HwChannelControl(hChannel,

CSL_EDMA3_CMD_CHANNEL_ENABLE, NULL);

// now any write to trigger word will trigger the channel.IDMA0_configArgs(0x000000ff, Src, hParam, 0);

orfor ( i = 0; i < 8; i++ )

((int*)hParam)[i] = ((int*)&myParamSetup)[i];

Which is the better way to write eight words to PaRAM?

Page 71: Harness the Power of EDMA3 - TI.com

Harness the Power of EDMA3

• Does your DSP have EDMA3?• Introduction to EDMA3• Use CSL 3 to program EDMA3• Tips, tricks, tools, techniques

Page 72: Harness the Power of EDMA3 - TI.com

Tips, Tricks, Tools, Techniques

• Comparison of IDMA0, DAT, QDMA, CPU• RAM-based long transfer chains• McBSP loopback using “self-linking”• Debug capabilities• Ending with DUMMY vs. NULL• Clearing error conditions • PSET allocation with PSET0 = DUMMY

Page 73: Harness the Power of EDMA3 - TI.com

Fill PaRAM: IDMA/CPU/QDMA

Use IDMA to write PSETs, don’t or do wait.Use CSL DAT_fill, don’t or do wait.Use QDMA to copy word to PSETs, don’t or do wait

(write to QDMA PSET using IDMA or CPU).Use CPU to write PSETs.

# of PSets = 1 2 3 4 64 254 255IDMA no wait 139 139 141 141 621 19221 19221IDMA and wait 285 395 485 595 6817 25217 25327DAT fill no wait 166 166 166 166 168 168 166DAT fill and wait 621 869 963 1197 35825 140705 141257QDMA fill no wait (I) 138 138 140 140 140 140 140QDMA fill and wait (I) 573 683 761 831 5241 35535 35675QDMA fill no wait (C) 138 138 138 138 138 138 138QDMA fill and wait (C) 457 567 645 715 5125 35425 35565CPU write 94 190 288 384 6144 24384 24480

Page 74: Harness the Power of EDMA3 - TI.com

Fill PaRAM: IDMA/CPU/QDMA

Use IDMA to write PSETs, don’t or do wait.Use CSL DAT_fill, don’t or do wait.Use QDMA to copy word to PSETs, don’t or do wait

(write to QDMA PSET using IDMA or CPU).Use CPU to write PSETs.

# of PSets = 1 2 3 4 64 254 255

IDMA and wait 285 395 485 595 6817 25217 25327

DAT fill and wait 621 869 963 1197 35825 140705 141257

QDMA fill and wait(I) 573 683 761 831 5241 35535 35675

QDMA fill and wait(C) 457 567 645 715 5125 35425 35565CPU write 94 190 288 384 6144 24384 24480

These are all cases where the writes to PaRAM will run to completion. [–o3 optimization used for all cases]

Page 75: Harness the Power of EDMA3 - TI.com

Fill PaRAM: IDMA/CPU/QDMA # of PSets = 1 2 3 4 64 254 255IDMA no wait 139 139 141 141 621 19221 19221

DAT fill no wait 166 166 166 166 168 168 166

QDMA fill no wait (I) 138 138 140 140 140 140 140

QDMA fill no wait (C) 138 138 138 138 138 138 138

CPU write 94 190 288 384 6144 24384 24480Use IDMA to write PSETs, don’t or do wait.Use CSL DAT_fill, don’t or do wait.Use QDMA to copy word to PSETs, don’t or do wait

(write to QDMA PSET using IDMA or CPU).Use CPU to write PSETs.

These are all cases where the writes to PaRAM will run in background and complete later (except for “CPU write”).

Page 76: Harness the Power of EDMA3 - TI.com

RAM-based Long Transfer Chain

PSET0

PSET1

PSET2

….

PSET254

PSET255

DBIDX=0 SBIDX=0DBIDX=0 SBIDX=0BCNTRLD LINK=BCNTRLD LINK=ffffffff

DCIDX=0 SCIDX=0DCIDX=0 SCIDX=0

DESTINATIONDESTINATIONBCNT ACNTBCNT ACNT

SOURCESOURCE

RSVD CCNT=nRSVD CCNT=n

ITCch,TCint,tccA,ABsyncITCch,TCint,tccA,ABsync

PSETA

PSET B

TR SubmittedTR Submitted

TR SubmittedTR Submitted

NULL

DBIDX=0 SBIDX=3*4DBIDX=0 SBIDX=3*4BCNTRLD LINK=BCNTRLD LINK=ffffffff

DCIDX=0 SCIDX=0DCIDX=0 SCIDX=0RSVD CCNT=1RSVD CCNT=1

DST=DST=ChBChB SRCSRCBCNT=n ACNT=3*4BCNT=n ACNT=3*4

SRC=XferTable[1]SRC=XferTable[1]I/I/TCch,tccB,AsyncTCch,tccB,Async

Channel AChannel A

Channel BChannel B

XferXfer Table in RAMTable in RAMSRC/ACNT:BCNT/DST1

SRC/ACNT:BCNT/DST2

. . .

SRC/ACNT:BCNT/DSTn

Manual Start

DST1DST1BCNT1 ACNT1BCNT1 ACNT1

SRC1SRC1Chai

n to

B

BCNT=nBCNT=n--1 ACNT=3*41 ACNT=3*4SRC=XferTable[2]SRC=XferTable[2]

BCNT=1 ACNT=3*4BCNT=1 ACNT=3*4SRC=SRC=XferTable[nXferTable[n]]

Chain to ADST2DST2

BCNT2 ACNT2BCNT2 ACNT2SRC2SRC2

DSTnDSTnBCNTnBCNTn ACNTnACNTn

SRCnSRCn

NULL

INT generated!INT generated!

RSVD CCNT=nRSVD CCNT=n--11RSVD CCNT=1RSVD CCNT=1

Page 77: Harness the Power of EDMA3 - TI.com

DMA/QDMA Transfer Chain

PSET0

PSET1

PSET2

….

PSET254

PSET255

DBIDX=0 SBIDX=0DBIDX=0 SBIDX=0BCNTRLD LINK=BCNTRLD LINK=ffffffff

DCIDX=0 SCIDX=0DCIDX=0 SCIDX=0RSVD CCNT=nRSVD CCNT=n

TCch,tccA,Static,ABsyncTCch,tccA,Static,ABsync

PSETA

PSET B

DBIDX=0 SBIDX=3*4DBIDX=0 SBIDX=3*4BCNTRLD LINK=BCNTRLD LINK=ffffffff

DCIDX=0 SCIDX=0DCIDX=0 SCIDX=0RSVD CCNT=1RSVD CCNT=1

DST=DST=ChBChB SRCSRCBCNT=n+1 ACNT=3*4BCNT=n+1 ACNT=3*4

SRC=XferTable[1]SRC=XferTable[1]TCint,tccA,AsyncTCint,tccA,Async

Channel AChannel A

QDMA Ch BQDMA Ch B

XferXfer Table in RAMTable in RAMSRC/ACNT:BCNT/DST1

SRC/ACNT:BCNT/DST2

SRC/ACNT:BCNT/DSTn

0/0/0

Manual start

DST1DST1BCNT1 ACNT1BCNT1 ACNT1

SRC1SRC1

Chain to ADST2DST2

BCNT2 ACNT2BCNT2 ACNT2SRC2SRC2

DSTnDSTnBCNTnBCNTn ACNTnACNTn

SRCnSRCn

RSVD CCNT=nRSVD CCNT=n--11RSVD CCNT=1RSVD CCNT=1

QDMA trigger word = DST

TR SubmittedTR Submitted

QDMA triggers and TR SubmittedQDMA triggers and TR Submitted

BCNT=n ACNT=3*4BCNT=n ACNT=3*4SRC=XferTable[2]SRC=XferTable[2]

BCNT=2 ACNT=3*4BCNT=2 ACNT=3*4SRC=SRC=XferTable[nXferTable[n]]

BCNT=1 ACNT=3*4BCNT=1 ACNT=3*4SRC=XferTable[n+1]SRC=XferTable[n+1]

000 00 0

00

and Interrupt generated by DMA Channel A!

QDMA triggersQDMA triggers

Page 78: Harness the Power of EDMA3 - TI.com

McBSP Loopback: “Self-linking”

PSET0

PSET1

PSET2

….

PSET254

PSET255

PSETA

DBIDX=0 SBIDX=0DBIDX=0 SBIDX=0BCNTRLD LINK=PSETABCNTRLD LINK=PSETA

DCIDX=0 SCIDX=0DCIDX=0 SCIDX=0RSVD CCNT=1RSVD CCNT=1

DST=DST=McBSPMcBSP XMTXMTBCNT=1 ACNT=4BCNT=1 ACNT=4

SRC=SRC=McBSPMcBSP RCVRCVAsyncAsync

Channel AChannel A

McBSP RCV Event

The transfer will happen.Then the link will copy the un-updated values back.

Page 79: Harness the Power of EDMA3 - TI.com

EDMA3 Debug Tools• CC queue thresholds and watermarking

– Threshold = how full the queue can get.• Sets error condition flag, can cause error interrupt.

– Watermark = how full the queue has been.• CC Queue visibility

– Can see the last 16 queued TRs.• TC visibility

– Program register set status.– Source active registers are memory mapped.– Destination FIFO registers are memory mapped.

• Error detection flags

Page 80: Harness the Power of EDMA3 - TI.com

DUMMY vs. NULL

• Valid PSET– ACNT >= 1, BCNT >= 1, CCNT >= 1

• DUMMY PSET– One or two of xCNT = 0– Others >= 1

• NULL PSET– ACNT = 0, BCNT = 0, CCNT = 0

Page 81: Harness the Power of EDMA3 - TI.com

DUMMY vs. NULL

• Link to valid PSET– Ready for next event.

• Link to DUMMY PSET– Next event will not send TR (nothing to do).– Next event will not be recorded or cause error.

• Link to NULL PSET– Next event sets EMR and SER.– No more TRs.

Page 82: Harness the Power of EDMA3 - TI.com

EDMA3 Event Error Conditions• If ER or ESR or CER is set to trigger an

event, the bit ‘moves’ to SER.– ER = Event Register– ESR = Event Set Register– CER = Chained Event Register– SER = Secondary Event Register

• If the PSET is not NULL, SER gets cleared and a TR is sent if PSET is not DUMMY.

• If the PSET is NULL, SER stays set and EMR gets set.– EMR = Event Missed Register

ER0000

ESR0000

CER0000

SER0000

EMR0000

or

or

ER0100

ESR0100

CER0100

SER0100TR to TC

EMR0100

Page 83: Harness the Power of EDMA3 - TI.com

EDMA3 Event Error Conditions

ER0000

ESR0000

CER0000

SER0000

EMR0000

or

or

ER0100

ESR0100

CER0100

SER0100TR to TC

EMR0100

• If the PSET was NULL when a trigger occurred, SER and EMR got set.

• If another trigger occurs, nothing happens.– ER or ESR or CER stays set.– SER and EMR stay set.– No TR goes out.

• How do you clear the SER and EMR to allow events to occur again?

No more TRsfor this channel!

Page 84: Harness the Power of EDMA3 - TI.com

EMR0000

SER0000

SECR0100

SER0100

EMCR0000

EMR0100

EMCR0100

ER0100

EDMA3 Event Error Conditions

ESR0000

CER0000

or

or

• Set EMCR to clear a bit in EMR.– EMCR = Event Missed Clear Register

• Set SECR to clear a bit in SER.– SECR = Secondary Event Clear Register

• But there is a pending ER bit.– This ‘moves’ to SER immediately, trying to

cause a new TR.– If the PSET is still NULL, EMR gets set again.– Neither the SER nor EMR bits are cleared.

• Solution: Clear SER until it stays cleared, then clear EMR.

SECR0000

ER0000

Page 85: Harness the Power of EDMA3 - TI.com

PSET Allocation, PSET0 = DUMMY

• Make PSET0 be a DUMMY set for linking.• Initially map all channels to PSET0.• When you open a channel, check if its

paramnum is 0. Already used if not.• If you are done with a channel, set its

paramnum back to 0.

Page 86: Harness the Power of EDMA3 - TI.com

EDMA3

Questions?

Source files are available for IdmaEvaland EDMA_long_chain.

Page 87: Harness the Power of EDMA3 - TI.com

IMPORTANT NOTICE

Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements, and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment. TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI’s standard warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by government requirements, testing of all parameters of each product is not necessarily performed. TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and applications using TI components. To minimize the risks associated with customer products and applications, customers should provide adequate design and operating safeguards. TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI. Reproduction of information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for such altered documentation. Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements. Following are URLs where you can obtain information on other Texas Instruments products and application solutions: Products Applications Amplifiers amplifier.ti.com Audio www.ti.com/audio Data Converters dataconverter.ti.com Automotive www.ti.com/automotive DSP dsp.ti.com Broadband www.ti.com/broadband Interface interface.ti.com Digital Control www.ti.com/digitalcontrol Logic logic.ti.com Military www.ti.com/military Power Mgmt power.ti.com Optical Networking www.ti.com/opticalnetwork Microcontrollers microcontroller.ti.com Security www.ti.com/security Low Power Wireless www.ti.com/lpw Telephony www.ti.com/telephony Video & Imaging www.ti.com/video Wireless www.ti.com/wireless Mailing Address: Texas Instruments Post Office Box 655303 Dallas, Texas 75265

Copyright © 2007, Texas Instruments Incorporated