ialg.h

Go to the documentation of this file.
00001 /* 
00002  * Copyright (c) 2010, Texas Instruments Incorporated
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * *  Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  *
00012  * *  Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  *
00016  * *  Neither the name of Texas Instruments Incorporated nor the names of
00017  *    its contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00021  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00022  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00023  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00024  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00026  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00027  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00028  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00029  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00030  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  * 
00032  */
00033 
00046 #ifndef ti_xdais_IALG_
00047 #define ti_xdais_IALG_
00048 
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052 
00055 
00056 /*---------------------------*/
00057 /*    TYPES AND CONSTANTS    */
00058 /*---------------------------*/
00059 
00060 #define IALG_DEFMEMRECS 4   
00061 #define IALG_OBJMEMREC  0   
00062 #define IALG_SYSCMD     256 
00064 #define IALG_EOK        0   
00065 #define IALG_EFAIL      -1  
00067 #define IALG_CUSTOMFAILBASE  -2048
00071 #define IALG_CUSTOMFAILEND -256   
00079 typedef enum IALG_MemAttrs {
00080     IALG_SCRATCH,           
00081     IALG_PERSIST,           
00082     IALG_WRITEONCE          
00083 } IALG_MemAttrs;
00084 
00085 #define IALG_MPROG  0x0008  
00086 #define IALG_MXTRN  0x0010  
00091 /*
00092  *  ======== IALG_MemSpace ========
00093  */
00094 typedef enum IALG_MemSpace {
00095     IALG_EPROG =            
00096         IALG_MPROG | IALG_MXTRN,
00097 
00098     IALG_IPROG =            
00099         IALG_MPROG,
00100 
00101     IALG_ESDATA =           
00102         IALG_MXTRN + 0,
00103 
00104     IALG_EXTERNAL =         
00105         IALG_MXTRN + 1,
00106 
00107     IALG_DARAM0 = 0,        
00108     IALG_DARAM1 = 1,        
00110     IALG_SARAM  = 2,        
00111     IALG_SARAM0 = 2,        
00112     IALG_SARAM1 = 3,        
00114     IALG_DARAM2 = 4,        
00115     IALG_SARAM2 = 5         
00116 } IALG_MemSpace;
00117 
00118 /*
00119  *  ======== IALG_isProg ========
00120  */
00121 #define IALG_isProg(s) (        \
00122     (((int)(s)) & IALG_MPROG)   \
00123 )
00124 
00125 /*
00126  *  ======== IALG_isOffChip ========
00127  */
00128 #define IALG_isOffChip(s) (     \
00129     (((int)(s)) & IALG_MXTRN)   \
00130 )
00131 
00132 
00136 typedef struct IALG_MemRec {
00137     Uns             size;       
00138     Int             alignment;  
00139     IALG_MemSpace   space;      
00140     IALG_MemAttrs   attrs;      
00141     Void            *base;      
00142 } IALG_MemRec;
00143 
00144 
00153 typedef struct IALG_Obj {
00154     struct IALG_Fxns *fxns;     
00155 } IALG_Obj;
00156 
00157 
00161 typedef struct IALG_Obj *IALG_Handle;
00162 
00163 
00170 typedef struct IALG_Params {
00171     Int size;       
00172 } IALG_Params;
00173 
00174 
00181 typedef struct IALG_Status {
00182     Int size;       
00183 } IALG_Status;
00184 
00185 
00193 typedef unsigned int IALG_Cmd;
00194 
00195 
00200 /*
00201  *      algAlloc()        - apps call this to query the algorithm about
00202  *                          its memory requirements. Must be non-NULL.
00203  *      algControl()      - algorithm specific control operations.  May be
00204  *                          NULL; NULL => no operations supported.
00205  *      algDeactivate()   - notification that current instance is about to
00206  *                          be "deactivated".  May be NULL; NULL => do nothing.
00207  *      algFree()         - query algorithm for memory to free when removing
00208  *                          an instance.  Must be non-NULL.
00209  *      algInit()         - apps call this to allow the algorithm to
00210  *                          initialize memory requested via algAlloc().  Must
00211  *                          be non-NULL.
00212  *      algMoved()        - apps call this whenever an algorithms object or
00213  *                          any pointer parameters are moved in real-time.
00214  *                          May be NULL; NULL => object can not be moved.
00215  *      algNumAlloc()     - query algorithm for number of memory requests.
00216  *                          May be NULL; NULL => number of mem recs is less
00217  *                          then #IALG_DEFMEMRECS.
00218  */
00219 typedef struct IALG_Fxns {
00224     Void    *implementationId;
00225 
00275     Void    (*algActivate)(IALG_Handle handle);
00276 
00355     Int     (*algAlloc)(const IALG_Params *params,
00356         struct IALG_Fxns **parentFxns, IALG_MemRec *memTab);
00357 
00398     Int     (*algControl)(IALG_Handle handle, IALG_Cmd cmd,
00399         IALG_Status *status);
00400 
00454     Void    (*algDeactivate)(IALG_Handle handle);
00455 
00496     Int     (*algFree)(IALG_Handle handle, IALG_MemRec *memTab);
00497 
00671     Int     (*algInit)(IALG_Handle handle, const IALG_MemRec *memTab,
00672         IALG_Handle parent, const IALG_Params *params);
00673 
00694     Void    (*algMoved)(IALG_Handle handle, const IALG_MemRec *memTab,
00695         IALG_Handle parent, const IALG_Params *params);
00696 
00753     Int     (*algNumAlloc)(Void);
00754 } IALG_Fxns;
00755 
00758 #ifdef __cplusplus
00759 }
00760 #endif
00761 
00762 #endif  /* ti_xdais_IALG_ */
00763 /*
00764  *  @(#) ti.xdais; 1, 2.0, 1,243; 5-4-2010 08:43:56; /db/wtree/library/trees/dais/dais-q11x/src/
00765  */
00766 

Copyright 2010, Texas Instruments Incorporated