Framework Components Application Programming Interface (API)  fc-v07
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 {
80  IALG_SCRATCH,
81  IALG_PERSIST,
84 
85 #define IALG_MPROG 0x0008
86 #define IALG_MXTRN 0x0010
91 /*
92  * ======== IALG_MemSpace ========
93  */
94 typedef enum IALG_MemSpace {
95  IALG_EPROG =
97 
98  IALG_IPROG =
99  IALG_MPROG,
102  IALG_MXTRN + 0,
103 
105  IALG_MXTRN + 1,
106 
108  IALG_DARAM1 = 1,
111  IALG_SARAM0 = 2,
112  IALG_SARAM1 = 3,
115  IALG_SARAM2 = 5
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;
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 {
224  Void *implementationId;
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_ */
Definition: ialg.h:116
Definition: ialg.h:87
Void(* algDeactivate)(IALG_Handle handle)
Save all persistent data to non-scratch memory.
Definition: ialg.h:460
Definition: ialg.h:117
struct IALG_MemRec IALG_MemRec
Memory records.
Void(* algMoved)(IALG_Handle handle, const IALG_MemRec *memTab, IALG_Handle parent, const IALG_Params *params)
Notify algorithm instance that instance memory has been relocated.
Definition: ialg.h:700
Memory records.
Definition: ialg.h:142
Void(* algActivate)(IALG_Handle handle)
Notification to the algorithm that its memory is "active" and algorithm processing methods may be cal...
Definition: ialg.h:281
struct IALG_Params IALG_Params
Algorithm instance creation parameters.
Definition: ialg.h:113
IALG_MemAttrs attrs
Definition: ialg.h:146
Pointer to algorithm specific status structure.
Definition: ialg.h:187
IALG_MemSpace
Defined memory spaces.
Definition: ialg.h:100
Algorithm instance object definition.
Definition: ialg.h:159
struct IALG_Status IALG_Status
Pointer to algorithm specific status structure.
Int(* algNumAlloc)(Void)
Number of memory allocation requests required.
Definition: ialg.h:759
Int size
Definition: ialg.h:177
#define IALG_MXTRN
Definition: ialg.h:92
struct IALG_Fxns IALG_Fxns
Defines the fields and methods that must be supplied by all XDAIS algorithms.
Int(* algAlloc)(const IALG_Params *params, struct IALG_Fxns **parentFxns, IALG_MemRec *memTab)
Apps call this to query the algorithm about its memory requirements. Must be non-NULL.
Definition: ialg.h:361
IALG_MemAttrs
Memory attributes.
Definition: ialg.h:85
Definition: ialg.h:104
Algorithm instance creation parameters.
Definition: ialg.h:176
struct IALG_Fxns * fxns
Definition: ialg.h:160
#define IALG_MPROG
Definition: ialg.h:91
Int alignment
Definition: ialg.h:144
IALG_MemSpace space
Definition: ialg.h:145
struct IALG_Obj * IALG_Handle
Handle to an algorithm instance object.
Definition: ialg.h:167
Defines the fields and methods that must be supplied by all XDAIS algorithms.
Definition: ialg.h:225
Void * base
Definition: ialg.h:147
Int(* algControl)(IALG_Handle handle, IALG_Cmd cmd, IALG_Status *status)
Algorithm specific control and status.
Definition: ialg.h:404
struct IALG_Obj IALG_Obj
Algorithm instance object definition.
Definition: ialg.h:101
Int(* algFree)(IALG_Handle handle, IALG_MemRec *memTab)
Apps call this to allow the algorithm to initialize memory requested via algAlloc(). Must be non-NULL.
Definition: ialg.h:502
Definition: ialg.h:114
Int size
Definition: ialg.h:188
Definition: ialg.h:88
Definition: ialg.h:120
Int(* algInit)(IALG_Handle handle, const IALG_MemRec *memTab, IALG_Handle parent, const IALG_Params *params)
Initialize an algorithm's instance object. Must be non-NULL.
Definition: ialg.h:677
Definition: ialg.h:107
Definition: ialg.h:86
Definition: ialg.h:121
Uns size
Definition: ialg.h:143
Definition: ialg.h:110
unsigned int IALG_Cmd
Algorithm specific command.
Definition: ialg.h:199
Definition: ialg.h:118
Void * implementationId
Unique pointer that identifies the module implementing this interface.
Definition: ialg.h:230
Copyright 2016, Texas Instruments Incorporated