Framework Components Application Programming Interface (API)  fc-v07
edmamgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2016, 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  */
53 #ifndef ti_sdo_fc_edmamgr_EdmaMgr_
54 #define ti_sdo_fc_edmamgr_EdmaMgr_
55 
58 
59 #include <stdint.h>
60 #include <string.h>
61 
62 #include <ti/sdo/fc/ecpy/ecpy.h>
63 #include <ti/xdais/ialg.h>
64 #include <ti/xdais/ires.h>
66 #include <ti/sdo/fc/edma3/edma3_config.h>
67 
68 
72 typedef void *EdmaMgr_Handle;
73 
74 
76 typedef struct _EdmaMgr_Channel {
77  IRES_EDMA3CHAN_Handle edmaHandle;
78  ECPY_Handle ecpyHandle;
80  Bool resActive;
81  Bool xferPending;
82  IRES_YieldFxn yieldFxn;
83  IRES_YieldArgs yieldArgs;
84  IRES_YieldContext yieldContext;
85  uint32_t optChained;
86  IALG_MemRec addrTable;
87  struct _EdmaMgr_Channel *chainedChannel;
88 } EdmaMgr_Channel;
91 #define EdmaMgr_SUCCESS 0
92 #define EdmaMgr_ERROR_INVARG -1
93 #define EdmaMgr_ERROR_INVCFG -2
94 #define EdmaMgr_ERROR_RMANINIT -3
95 #define EdmaMgr_ERROR_INVHANDLE -4
96 #define EdmaMgr_ERROR_FREE -5
120 int32_t EdmaMgr_init
121 (
122  int32_t proc_id,
123  void *edma3_config
124 );
125 
126 
139 (
140  int32_t max_linked_transfers
141 );
142 
143 
144 #define EdmaMgr_MAX_NUM_MEMRECS_LARGE 1
151 typedef struct _EdmaMgr_ConfigLarge {
152 
154  int32_t max_num_lines;
155 
158 
172 int32_t EdmaMgr_getSizesLarge
173 (
174  EdmaMgr_ConfigLarge *cfg,
175  IALG_MemRec memTab[]
176 );
177 
178 
197 (
198  EdmaMgr_ConfigLarge *cfg,
199  IALG_MemRec memTab[]
200 );
201 
202 
214 int32_t EdmaMgr_free
215 (
217 );
218 
229 int32_t EdmaMgr_hwFreeAll();
230 
231 
242 int32_t EdmaMgr_hwAllocAll();
243 
244 
245 /*
246  * The below declarations are placed here as only a reference
247  * (hence the comment block).
248  *
249  * These functions are defined further below.
250  */
251 #if defined(EDMAMGR_INLINE_ALL)
252 #include <ti/sdo/fc/edmamgr/edmamgr_xfer.h>
253 #else
254 
264 void EdmaMgr_wait
265 (
267 );
268 
269 
285 int32_t EdmaMgr_copy1D1D
286 (
287  EdmaMgr_Handle h,
288  void *restrict src,
289  void *restrict dst,
290  int32_t num_bytes
291 );
292 
312 int32_t EdmaMgr_copy1D2D
313 (
314  EdmaMgr_Handle h,
315  void *restrict src,
316  void *restrict dst,
317  int32_t num_bytes,
318  int32_t num_lines,
319  int32_t pitch
320 );
321 
341 int32_t EdmaMgr_copy2D1D
342 (
343  EdmaMgr_Handle h,
344  void *restrict src,
345  void *restrict dst,
346  int32_t num_bytes,
347  int32_t num_lines,
348  int32_t pitch
349 );
350 
369 int32_t EdmaMgr_copy2D2D
370 (
371  EdmaMgr_Handle h,
372  void *restrict src,
373  void *restrict dst,
374  int32_t num_bytes,
375  int32_t num_lines,
376  int32_t pitch
377 );
378 
399 int32_t EdmaMgr_copy2D2DSep
400 (
401  EdmaMgr_Handle h,
402  void *restrict src,
403  void *restrict dst,
404  int32_t num_bytes,
405  int32_t num_lines,
406  int32_t src_pitch,
407  int32_t dst_pitch
408 );
409 
424 (
425  EdmaMgr_Handle h,
426  void *restrict src[],
427  void *restrict dst[],
428  int32_t num_bytes[],
429  int32_t num_transfers
430 );
431 
448 (
449  EdmaMgr_Handle h,
450  void *restrict src[],
451  void *restrict dst[],
452  int32_t num_bytes[],
453  int32_t num_lines[],
454  int32_t pitch[],
455  int32_t num_transfers
456 );
457 
474 (
475  EdmaMgr_Handle h,
476  void *restrict src[],
477  void *restrict dst[],
478  int32_t num_bytes[],
479  int32_t num_lines[],
480  int32_t pitch[],
481  int32_t num_transfers
482 );
483 
500 (
501  EdmaMgr_Handle h,
502  void *restrict src[],
503  void *restrict dst[],
504  int32_t num_bytes[],
505  int32_t num_lines[],
506  int32_t pitch[],
507  int32_t num_transfers
508 );
509 
528 (
529  EdmaMgr_Handle h,
530  void *restrict src[],
531  void *restrict dst[],
532  int32_t num_bytes[],
533  int32_t num_lines[],
534  int32_t src_pitch[],
535  int32_t dst_pitch[],
536  int32_t num_transfers
537 );
538 
562 int32_t EdmaMgr_copy1D2DLarge
563 (
564  EdmaMgr_Handle h,
565  void *restrict src,
566  void *restrict dst,
567  int32_t num_bytes,
568  int32_t num_lines,
569  int32_t pitch
570 );
571 
595 int32_t EdmaMgr_copy2D1DLarge
596 (
597  EdmaMgr_Handle h,
598  void *restrict src,
599  void *restrict dst,
600  int32_t num_bytes,
601  int32_t num_lines,
602  int32_t pitch
603 );
604 
605 
622 int32_t EdmaMgr_copyFast
623 (
624  EdmaMgr_Handle h,
625  void *restrict src,
626  void *restrict dst
627 );
628 
647 (
648  EdmaMgr_Handle h,
649  void *restrict src[],
650  void *restrict dst[],
651  int32_t num_transfers
652 );
653 #endif
654 
657 #endif /* ti_sdo_fc_edmamgr_EdmaMgr_ */
Void(* IRES_YieldFxn)(IRES_YieldResourceType resourceType, IRES_YieldContextHandle algYieldContext, IRES_YieldArgs yieldArgs)
The 'yield function' pointer and 'yield arguments' are supplied to an algorithm during its IRES inter...
Definition: ires.h:159
int32_t EdmaMgr_getSizesLarge(EdmaMgr_ConfigLarge *cfg, IALG_MemRec memTab[])
Get buffer requirements for a large channel.
Memory records.
Definition: ialg.h:142
int32_t EdmaMgr_copy2D1D(EdmaMgr_Handle h, void *restrict src, void *restrict dst, int32_t num_bytes, int32_t num_lines, int32_t pitch)
Perform a 2D->1D transfer.
int32_t EdmaMgr_hwAllocAll()
Restore EdmaMgr HW resources.
Object returned to the algorithm requesting EDMA3 resources.
Definition: ires_edma3Chan.h:385
int32_t EdmaMgr_copy1D2DLarge(EdmaMgr_Handle h, void *restrict src, void *restrict dst, int32_t num_bytes, int32_t num_lines, int32_t pitch)
Perform a 1D->2D large transfer.
EdmaMgr_Handle EdmaMgr_allocLarge(EdmaMgr_ConfigLarge *cfg, IALG_MemRec memTab[])
Allocate an EdmaMgr channel for "Large" 1D2D or 2D1D transfers which have a pitch outside the range [...
struct ECPY_Obj * ECPY_Handle
Handle to "logical" ECPY Channel.
Definition: ecpy.h:195
int32_t EdmaMgr_copyFast(EdmaMgr_Handle h, void *restrict src, void *restrict dst)
Perform a fast copy. This API inherits the transfer configuration of a previous transfer and only mod...
int32_t EdmaMgr_copyLinkedFast(EdmaMgr_Handle h, void *restrict src[], void *restrict dst[], int32_t num_transfers)
Perform a linked fast copy. This API inherits the transfer configuration of a previous transfer and o...
IRES Interface Definitions - Allows algorithms to request and receive handles representing private lo...
int32_t EdmaMgr_copy1D2DLinked(EdmaMgr_Handle h, void *restrict src[], void *restrict dst[], int32_t num_bytes[], int32_t num_lines[], int32_t pitch[], int32_t num_transfers)
Perform a group of linked 1D->2D transfers.
int32_t EdmaMgr_copy2D2DLinked(EdmaMgr_Handle h, void *restrict src[], void *restrict dst[], int32_t num_bytes[], int32_t num_lines[], int32_t pitch[], int32_t num_transfers)
Perform a group of linked 2D->2D transfers.
This header defines all types, constants, and functions defined by XDAIS for algorithms.
int32_t EdmaMgr_copy2D2DSep(EdmaMgr_Handle h, void *restrict src, void *restrict dst, int32_t num_bytes, int32_t num_lines, int32_t src_pitch, int32_t dst_pitch)
Perform a 2D->2D transfer of buffers with different pitches.
IRES EDMA3CHAN PROTOCOL Interface Definitions - Allows algorithms to request and receive handles repr...
int32_t EdmaMgr_copy2D2DSepLinked(EdmaMgr_Handle h, void *restrict src[], void *restrict dst[], int32_t num_bytes[], int32_t num_lines[], int32_t src_pitch[], int32_t dst_pitch[], int32_t num_transfers)
Perform a group of linked 2D->2D transfers with different pitches.
int32_t EdmaMgr_free(EdmaMgr_Handle h)
Frees an EdmaMgr channel.
ECPY Definitions - High performance functional library for use with the EDMA3 DMA peripheral...
void * EdmaMgr_Handle
Handle to an EdmaMgr instance.
Definition: edmamgr.h:72
int32_t EdmaMgr_copy2D1DLarge(EdmaMgr_Handle h, void *restrict src, void *restrict dst, int32_t num_bytes, int32_t num_lines, int32_t pitch)
Perform a 2D->1D large transfer.
struct _EdmaMgr_ConfigLarge EdmaMgr_ConfigLarge
Configuration for a large channel.
int32_t EdmaMgr_copy2D2D(EdmaMgr_Handle h, void *restrict src, void *restrict dst, int32_t num_bytes, int32_t num_lines, int32_t pitch)
Perform a 2D->2D transfer of buffers with the same pitch.
EdmaMgr_Handle EdmaMgr_alloc(int32_t max_linked_transfers)
Allocate an EdmaMgr channel.
int32_t EdmaMgr_copy2D1DLinked(EdmaMgr_Handle h, void *restrict src[], void *restrict dst[], int32_t num_bytes[], int32_t num_lines[], int32_t pitch[], int32_t num_transfers)
Perform a group of linked 2D->1D transfers.
int32_t EdmaMgr_copy1D1DLinked(EdmaMgr_Handle h, void *restrict src[], void *restrict dst[], int32_t num_bytes[], int32_t num_transfers)
Perform a group of linked 1D->1D transfers.
EDMA3 Linked Transfer Protocol Arguments definition.
Definition: ires_edma3Chan.h:309
int32_t EdmaMgr_hwFreeAll()
Free EdmaMgr HW resources.
Specifies the algorithm specific handles and context save & restore function pointers and arguments t...
Definition: ires.h:84
int32_t EdmaMgr_copy1D1D(EdmaMgr_Handle h, void *restrict src, void *restrict dst, int32_t num_bytes)
Perform a single 1D->1D transfer.
Void * IRES_YieldArgs
Definition: ires.h:140
int32_t EdmaMgr_copy1D2D(EdmaMgr_Handle h, void *restrict src, void *restrict dst, int32_t num_bytes, int32_t num_lines, int32_t pitch)
Perform a 1D->2D transfer.
Configuration for a large channel.
Definition: edmamgr.h:154
void EdmaMgr_wait(EdmaMgr_Handle h)
Wait for transfers to complete.
Copyright 2016, Texas Instruments Incorporated