Framework Components Application Programming Interface (API)  fc-v04
dskt2.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-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  */
47 #ifndef DSKT2_
48 #define DSKT2_
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
56 
57 #include <xdc/std.h>
58 #include <xdc/runtime/IHeap.h>
59 
60 #include <ti/xdais/ialg.h>
61 #include <ti/xdais/ires.h>
62 #include <stddef.h>
63 
64 #define DSKT2_NUM_SCRATCH_GROUPS 20
68 #define DSKT2_MAX_MEM_ALLOCATION_SIZE 0xFFFF
72 /* NOTE: DO NOT Change NUM_SHAREDHEAPS*/
73 #define DSKT2_NUM_SHAREDHEAPS 2
74 
83 #define DSKT2_MODNAME "ti.sdo.fc.dskt2"
84 
92 typedef Void (*DSKT2_CacheWBInvFxn)(Ptr blockPtr, size_t byteCnt, Bool wait);
93 
94 
99 
100 /* TODO: Should these be declared here ? User should know they can initialize
101  these entries */
102 extern __FAR__ xdc_runtime_IHeap_Handle DSKT2_daram0Heap;
103 extern __FAR__ xdc_runtime_IHeap_Handle DSKT2_daram1Heap;
104 extern __FAR__ xdc_runtime_IHeap_Handle DSKT2_daram2Heap;
105 extern __FAR__ xdc_runtime_IHeap_Handle DSKT2_saram0Heap;
106 extern __FAR__ xdc_runtime_IHeap_Handle DSKT2_saram1Heap;
107 extern __FAR__ xdc_runtime_IHeap_Handle DSKT2_saram2Heap;
108 extern __FAR__ xdc_runtime_IHeap_Handle DSKT2_iprogHeap;
109 extern __FAR__ xdc_runtime_IHeap_Handle DSKT2_eprogHeap;
110 extern __FAR__ xdc_runtime_IHeap_Handle DSKT2_esdataHeap;
111 extern __FAR__ xdc_runtime_IHeap_Handle _DSKT2_heap;
112 
113 extern __FAR__ UInt _DSKT2_ALLOW_EXTERNAL_SCRATCH;
114 
115 extern __FAR__ UInt _DSKT2_DARAM_SCRATCH_SIZES[];
116 extern __FAR__ UInt _DSKT2_SARAM_SCRATCH_SIZES[];
117 
118 /* ENDTODO */
119 
124 
189 extern Void DSKT2_activateAlg(Int scratchMutexId, IALG_Handle alg);
190 
191 
224 extern Int DSKT2_controlAlg(IALG_Handle alg, IALG_Cmd cmd,
225  IALG_Status *status);
226 
227 
307 extern IALG_Handle DSKT2_createAlg(Int scratchMutexId, IALG_Fxns * fxns,
308  IALG_Handle parent, IALG_Params * params);
309 
310 
405 extern IALG_Handle DSKT2_createAlg2(Int scratchMutexId, IALG_Fxns * fxns,
406  IALG_Handle parent, IALG_Params * params,
407  xdc_runtime_IHeap_Handle extHeapId);
408 
409 
485 IALG_Handle DSKT2_createAlgExt(Int scratchId, IALG_Fxns * fxns,
486  IALG_Handle parent, IALG_Params * params);
487 
539 extern Void DSKT2_deactivateAlg(Int scratchMutexId, IALG_Handle alg);
540 
552 extern Int DSKT2_deactivateAll();
553 
586 extern Bool DSKT2_freeAlg(Int scratchMutexId, IALG_Handle alg);
587 
617 extern Bool DSKT2_allocScratch(IALG_Handle alg,Int mutexId, IALG_MemRec *memTab,
618  Int numRecs);
619 
620 extern Int DSKT2_getScratchId(IALG_Handle alg);
621 
645 extern Void DSKT2_freeScratch(Int mutexId, Void *addr, UInt size);
646 
659 extern Bool DSKT2_allocPersistent(IALG_MemRec *memTab, Int numRecs);
660 
673 extern Void DSKT2_freePersistent(IALG_MemRec *memTab, Int numRecs);
674 
675 /*
676  * Functions below are friend functions that are used by RMAN and some IRES
677  * implementations to cooperatively yield to higher priority algorithms.
678  */
686 Void DSKT2_yield(IRES_YieldResourceType resource,
687  IRES_YieldContextHandle algYieldContext, IRES_YieldArgs yieldArgs);
688 
693 IRES_YieldArgs DSKT2_getYieldArgs(Int scratchId);
694 
699 IRES_YieldArgs DSKT2_setYieldArgs(Int scratchId, Bool yieldFlag);
700 
701 
702 Void DSKT2_contextRelease(IRES_YieldResourceType resource,
703  IRES_YieldContextHandle algYieldContext, IRES_YieldArgs yieldArgs);
704 
705 Void DSKT2_contextAcquire(IRES_YieldResourceType resource,
706  IRES_YieldContextHandle algYieldContext, IRES_YieldArgs yieldArgs);
707 
713 Int DSKT2_getNumAlgs();
714 
725 Int DSKT2_getAlgList(IALG_Handle * algList, Int * scratchIds);
726 
730 
731 #ifdef __cplusplus
732 }
733 #endif /* extern "C" */
734 
735 #endif /* DSKT2_ */
Int DSKT2_deactivateAll()
All algorithms that have been deactivated lazily are now really deactivate. Any algorithms that are s...
Void DSKT2_freeScratch(Int mutexId, Void *addr, UInt size)
Alocates memory from a DSKT2 shared scratch group buffer.
Bool DSKT2_freeAlg(Int scratchMutexId, IALG_Handle alg)
Deletes a XDAIS algorithm instance object and frees all persistent memory allocated for the instance ...
__FAR__ xdc_runtime_IHeap_Handle DSKT2_daram1Heap
__FAR__ xdc_runtime_IHeap_Handle DSKT2_daram2Heap
__FAR__ xdc_runtime_IHeap_Handle DSKT2_iprogHeap
__FAR__ xdc_runtime_IHeap_Handle DSKT2_saram1Heap
IALG_Handle DSKT2_createAlgExt(Int scratchId, IALG_Fxns *fxns, IALG_Handle parent, IALG_Params *params)
Creates and initializes a XDAIS algorithm instance object, allocating all algorithm memory in externa...
Memory records.
Definition: ialg.h:142
Pointer to algorithm specific status structure.
Definition: ialg.h:187
Algorithm instance object definition.
Definition: ialg.h:159
Void DSKT2_freePersistent(IALG_MemRec *memTab, Int numRecs)
Frees persistent memory from the requesting algorithm.
__FAR__ UInt _DSKT2_ALLOW_EXTERNAL_SCRATCH
Void DSKT2_activateAlg(Int scratchMutexId, IALG_Handle alg)
Prepares a XDAIS algorithm instance object to start using its scratch memory.
__FAR__ DSKT2_CacheWBInvFxn DSKT2_cacheWBInvFxn
Cache writeback function pointer used by DSKT2 if not NULL.
Bool DSKT2_allocPersistent(IALG_MemRec *memTab, Int numRecs)
Alocates persistent memory to the requesting algorithm.
Algorithm instance creation parameters.
Definition: ialg.h:176
IRES Interface Definitions - Allows algorithms to request and receive handles representing private lo...
__FAR__ xdc_runtime_IHeap_Handle _DSKT2_heap
__FAR__ xdc_runtime_IHeap_Handle DSKT2_esdataHeap
This header defines all types, constants, and functions defined by XDAIS for algorithms.
__FAR__ Bool ti_sdo_fc_dskt2_DSKT2_disableLazyDeactivate
Set this to TRUE to disable lazy deactivate feature in DSKT2.
IALG_Handle DSKT2_createAlg(Int scratchMutexId, IALG_Fxns *fxns, IALG_Handle parent, IALG_Params *params)
Creates and initializes a XDAIS algorithm instance object.
Bool DSKT2_allocScratch(IALG_Handle alg, Int mutexId, IALG_MemRec *memTab, Int numRecs)
Alocates memory from a DSKT2 shared scratch group buffer.
Defines the fields and methods that must be supplied by all XDAIS algorithms.
Definition: ialg.h:225
IALG_Handle DSKT2_createAlg2(Int scratchMutexId, IALG_Fxns *fxns, IALG_Handle parent, IALG_Params *params, xdc_runtime_IHeap_Handle extHeapId)
Creates and initializes a XDAIS algorithm instance object.
Void(* DSKT2_CacheWBInvFxn)(Ptr blockPtr, size_t byteCnt, Bool wait)
Function prototype of cache writeback function: Writes back the memory within the range of blockPtr a...
Definition: dskt2.h:96
Int DSKT2_controlAlg(IALG_Handle alg, IALG_Cmd cmd, IALG_Status *status)
This is a convenience API to call a XDAIS algorithm instance's algControl function.
__FAR__ xdc_runtime_IHeap_Handle DSKT2_eprogHeap
__FAR__ UInt _DSKT2_DARAM_SCRATCH_SIZES[]
__FAR__ xdc_runtime_IHeap_Handle DSKT2_saram0Heap
__FAR__ xdc_runtime_IHeap_Handle DSKT2_daram0Heap
__FAR__ xdc_runtime_IHeap_Handle DSKT2_saram2Heap
Specifies the algorithm specific handles and context save & restore function pointers and arguments t...
Definition: ires.h:84
Void * IRES_YieldArgs
Definition: ires.h:140
Void DSKT2_deactivateAlg(Int scratchMutexId, IALG_Handle alg)
Prepares a XDAIS algorithm instance object to give up using its scratch memory.
Int DSKT2_getScratchId(IALG_Handle alg)
__FAR__ UInt _DSKT2_SARAM_SCRATCH_SIZES[]
unsigned int IALG_Cmd
Algorithm specific command.
Definition: ialg.h:199
IRES_YieldResourceType
Definition: ires.h:60
Copyright 2015, Texas Instruments Incorporated