Framework Components Application Programming Interface (API)  fc-v04
edmamgr.h
Go to the documentation of this file.
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  */
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 
219 
220 /*
221  * The below declarations are placed here as only a reference
222  * (hence the comment block).
223  *
224  * These functions are defined further below.
225  */
226 #if defined(EDMAMGR_INLINE_ALL)
227 #include <ti/sdo/fc/edmamgr/edmamgr_xfer.h>
228 #else
229 
239 void EdmaMgr_wait
240 (
242 );
243 
244 
260 int32_t EdmaMgr_copy1D1D
261 (
262  EdmaMgr_Handle h,
263  void *restrict src,
264  void *restrict dst,
265  int32_t num_bytes
266 );
267 
287 int32_t EdmaMgr_copy1D2D
288 (
289  EdmaMgr_Handle h,
290  void *restrict src,
291  void *restrict dst,
292  int32_t num_bytes,
293  int32_t num_lines,
294  int32_t pitch
295 );
296 
316 int32_t EdmaMgr_copy2D1D
317 (
318  EdmaMgr_Handle h,
319  void *restrict src,
320  void *restrict dst,
321  int32_t num_bytes,
322  int32_t num_lines,
323  int32_t pitch
324 );
325 
344 int32_t EdmaMgr_copy2D2D
345 (
346  EdmaMgr_Handle h,
347  void *restrict src,
348  void *restrict dst,
349  int32_t num_bytes,
350  int32_t num_lines,
351  int32_t pitch
352 );
353 
374 int32_t EdmaMgr_copy2D2DSep
375 (
376  EdmaMgr_Handle h,
377  void *restrict src,
378  void *restrict dst,
379  int32_t num_bytes,
380  int32_t num_lines,
381  int32_t src_pitch,
382  int32_t dst_pitch
383 );
384 
399 (
400  EdmaMgr_Handle h,
401  void *restrict src[],
402  void *restrict dst[],
403  int32_t num_bytes[],
404  int32_t num_transfers
405 );
406 
423 (
424  EdmaMgr_Handle h,
425  void *restrict src[],
426  void *restrict dst[],
427  int32_t num_bytes[],
428  int32_t num_lines[],
429  int32_t pitch[],
430  int32_t num_transfers
431 );
432 
449 (
450  EdmaMgr_Handle h,
451  void *restrict src[],
452  void *restrict dst[],
453  int32_t num_bytes[],
454  int32_t num_lines[],
455  int32_t pitch[],
456  int32_t num_transfers
457 );
458 
475 (
476  EdmaMgr_Handle h,
477  void *restrict src[],
478  void *restrict dst[],
479  int32_t num_bytes[],
480  int32_t num_lines[],
481  int32_t pitch[],
482  int32_t num_transfers
483 );
484 
503 (
504  EdmaMgr_Handle h,
505  void *restrict src[],
506  void *restrict dst[],
507  int32_t num_bytes[],
508  int32_t num_lines[],
509  int32_t src_pitch[],
510  int32_t dst_pitch[],
511  int32_t num_transfers
512 );
513 
537 int32_t EdmaMgr_copy1D2DLarge
538 (
539  EdmaMgr_Handle h,
540  void *restrict src,
541  void *restrict dst,
542  int32_t num_bytes,
543  int32_t num_lines,
544  int32_t pitch
545 );
546 
570 int32_t EdmaMgr_copy2D1DLarge
571 (
572  EdmaMgr_Handle h,
573  void *restrict src,
574  void *restrict dst,
575  int32_t num_bytes,
576  int32_t num_lines,
577  int32_t pitch
578 );
579 
580 
597 int32_t EdmaMgr_copyFast
598 (
599  EdmaMgr_Handle h,
600  void *restrict src,
601  void *restrict dst
602 );
603 
622 (
623  EdmaMgr_Handle h,
624  void *restrict src[],
625  void *restrict dst[],
626  int32_t num_transfers
627 );
628 #endif
629 
632 #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.
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
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 2015, Texas Instruments Incorporated