]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - mfp/fcdev.git/blob - packages/ti/sdo/fc/edmamgr/edmamgr_xfer.h
5e5539743fa7fc85fac56c8007e8dca8bad3d634
[mfp/fcdev.git] / packages / ti / sdo / fc / edmamgr / edmamgr_xfer.h
1 /*
2  * Copyright (c) 2013-2014, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * *  Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
33 #ifdef ti_sdo_fc_edmamgr_EdmaMgr_
35 #ifndef ti_sdo_fc_edmamgr_EdmaMgr_XFER_
36 #define ti_sdo_fc_edmamgr_EdmaMgr_XFER_
39 /*---------------------------------------------------------------*/
40 /* This function convert single local address to global addresse */
41 /*---------------------------------------------------------------*/
42 extern cregister volatile unsigned int DNUM;
43 static inline void *restrict EDMA_MGR_ADDR_LOC_TO_GLOB(void *restrict loc_addr)
44 {
45    unsigned int tmp = (unsigned int)loc_addr;
47    if((tmp & 0xFF000000) == 0)
48    {
49       return (void *)((1 << 28) | (DNUM << 24) | tmp);
50    } else return loc_addr;
51 }
54 /*-----------------------------------------------------------*/
55 /*  This function waits for all transfers on a specific      */
56 /*  ECPY channel to complete. It is a blocking call          */
57 /*  in the sense that CPU will wait until all transfers      */
58 /*  are completed.                                           */
59 /*-----------------------------------------------------------*/
61 #if defined (EDMAMGR_INLINE_ALL)
62 static __inline
63 #endif
64 void EdmaMgr_wait(EdmaMgr_Handle h)
65 {
66   EdmaMgr_Channel  *edmamgrChan = (EdmaMgr_Channel *)h;
68   if (edmamgrChan->xferPending) {
69     ECPY_directWait(edmamgrChan->ecpyHandle);
70     edmamgrChan->xferPending = FALSE;
71   }
72   return;
73 }
75 /*------------------------------------------------------------*/
76 /* The following function performs a single 1D->1D transfer   */
77 /* transferring "num_bytes" bytes from "src" which is the     */
78 /* source address to "dst" which is the destination. This     */
79 /* function uses the channel number "chan_num". It is assumed */
80 /* by this function that there are no pending transfers on    */
81 /* "chan_num".                                                */
82 /*------------------------------------------------------------*/
84 #if defined (EDMAMGR_INLINE_ALL)
85 static __inline
86 #endif
87 int32_t EdmaMgr_copy1D1D
88 (
89     EdmaMgr_Handle            h,
90     void     *restrict        src,
91     void     *restrict        dst,
92     int32_t                   num_bytes
93 )
94 {
95   EdmaMgr_Channel *edmamgrChan = (EdmaMgr_Channel *)h;
96   ECPY_Params p;
97 #if 1
98   uint32_t r, n = 0, a_cnt = num_bytes, i = 0;
99   char *c_src = (char *)src, *c_dst = (char *)dst;
101   /*
102    * This abstracts an effective 1D1D transfer which can transfer more than the 16-bit limit set by the HW.
103    *
104    * This is done by splitting the transfer into 2 transfers:
105    *   - One 2D1D transfer.
106    *   - One 1D1D transfer for the remainder.
107    */
109   while ( a_cnt > 0xFFFF )
110   {
111     a_cnt >>= 1;
112     n++;
113   }
115   r = num_bytes - (a_cnt << n);
117   if ( r > 0 )
118   {
119     src = (void *)c_src;
120     dst = (void *)c_dst;
122     memset(&p, 0, sizeof(ECPY_Params));
123     p.transferType = ECPY_1D1D;
124     p.dstAddr     = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(dst);
125     p.srcAddr     = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(src);
126     p.elementSize = r;
127     p.numElements = 1;
128     p.numFrames   = 1;
130     i++;
131     ECPY_directConfigure(edmamgrChan->ecpyHandle, &p, i);
133     ECPY_directSetFinal(edmamgrChan->ecpyHandle, i);
134     ECPY_directStartEdma(edmamgrChan->ecpyHandle);
136     c_src += r;
137     c_dst += r;
139     src = (void *)c_src;
140     dst = (void *)c_dst;
142     ECPY_directWait(edmamgrChan->ecpyHandle);
143     i = 0;
144   }
146   memset(&p, 0, sizeof(ECPY_Params));
147   p.transferType = ECPY_2D1D;
148   p.dstAddr     = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(dst);
149   p.srcAddr     = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(src);
150   p.elementSize = (1<<n);
151   p.numElements = a_cnt;
152   p.numFrames   = 1;
153   p.srcElementIndex = (1<<n);
154   p.dstElementIndex = (1<<n);
156   i++;
157   ECPY_directConfigure(edmamgrChan->ecpyHandle, &p, i);
159   ECPY_directSetFinal(edmamgrChan->ecpyHandle, i);
160   ECPY_directStartEdma(edmamgrChan->ecpyHandle);
162   edmamgrChan->xferPending = TRUE;
164 #else
165     /*
166      *  Single 1D1D transfer.
167      *
168      *  NOTE: Max size of transfer is limited by 16-bit integer (65535 bytes)
169      */
171     memset(&p, 0, sizeof(ECPY_Params));
172     p.transferType = ECPY_1D1D;
173     p.dstAddr     = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(dst);
174     p.srcAddr     = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(src);
175     p.elementSize = num_bytes;
176     p.numElements = 1;
177     p.numFrames   = 1;
179     ECPY_directConfigure(edmamgrChan->ecpyHandle, &p, 1);
181     ECPY_directSetFinal(edmamgrChan->ecpyHandle, 1);
182     ECPY_directStartEdma(edmamgrChan->ecpyHandle);
184     edmamgrChan->xferPending = TRUE;
186 #endif
187   return(0);
190 /*----------------------------------------------------------*/
191 /*  The following function performs a 1D->2D transfer       */
192 /*  where the source is 1D one dimensional and destination  */
193 /*  is 2D two dimensional. This function uses channel       */
194 /*  number "chan_num" to transfer "num_lines" lines         */
195 /*  each of "num_bytes" bytes. In this case after every     */
196 /*  line of "num_bytes" is transferred, "src" source is     */
197 /*  incremeneted by "num_bytes" and "dst" destination is    */
198 /*  incremenetd by "pitch" bytes.                           */
199 /*----------------------------------------------------------*/
200 #if defined (EDMAMGR_INLINE_ALL)
201 static __inline
202 #endif
203 int32_t EdmaMgr_copy1D2D
205   EdmaMgr_Handle    h,
206   void *restrict    src,
207   void *restrict    dst,
208   int32_t           num_bytes,
209   int32_t           num_lines,
210   int32_t           pitch
213   EdmaMgr_Channel *edmamgrChan = (EdmaMgr_Channel *)h;
214   ECPY_Params p;
216   /* Setting up the parameters for the transfer */
217   memset(&p, 0, sizeof(ECPY_Params));
218   p.transferType = ECPY_1D2D;
219   p.numFrames    = 1;
220   p.elementSize = num_bytes;
221   p.numElements  = num_lines;
222   p.srcElementIndex = num_bytes;
223   p.dstElementIndex = pitch;
224   p.srcAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(src);
225   p.dstAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(dst);
227   ECPY_directConfigure(edmamgrChan->ecpyHandle, &p, 1);
229   ECPY_directSetFinal(edmamgrChan->ecpyHandle, 1);
230   ECPY_directStartEdma(edmamgrChan->ecpyHandle);
232   edmamgrChan->xferPending = TRUE;
234   return(0);
237 /*----------------------------------------------------------*/
238 /* This function performs a 2D->1D transfer by usinng the   */
239 /* channel number "chan_num" by performing a transfer from  */
240 /* source "src" to destination "dst", "num_lines" lines     */
241 /* each of "num_bytes" bytes. At the end of transferring    */
242 /* "num_bytes" bytes per line, the source is incremented    */
243 /* by "pitch" bytes and the destination is incremented by   */
244 /* "num_bytes" bytes as "src" is 2D and "dst" is 1D.        */
245 /*----------------------------------------------------------*/
246 #if defined (EDMAMGR_INLINE_ALL)
247 static __inline
248 #endif
249 int32_t EdmaMgr_copy2D1D
251   EdmaMgr_Handle    h,
252   void *restrict    src,
253   void *restrict    dst,
254   int32_t           num_bytes,
255   int32_t           num_lines,
256   int32_t           pitch
259   EdmaMgr_Channel *edmamgrChan = (EdmaMgr_Channel *)h;
260   ECPY_Params p;
262   /* Setting up the parameters for the first transfer (data grp 1) */
263   memset(&p, 0, sizeof(ECPY_Params));
264   p.transferType = ECPY_2D1D;
265   p.numFrames    = 1;
266   p.elementSize = num_bytes;
267   p.numElements  = num_lines;
268   p.srcElementIndex = pitch;
269   p.dstElementIndex = num_bytes;
270   p.srcAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(src);
271   p.dstAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(dst);
273   ECPY_directConfigure(edmamgrChan->ecpyHandle, &p, 1);
275   ECPY_directSetFinal(edmamgrChan->ecpyHandle, 1);
276   ECPY_directStartEdma(edmamgrChan->ecpyHandle);
278   edmamgrChan->xferPending = TRUE;
280   return(0);
283 /*----------------------------------------------------------*/
284 /* This function performs a 2D->2D transfer by using the    */
285 /* channel number "chan_num" by performing a transfer from  */
286 /* source "src" to destination "dst", "num_lines" lines     */
287 /* each of "num_bytes" bytes. At the end of transferring    */
288 /* "num_bytes" bytes per line, the source is incremented    */
289 /* by "pitch" bytes and the destination is incremented by   */
290 /* "pitch" bytes as well as "src" is 2D and "dst" is 2D.    */
291 /*----------------------------------------------------------*/
292 #if defined (EDMAMGR_INLINE_ALL)
293 static __inline
294 #endif
295 int32_t EdmaMgr_copy2D2D
297   EdmaMgr_Handle    h,
298   void *restrict    src,
299   void *restrict    dst,
300   int32_t           num_bytes,
301   int32_t           num_lines,
302   int32_t           pitch
305   EdmaMgr_Channel *edmamgrChan = (EdmaMgr_Channel *)h;
306   ECPY_Params p;
308   /* Setting up the parameters for the transfer */
309   memset(&p, 0, sizeof(ECPY_Params));
310   p.transferType = ECPY_2D2D;
311   p.numFrames    = 1;
312   p.elementSize = num_bytes;
313   p.numElements  = num_lines;
314   p.srcElementIndex = pitch;
315   p.dstElementIndex = pitch;
316   p.srcAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(src);
317   p.dstAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(dst);
319   ECPY_directConfigure(edmamgrChan->ecpyHandle, &p, 1);
321   ECPY_directSetFinal(edmamgrChan->ecpyHandle, 1);
322   ECPY_directStartEdma(edmamgrChan->ecpyHandle);
324   edmamgrChan->xferPending = TRUE;
326   return(0);
329 /*----------------------------------------------------------*/
330 /* This function performs a 2D->2D transfer by usinng the   */
331 /* channel number "chan_num" by performing a transfer from  */
332 /* source "src" to destination "dst", "num_lines" lines     */
333 /* each of "num_bytes" bytes. At the end of transferring    */
334 /* "num_bytes" bytes per line, the source is incremented    */
335 /* by "dst_pitch" bytes and the destination is incremented  */
336 /* by "src_pitch" bytes as well as "src" is 2D and "dst"    */
337 /* is 2D. This function thus allows independent "src" and   */
338 /* "dst" pitches.                                           */
339 /*----------------------------------------------------------*/
340 #if defined (EDMAMGR_INLINE_ALL)
341 static __inline
342 #endif
343 int32_t EdmaMgr_copy2D2DSep
345   EdmaMgr_Handle    h,
346   void *restrict    src,
347   void *restrict    dst,
348   int32_t           num_bytes,
349   int32_t           num_lines,
350   int32_t           src_pitch,
351   int32_t           dst_pitch
354   EdmaMgr_Channel *edmamgrChan = (EdmaMgr_Channel *)h;
355   ECPY_Params p;
357   /* Setting up the parameters for the transfer */
358   memset(&p, 0, sizeof(ECPY_Params));
359   p.transferType = ECPY_2D2D;
360   p.numFrames    = 1;
361   p.elementSize = num_bytes;
362   p.numElements  = num_lines;
363   p.srcElementIndex = src_pitch;
364   p.dstElementIndex = dst_pitch;
365   p.srcAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(src);
366   p.dstAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(dst);
368   ECPY_directConfigure(edmamgrChan->ecpyHandle, &p, 1);
370   ECPY_directSetFinal(edmamgrChan->ecpyHandle, 1);
371   ECPY_directStartEdma(edmamgrChan->ecpyHandle);
373   edmamgrChan->xferPending = TRUE;
375   return(0);
378 /*-----------------------------------------------------------*/
379 /*  This function accepts an array of transfer parameters    */
380 /*  and performs a group of 1D->1D linked transfers.         */
381 /*                                                           */
382 /*  edmamgrChan: pointer to ALG ECPY channel data structure. */
383 /*  chan_num: Channel number on which transfer is issued.    */
384 /*  src: Array of source addresses.                          */
385 /*  dst: Array of destination addresses.                     */
386 /*  num_bytes: Array of the number of bytes to transfer.     */
387 /*  num_transfers: The number of transfers to perform.       */
388 /*-----------------------------------------------------------*/
389 #if defined (EDMAMGR_INLINE_ALL)
390 static __inline
391 #endif
392 int32_t EdmaMgr_copy1D1DLinked
394   EdmaMgr_Handle    h,
395   void *restrict    src[],
396   void *restrict    dst[],
397   int32_t           num_bytes[],
398   int32_t           num_transfers
401   EdmaMgr_Channel *edmamgrChan = (EdmaMgr_Channel *)h;
402   int32_t         i, j;
403   ECPY_Params p;
405   /* Setting up the parameters for the transfer */
406   memset(&p, 0, sizeof(ECPY_Params));
407   p.transferType = ECPY_1D1D;
408   p.numFrames    = 1;
409   p.numElements  = 1;
411   for (i=0; i<num_transfers; i++)
412   {
413     j = i+1;
414     p.elementSize = num_bytes[i];
415     p.srcAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(src[i]);
416     p.dstAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(dst[i]);
417     ECPY_configure(edmamgrChan->ecpyHandle, &p, j);
418   }
419   ECPY_setFinal(edmamgrChan->ecpyHandle, num_transfers);
420   ECPY_start(edmamgrChan->ecpyHandle);
422   edmamgrChan->xferPending = TRUE;
424   return(0);
426 /*-----------------------------------------------------------*/
427 /*  This function accepts an array of transfer parameters    */
428 /*  and performs a group of src 1D-> dst 2D linked transfers */
429 /*                                                           */
430 /*  edmamgrChan: pointer to ALG ECPY channel data structure. */
431 /*  chan_num:   Channel number to use for transfer.          */
432 /*  src     :   Array of source addresses to use.            */
433 /*  dst     :   Array of destination addresses to use.       */
434 /*  num_bytes:  Number of bytes to transfer per line.        */
435 /*  num_lines:  Number of such lines to transfer.            */
436 /*  pitch:      Destination pitch to use between lines.      */
437 /*  num_tfrs:   Number of transfers.                         */
438 /*-----------------------------------------------------------*/
441 #if defined (EDMAMGR_INLINE_ALL)
442 static __inline
443 #endif
444 int32_t EdmaMgr_copy1D2DLinked
446   EdmaMgr_Handle    h,
447   void *restrict    src[],
448   void *restrict    dst[],
449   int32_t           num_bytes[],
450   int32_t           num_lines[],
451   int32_t           pitch[],
452   int32_t           num_transfers
455   EdmaMgr_Channel *edmamgrChan = (EdmaMgr_Channel *)h;
456   int32_t         i, j;
457   ECPY_Params p;
459   /* Setting up the parameters for the transfer */
460   memset(&p, 0, sizeof(ECPY_Params));
461   p.transferType = ECPY_1D2D;
462   p.numFrames    = 1;
464   for (i=0; i<num_transfers; i++)
465   {
466     j = i+1;
467     p.elementSize = num_bytes[i];
468     p.numElements  = num_lines[i];
469     p.srcElementIndex = num_bytes[i];
470     p.dstElementIndex = pitch[i];
471     p.srcAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(src[i]);
472     p.dstAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(dst[i]);
473     ECPY_configure(edmamgrChan->ecpyHandle, &p, j);
474   }
475   ECPY_setFinal(edmamgrChan->ecpyHandle, num_transfers);
476   ECPY_start(edmamgrChan->ecpyHandle);
478   edmamgrChan->xferPending = TRUE;
480   return(0);
484 /*-----------------------------------------------------------*/
485 /*  This function accepts an array of transfer parameters    */
486 /*  and performs a group of src 2D-> dst 1D linked transfers */
487 /*                                                           */
488 /*  edmamgrChan: pointer to ALG ECPY channel data structure. */
489 /*  chan_num:   Channel number to use for transfer.          */
490 /*  src     :   Array of source addresses to use.            */
491 /*  dst     :   Array of destination addresses to use.       */
492 /*  num_bytes:  Number of bytes to transfer per line.        */
493 /*  num_lines:  Number of such lines to transfer.            */
494 /*  pitch:      Source pitch to use between lines.           */
495 /*  num_tfrs:   Number of transfers.                         */
496 /*-----------------------------------------------------------*/
497 #if defined (EDMAMGR_INLINE_ALL)
498 static __inline
499 #endif
500 int32_t EdmaMgr_copy2D1DLinked
502   EdmaMgr_Handle    h,
503   void *restrict    src[],
504   void *restrict    dst[],
505   int32_t           num_bytes[],
506   int32_t           num_lines[],
507   int32_t           pitch[],
508   int32_t           num_transfers
511   EdmaMgr_Channel *edmamgrChan = (EdmaMgr_Channel *)h;
512   int32_t         i, j;
513   ECPY_Params p;
515   /* Setting up the parameters for the transfer */
516   memset(&p, 0, sizeof(ECPY_Params));
517   p.transferType = ECPY_2D1D;
518   p.numFrames    = 1;
520   for (i=0; i<num_transfers; i++)
521   {
522     j = i+1;
523     p.elementSize = num_bytes[i];
524     p.numElements  = num_lines[i];
525     p.srcElementIndex = pitch[i];
526     p.dstElementIndex = num_bytes[i];
527     p.srcAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(src[i]);
528     p.dstAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(dst[i]);
529     ECPY_configure(edmamgrChan->ecpyHandle, &p, j);
530   }
531   ECPY_setFinal(edmamgrChan->ecpyHandle, num_transfers);
532   ECPY_start(edmamgrChan->ecpyHandle);
534   edmamgrChan->xferPending = TRUE;
536   return(0);
538 /*-----------------------------------------------------------*/
539 /*  This function accepts an array of transfer parameters    */
540 /*  and performs a group of src 2D-> dst 2D linked transfers */
541 /*                                                           */
542 /*  edmamgrChan: pointer to ALG ECPY channel data structure. */
543 /*  chan_num:   Channel number to use for transfer.          */
544 /*  src     :   Array of source addresses to use.            */
545 /*  dst     :   Array of destination addresses to use.       */
546 /*  num_bytes:  Number of bytes to transfer per line.        */
547 /*  num_lines:  Number of such lines to transfer.            */
548 /*  pitch:      Source, Dest pitch to use between lines.     */
549 /*  num_tfrs:   Number of transfers.                         */
550 /*-----------------------------------------------------------*/
551 #if defined (EDMAMGR_INLINE_ALL)
552 static __inline
553 #endif
554 int32_t EdmaMgr_copy2D2DLinked
556   EdmaMgr_Handle    h,
557   void *restrict    src[],
558   void *restrict    dst[],
559   int32_t           num_bytes[],
560   int32_t           num_lines[],
561   int32_t           pitch[],
562   int32_t           num_transfers
565   EdmaMgr_Channel *edmamgrChan = (EdmaMgr_Channel *)h;
566   int32_t         i, j;
567   ECPY_Params p;
569   /* Setting up the parameters for the transfer */
570   memset(&p, 0, sizeof(ECPY_Params));
571   p.transferType = ECPY_2D2D;
572   p.numFrames    = 1;
574   for (i=0; i<num_transfers; i++)
575   {
576     j = i+1;
577     p.elementSize = num_bytes[i];
578     p.numElements  = num_lines[i];
579     p.srcElementIndex = pitch[i];
580     p.dstElementIndex = pitch[i];
581     p.srcAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(src[i]);
582     p.dstAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(dst[i]);
583     ECPY_configure(edmamgrChan->ecpyHandle, &p, j);
584   }
585   ECPY_setFinal(edmamgrChan->ecpyHandle, num_transfers);
586   ECPY_start(edmamgrChan->ecpyHandle);
588   edmamgrChan->xferPending = TRUE;
590   return(0);
593 /*-----------------------------------------------------------*/
594 /*  This function accepts an array of transfer parameters    */
595 /*  and performs a group of src 2D-> dst 2D linked transfers */
596 /*                                                           */
597 /*  edmamgrChan: pointer to ALG ECPY channel data structure. */
598 /*  chan_num:   Channel number to use for transfer.          */
599 /*  src     :   Array of source addresses to use.            */
600 /*  dst     :   Array of destination addresses to use.       */
601 /*  num_bytes:  Number of bytes to transfer per line.        */
602 /*  num_lines:  Number of such lines to transfer.            */
603 /*  pitchsrc:   Source pitch to use between lines.           */
604 /*  pitchdst:   Destination pitch to use between lines.      */
605 /*  num_tfrs:   Number of transfers.                         */
606 /*-----------------------------------------------------------*/
607 #if defined (EDMAMGR_INLINE_ALL)
608 static __inline
609 #endif
610 int32_t EdmaMgr_copy2D2DSepLinked
612   EdmaMgr_Handle    h,
613   void *restrict    src[],
614   void *restrict    dst[],
615   int32_t           num_bytes[],
616   int32_t           num_lines[],
617   int32_t           src_pitch[],
618   int32_t           dst_pitch[],
619   int32_t           num_transfers
622   EdmaMgr_Channel *edmamgrChan = (EdmaMgr_Channel *)h;
623   int32_t         i, j;
624   ECPY_Params p;
626   /* Setting up the parameters for the transfer */
627   memset(&p, 0, sizeof(ECPY_Params));
628   p.transferType = ECPY_2D2D;
629   p.numFrames    = 1;
631   for (i=0; i<num_transfers; i++)
632   {
633     j = i+1;
634     p.elementSize = num_bytes[i];
635     p.numElements  = num_lines[i];
636     p.srcElementIndex = src_pitch[i];
637     p.dstElementIndex = dst_pitch[i];
638     p.srcAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(src[i]);
639     p.dstAddr = (void *)EDMA_MGR_ADDR_LOC_TO_GLOB(dst[i]);
640     ECPY_configure(edmamgrChan->ecpyHandle, &p, j);
641   }
642   ECPY_setFinal(edmamgrChan->ecpyHandle, num_transfers);
643   ECPY_start(edmamgrChan->ecpyHandle);
645   edmamgrChan->xferPending = TRUE;
647   return(0);
650 #if defined (EDMAMGR_INLINE_ALL)
651 static __inline
652 #endif
653 int32_t EdmaMgr_copyFast
655   EdmaMgr_Handle    h,
656   void *restrict    src,
657   void *restrict    dst
660   EdmaMgr_Channel *edmamgrChan = (EdmaMgr_Channel *)h;
662   ECPY_directConfigure32(edmamgrChan->ecpyHandle, ECPY_PARAMFIELD_SRCADDR,
663           (uint32_t)EDMA_MGR_ADDR_LOC_TO_GLOB(src), 1);
664   ECPY_directConfigure32(edmamgrChan->ecpyHandle, ECPY_PARAMFIELD_DSTADDR,
665           (uint32_t)EDMA_MGR_ADDR_LOC_TO_GLOB(dst), 1);
667   ECPY_directStartEdma(edmamgrChan->ecpyHandle);
669   edmamgrChan->xferPending = TRUE;
671   return (0);
675 #if defined (EDMAMGR_INLINE_ALL)
676 static __inline
677 #endif
678 int32_t EdmaMgr_copyLinkedFast
680   EdmaMgr_Handle    h,
681   void *restrict    src[],
682   void *restrict    dst[],
683   int32_t           num_transfers
686   EdmaMgr_Channel *edmamgrChan = (EdmaMgr_Channel *)h;
687   int32_t i, j;
689   for (i=0; i<num_transfers; i++)
690   {
691     j = i+1;
692     ECPY_configure32(edmamgrChan->ecpyHandle, ECPY_PARAMFIELD_SRCADDR,
693             (uint32_t)EDMA_MGR_ADDR_LOC_TO_GLOB(src[i]), j);
694     ECPY_configure32(edmamgrChan->ecpyHandle, ECPY_PARAMFIELD_DSTADDR,
695             (uint32_t)EDMA_MGR_ADDR_LOC_TO_GLOB(dst[i]), j);
696   }
697   ECPY_start(edmamgrChan->ecpyHandle);
699   edmamgrChan->xferPending = TRUE;
701   return (0);
704 #endif /* ti_sdo_fc_edmamgr_EdmaMgr_XFER_ */
706 #else
707 #error "ti/sdo/fc/edmamgr/edmamgr.h must be included first"
708 #endif