XDAIS  dais-x04
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ialg.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006-2012, 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  *
32  */
33 
46 #ifndef ti_xdais_IALG_
47 #define ti_xdais_IALG_
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
55 
56 /*---------------------------*/
57 /* TYPES AND CONSTANTS */
58 /*---------------------------*/
59 
60 #define IALG_DEFMEMRECS 4
61 #define IALG_OBJMEMREC 0
62 #define IALG_SYSCMD 256
64 #define IALG_EOK 0
65 #define IALG_EFAIL (-1)
67 #define IALG_CUSTOMFAILBASE (-2048)
71 #define IALG_CUSTOMFAILEND (-256)
79 typedef enum IALG_MemAttrs {
84 
85 #define IALG_MPROG 0x0008
86 #define IALG_MXTRN 0x0010
91 /*
92  * ======== IALG_MemSpace ========
93  */
94 typedef enum IALG_MemSpace {
97 
99  IALG_MPROG,
100 
102  IALG_MXTRN + 0,
103 
105  IALG_MXTRN + 1,
106 
116 } IALG_MemSpace;
117 
118 /*
119  * ======== IALG_isProg ========
120  */
121 #define IALG_isProg(s) ( \
122  (((int)(s)) & IALG_MPROG) \
123 )
124 
125 /*
126  * ======== IALG_isOffChip ========
127  */
128 #define IALG_isOffChip(s) ( \
129  (((int)(s)) & IALG_MXTRN) \
130 )
131 
132 
136 typedef struct IALG_MemRec {
137  Uns size;
138  Int alignment;
141  Void *base;
142 } IALG_MemRec;
143 
144 
153 typedef struct IALG_Obj {
154  struct IALG_Fxns *fxns;
155 } IALG_Obj;
156 
157 
161 typedef struct IALG_Obj *IALG_Handle;
162 
163 
170 typedef struct IALG_Params {
171  Int size;
172 } IALG_Params;
173 
174 
181 typedef struct IALG_Status {
182  Int size;
183 } IALG_Status;
184 
185 
193 typedef unsigned int IALG_Cmd;
194 
195 
200 /*
201  * algAlloc() - apps call this to query the algorithm about
202  * its memory requirements. Must be non-NULL.
203  * algControl() - algorithm specific control operations. May be
204  * NULL; NULL => no operations supported.
205  * algDeactivate() - notification that current instance is about to
206  * be "deactivated". May be NULL; NULL => do nothing.
207  * algFree() - query algorithm for memory to free when removing
208  * an instance. Must be non-NULL.
209  * algInit() - apps call this to allow the algorithm to
210  * initialize memory requested via algAlloc(). Must
211  * be non-NULL.
212  * algMoved() - apps call this whenever an algorithms object or
213  * any pointer parameters are moved in real-time.
214  * May be NULL; NULL => object can not be moved.
215  * algNumAlloc() - query algorithm for number of memory requests.
216  * May be NULL; NULL => number of mem recs is less
217  * then #IALG_DEFMEMRECS.
218  */
219 typedef struct IALG_Fxns {
225 
275  Void (*algActivate)(IALG_Handle handle);
276 
355  Int (*algAlloc)(const IALG_Params *params,
356  struct IALG_Fxns **parentFxns, IALG_MemRec *memTab);
357 
398  Int (*algControl)(IALG_Handle handle, IALG_Cmd cmd,
399  IALG_Status *status);
400 
454  Void (*algDeactivate)(IALG_Handle handle);
455 
496  Int (*algFree)(IALG_Handle handle, IALG_MemRec *memTab);
497 
671  Int (*algInit)(IALG_Handle handle, const IALG_MemRec *memTab,
672  IALG_Handle parent, const IALG_Params *params);
673 
694  Void (*algMoved)(IALG_Handle handle, const IALG_MemRec *memTab,
695  IALG_Handle parent, const IALG_Params *params);
696 
753  Int (*algNumAlloc)(Void);
754 } IALG_Fxns;
755 
758 #ifdef __cplusplus
759 }
760 #endif
761 
762 #endif /* ti_xdais_IALG_ */
Copyright 2013, Texas Instruments Incorporated