| preludedrew | f4ed1b6 | 2010-12-30 20:53:51 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2001-2008 Texas Instruments - http://www.ti.com/ |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | |
| 18 | /* |
| 19 | * ======== cmmdefs.h ======== |
| 20 | * DSP-BIOS Bridge driver support functions for TI OMAP processors. |
| 21 | * Purpose: |
| 22 | * Global MEM constants and types. |
| 23 | * |
| 24 | *! Revision History: |
| 25 | *! ================ |
| 26 | *! 12-Nov-2001 ag CMM_KERNMAPTYPE added for dsp<->device process addr map'n. |
| 27 | *! This allows addr conversion from drvr process <-> DSP addr. |
| 28 | *! 29-Aug-2001 ag Added CMM_ALLSEGMENTS. |
| 29 | *! 08-Dec-2000 ag Added bus address conversion type CMM_POMAPEMIF2DSPBUS. |
| 30 | *! 05-Dec-2000 ag Added default CMM_DEFLTCONVFACTOR & CMM_DEFLTDSPADDROFFSET. |
| 31 | *! 29-Oct-2000 ag Added converstion factor for GPP DSP Pa translation. |
| 32 | *! 15-Oct-2000 ag Added address translator attributes and defaults. |
| 33 | *! 12-Jul-2000 ag Created. |
| 34 | */ |
| 35 | |
| 36 | #ifndef CMMDEFS_ |
| 37 | #define CMMDEFS_ |
| 38 | |
| 39 | #ifdef __cplusplus |
| 40 | extern "C" { |
| 41 | #endif |
| 42 | |
| 43 | #include <list.h> |
| 44 | |
| 45 | /* Cmm attributes used in CMM_Create() */ |
| 46 | struct CMM_MGRATTRS { |
| 47 | ULONG ulMinBlockSize; /* Minimum SM allocation; default 32 bytes. */ |
| 48 | }; |
| 49 | |
| 50 | /* Attributes for CMM_AllocBuf() & CMM_AllocDesc() */ |
| 51 | struct CMM_ATTRS { |
| 52 | ULONG ulSegId; /* 1,2... are SM segments. 0 is not. */ |
| 53 | ULONG ulAlignment; /* 0,1,2,4....ulMinBlockSize */ |
| 54 | } ; |
| 55 | |
| 56 | /* |
| 57 | * DSPPa to GPPPa Conversion Factor. |
| 58 | * |
| 59 | * For typical platforms: |
| 60 | * converted Address = PaDSP + ( cFactor * addressToConvert). |
| 61 | */ |
| 62 | typedef enum { |
| 63 | CMM_SUBFROMDSPPA = -1, |
| 64 | CMM_POMAPEMIF2DSPBUS = 0, /* PreOMAP is special case: not simple offset */ |
| 65 | CMM_ADDTODSPPA = 1 |
| 66 | } CMM_CNVTTYPE; |
| 67 | |
| 68 | #define CMM_DEFLTDSPADDROFFSET 0 |
| 69 | #define CMM_DEFLTCONVFACTOR CMM_POMAPEMIF2DSPBUS /* PreOMAP DSPBUS<->EMIF */ |
| 70 | #define CMM_ALLSEGMENTS 0xFFFFFF /* All SegIds */ |
| 71 | #define CMM_MAXGPPSEGS 1 /* Maximum # of SM segs */ |
| 72 | |
| 73 | /* |
| 74 | * SMSEGs are SM segments the DSP allocates from. |
| 75 | * |
| 76 | * This info is used by the GPP to xlate DSP allocated PAs. |
| 77 | */ |
| 78 | struct CMM_SMSEG { |
| 79 | DWORD dwSMBasePA; /* Physical SM Base address(GPP). */ |
| 80 | ULONG ulTotalSizePA; /* Size of SM segment in GPP bytes. */ |
| 81 | DWORD dwPAPAConvert; /* DSP PA to GPP PA Conversion. */ |
| 82 | CMM_CNVTTYPE cFactor; /* CMM_ADDTOPA=1, CMM_SUBFROMPA=-1 */ |
| 83 | } ; |
| 84 | |
| 85 | /* Fixed size memory descriptor */ |
| 86 | struct CMM_FDESC { |
| 87 | struct LST_ELEM link; /* must be 1st element */ |
| 88 | DWORD dwPA; |
| 89 | DWORD dwVA; |
| 90 | DWORD dwSize; |
| 91 | DWORD dwAttrs; /* [31-1 reserved ][0 - SM] */ |
| 92 | } ; |
| 93 | |
| 94 | struct CMM_SEGINFO { |
| 95 | DWORD dwSegBasePa; /* Start Phys address of SM segment */ |
| 96 | ULONG ulTotalSegSize; /* Total size in bytes of segment: DSP+GPP */ |
| 97 | DWORD dwGPPBasePA; /* Start Phys addr of Gpp SM seg */ |
| 98 | ULONG ulGPPSize; /* Size of Gpp SM seg in bytes */ |
| 99 | DWORD dwDSPBaseVA; /* DSP virt base byte address */ |
| 100 | ULONG ulDSPSize; /* DSP seg size in bytes */ |
| 101 | ULONG ulInUseCnt; /* # of current GPP allocations from this segment */ |
| 102 | DWORD dwSegBaseVa; /* Start Virt address of SM seg */ |
| 103 | |
| 104 | } ; |
| 105 | |
| 106 | /* CMM useful information */ |
| 107 | struct CMM_INFO { |
| 108 | ULONG ulNumGPPSMSegs; /* # of SM segments registered with this Cmm. */ |
| 109 | ULONG ulTotalInUseCnt; /* Total # of allocations outstanding for CMM */ |
| 110 | /* Min SM block size allocation from CMM_Create() */ |
| 111 | ULONG ulMinBlockSize; |
| 112 | /* Info per registered SM segment. */ |
| 113 | struct CMM_SEGINFO segInfo[CMM_MAXGPPSEGS]; |
| 114 | } ; |
| 115 | |
| 116 | /* XlatorCreate attributes */ |
| 117 | struct CMM_XLATORATTRS { |
| 118 | ULONG ulSegId; /* segment Id used for SM allocations */ |
| 119 | DWORD dwDSPBufs; /* # of DSP-side bufs */ |
| 120 | DWORD dwDSPBufSize; /* size of DSP-side bufs in GPP bytes */ |
| 121 | PVOID pVmBase; /* Vm base address alloc'd in client process context */ |
| 122 | DWORD dwVmSize; /* dwVmSize must be >= (dwMaxNumBufs * dwMaxSize) */ |
| 123 | } ; |
| 124 | |
| 125 | /* Descriptor attributes */ |
| 126 | typedef enum { |
| 127 | CMM_LOCAL = 0, /* Bit 0 =0 is local memory from default heap */ |
| 128 | CMM_SHARED = 1, /* Bit 0 =1 descriptor is SM */ |
| 129 | /* Bits 1- 31 RESERVED for future use */ |
| 130 | } CMM_DESCTYPE; |
| 131 | |
| 132 | /* |
| 133 | * Cmm translation types. Use to map SM addresses to process context. |
| 134 | */ |
| 135 | typedef enum { |
| 136 | CMM_VA2PA = 0, /* Virtual to GPP physical address xlation */ |
| 137 | CMM_PA2VA = 1, /* GPP Physical to virtual */ |
| 138 | CMM_VA2DSPPA = 2, /* Va to DSP Pa */ |
| 139 | CMM_PA2DSPPA = 3, /* GPP Pa to DSP Pa */ |
| 140 | CMM_DSPPA2PA = 4, /* DSP Pa to GPP Pa */ |
| 141 | } CMM_XLATETYPE; |
| 142 | |
| 143 | /* |
| 144 | * Used to "map" between device process virt addr and dsp addr. |
| 145 | */ |
| 146 | typedef enum { |
| 147 | CMM_KERNVA2DSP = 0, /* Device process context to dsp address. */ |
| 148 | CMM_DSP2KERNVA = 1, /* Dsp address to device process context. */ |
| 149 | } CMM_KERNMAPTYPE; |
| 150 | |
| 151 | struct CMM_OBJECT; |
| 152 | /*typedef struct CMM_OBJECT *CMM_HMGR;*/ |
| 153 | struct CMM_XLATOROBJECT; |
| 154 | /*typedef struct CMM_XLATOROBJECT *CMM_HXLATOR;*/ |
| 155 | |
| 156 | #ifdef __cplusplus |
| 157 | } |
| 158 | #endif |
| 159 | #endif /* CMMDEFS_ */ |