Monday, October 30, 2006

More often than not, you would come across a situation where you have to copy a chunk of data using DMA. But DAT_copy(...) function has a size limitation where the copy length has to be less than 65,535 bytes. Inorder to copy a larger size you have to issue multiple DAT_copy(...) calls.

Before you can use DAT_copy you have to open the DAT module using DAT_open(...). This allocates 4 Transfer Completion Codes (TCC). This means we can issue 4 DAT_copy(...) calls before having to wait for copy completion using DAT_wait(...).

When creating a general purpose copy routine, we have to consider few scenarios to make use of the features of the DAT_copy.

Scenario 1: payload size is less than 65,535
In this case it's simply a single DAT_copy(...) call and DAT_wait(...)

Scenario 2: payload size is more than 65,535 but less than (65,535 * 4)
In this case we issue 'n' number of DAT_copy(...) calls, where n is between 1 and 5

Scenario 3: payload size is more than (65,535 *4)
In this case we issue integer number of blocks of 4 DAT_Copy(...) calls and for the problem would be reduced to a Scenario 2 or Scenario 1.

About Me

Cambridge, United Kingdom