ialg.h

Go to the documentation of this file.
00001 /* 
00002  * Copyright (c) 2009, 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  
00070 typedef enum IALG_MemAttrs {
00071     IALG_SCRATCH,           
00072     IALG_PERSIST,           
00073     IALG_WRITEONCE          
00074 } IALG_MemAttrs;
00075 
00076 #define IALG_MPROG  0x0008  
00077 #define IALG_MXTRN  0x0010  
00082 /*
00083  *  ======== IALG_MemSpace ========
00084  */
00085 typedef enum IALG_MemSpace {
00086     IALG_EPROG =            
00087         IALG_MPROG | IALG_MXTRN,
00088 
00089     IALG_IPROG =            
00090         IALG_MPROG,
00091 
00092     IALG_ESDATA =           
00093         IALG_MXTRN + 0,
00094 
00095     IALG_EXTERNAL =         
00096         IALG_MXTRN + 1,
00097 
00098     IALG_DARAM0 = 0,        
00099     IALG_DARAM1 = 1,        
00101     IALG_SARAM  = 2,        
00102     IALG_SARAM0 = 2,        
00103     IALG_SARAM1 = 3,        
00105     IALG_DARAM2 = 4,        
00106     IALG_SARAM2 = 5         
00107 } IALG_MemSpace;
00108 
00109 /*
00110  *  ======== IALG_isProg ========
00111  */
00112 #define IALG_isProg(s) (        \
00113     (((int)(s)) & IALG_MPROG)   \
00114 )
00115 
00116 /*
00117  *  ======== IALG_isOffChip ========
00118  */
00119 #define IALG_isOffChip(s) (     \
00120     (((int)(s)) & IALG_MXTRN)   \
00121 )
00122 
00123 
00127 typedef struct IALG_MemRec {
00128     Uns             size;       
00129     Int             alignment;  
00130     IALG_MemSpace   space;      
00131     IALG_MemAttrs   attrs;      
00132     Void            *base;      
00133 } IALG_MemRec;
00134 
00135 
00144 typedef struct IALG_Obj {
00145     struct IALG_Fxns *fxns;     
00146 } IALG_Obj;
00147 
00148 
00152 typedef struct IALG_Obj *IALG_Handle;
00153 
00154 
00161 typedef struct IALG_Params {
00162     Int size;       
00163 } IALG_Params;
00164 
00165 
00172 typedef struct IALG_Status {
00173     Int size;       
00174 } IALG_Status;
00175 
00176 
00184 typedef unsigned int IALG_Cmd;
00185 
00186 
00191 /*
00192  *      algAlloc()        - apps call this to query the algorithm about
00193  *                          its memory requirements. Must be non-NULL.
00194  *      algControl()      - algorithm specific control operations.  May be
00195  *                          NULL; NULL => no operations supported.
00196  *      algDeactivate()   - notification that current instance is about to
00197  *                          be "deactivated".  May be NULL; NULL => do nothing.
00198  *      algFree()         - query algorithm for memory to free when removing
00199  *                          an instance.  Must be non-NULL.
00200  *      algInit()         - apps call this to allow the algorithm to
00201  *                          initialize memory requested via algAlloc().  Must
00202  *                          be non-NULL.
00203  *      algMoved()        - apps call this whenever an algorithms object or
00204  *                          any pointer parameters are moved in real-time.
00205  *                          May be NULL; NULL => object can not be moved.
00206  *      algNumAlloc()     - query algorithm for number of memory requests.
00207  *                          May be NULL; NULL => number of mem recs is less
00208  *                          then #IALG_DEFMEMRECS.
00209  */
00210 typedef struct IALG_Fxns {
00215     Void    *implementationId;
00216 
00266     Void    (*algActivate)(IALG_Handle handle);
00267 
00340     Int     (*algAlloc)(const IALG_Params *params,
00341         struct IALG_Fxns **parentFxns, IALG_MemRec *memTab);
00342 
00383     Int     (*algControl)(IALG_Handle handle, IALG_Cmd cmd,
00384         IALG_Status *status);
00385 
00439     Void    (*algDeactivate)(IALG_Handle handle);
00440 
00481     Int     (*algFree)(IALG_Handle handle, IALG_MemRec *memTab);
00482 
00631     Int     (*algInit)(IALG_Handle handle, const IALG_MemRec *memTab,
00632         IALG_Handle parent, const IALG_Params *params);
00633 
00654     Void    (*algMoved)(IALG_Handle handle, const IALG_MemRec *memTab,
00655         IALG_Handle parent, const IALG_Params *params);
00656 
00713     Int     (*algNumAlloc)(Void);
00714 } IALG_Fxns;
00715 
00718 #ifdef __cplusplus
00719 }
00720 #endif
00721 
00722 #endif  /* ti_xdais_IALG_ */
00723 /*
00724  *  @(#) ti.xdais; 1, 2.0, 1,192; 3-13-2009 12:27:22; /db/wtree/library/trees/dais/dais-o05x/src/
00725  */
00726 

Copyright 2009, Texas Instruments Incorporated