DMA-driven memset(), memcpy() and memmove() functions.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

I've attached a project that has DMA-driven function equivalents for:

  • memset() => dmemset()
  • memcpy() => dmemcpy()
  • memmove() => dmemmove()

It uses a single DMA channel and TD resource for these functions.

The reason for this project is to see how much faster the transfer of data can occur from these replacement functions.

Summary:  Transfer sizes 64 bytes or above (@ BUS_CLK = 72 MHz) are faster than the standard string library equivalents.

At a transfer size of 4095 bytes (maximum DMA TD transfer count), the transfer time is over 7 times faster!

Len_CONSULTRON_0-1624208556499.png

This project is written for a PSoC5 but can easily be converted to other PSoC families that have DMA resources.

I welcome any suggestions for improvements.

I'm also considering making this into an installable component.  Your thoughts.

Enjoy!

 

Len
"Engineering is an Art. The Art of Compromise."
1 Solution

/odissey1,

The termination of the DMA has the following definition:

CY_DMA_TD_TERMIN_EN - Terminate this TD if a positive edge on the trq input line occurs. The positive edge must occur during a burst. That is the only time the DMAC will listen for it.

The burst for strlen() is continuous for up to 4095 bytes.  Based on the datasheet, I don't see why a rising edge on TRQ during a continuous burst wouldn't terminate the TD.

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
4 Replies