Home | History | Annotate | Download | only in inc
      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  *  ======== cfg.h ========
     19  *  DSP-BIOS Bridge driver support functions for TI OMAP processors.
     20  *  Purpose:
     21  *      PM Configuration module.
     22  *
     23  *  Private Functions:
     24  *      CFG_Exit
     25  *      CFG_GetAutoStart
     26  *      CFG_GetCDVersion
     27  *      CFG_GetDevObject
     28  *      CFG_GetDSPResources
     29  *      CFG_GetExecFile
     30  *      CFG_GetHostResources
     31  *      CFG_GetObject
     32  *      CFG_GetPerfValue
     33  *      CFG_GetWMDFileName
     34  *      CFG_GetZLFile
     35  *      CFG_Init
     36  *      CFG_SetDevObject
     37  *      CFG_SetObject
     38  *
     39  *! Revision History:
     40  *! =================
     41  *! 26-Feb-2003 kc  Removed unused CFG fxns.
     42  *! 28-Aug-2001 jeh  Added CFG_GetLoaderName.
     43  *! 26-Jul-2000 rr:  Added CFG_GetDCDName to retrieve the DCD Dll name.
     44  *! 13-Jul-2000 rr:  Added CFG_GetObject & CFG_SetObject.
     45  *! 13-Jan-2000 rr:  CFG_Get/SetPrivateDword renamed to CFG_Get/SetDevObject.
     46  *!                  CFG_GetWinBRIDGEDir/Directory,CFG_GetSearchPath removed.
     47  *! 15-Jan-1998 cr:  Code review cleanup.
     48  *! 16-Aug-1997 cr:  Added explicit cdecl identifiers.
     49  *! 12-Dec-1996 gp:  Moved CFG_FindInSearchPath to CSP module.
     50  *! 13-Sep-1996 gp:  Added CFG_GetBoardName().
     51  *! 22-Jul-1996 gp:  Added CFG_GetTraceStr, to retrieve an initial GT trace.
     52  *! 26-Jun-1996 cr:  Added CFG_FindInSearchPath.
     53  *! 25-Jun-1996 cr:  Added CFG_GetWinSPOXDir.
     54  *! 17-Jun-1996 cr:  Added CFG_GetDevNode.
     55  *! 11-Jun-1996 cr:  Cleaned up for code review.
     56  *! 07-Jun-1996 cr:  Added CFG_GetExecFile and CFG_GetZLFileName functions.
     57  *! 04-Jun-1996 gp:  Added AutoStart regkey and accessor function.  Placed
     58  *!                  OUT parameters in accessor function param. lists at end.
     59  *! 29-May-1996 gp:  Moved DEV_HDEVNODE to here and renamed CFG_HDEVNODE.
     60  *! 22-May-1996 cr:  Added GetHostResources, GetDSPResources, and
     61  *!                  GetWMDFileName services.
     62  *! 18-May-1996 gp:  Created.
     63  */
     64 
     65 #ifndef CFG_
     66 #define CFG_
     67 
     68 #ifdef __cplusplus
     69 extern "C" {
     70 #endif
     71 
     72 #include <dspapi.h>
     73 #include <cfgdefs.h>
     74 
     75 /*
     76  *  ======== CFG_Exit ========
     77  *  Purpose:
     78  *      Discontinue usage of the CFG module.
     79  *  Parameters:
     80  *  Returns:
     81  *  Requires:
     82  *      CFG_Init() was previously called.
     83  *  Ensures:
     84  *      Resources acquired in CFG_Init() are freed.
     85  */
     86 	extern VOID CFG_Exit();
     87 
     88 /*
     89  *  ======== CFG_GetAutoStart ========
     90  *  Purpose:
     91  *      Retreive the autostart mask, if any, for this board.
     92  *  Parameters:
     93  *      hDevNode:       Handle to the DevNode who's WMD we are querying.
     94  *      pdwAutoStart:   Ptr to location for 32 bit autostart mask.
     95  *  Returns:
     96  *      DSP_SOK:                Success.
     97  *      CFG_E_INVALIDHDEVNODE:  hDevNode is invalid.
     98  *      CFG_E_RESOURCENOTAVAIL: Unable to retreive resource.
     99  *  Requires:
    100  *      CFG initialized.
    101  *  Ensures:
    102  *      DSP_SOK:        *pdwAutoStart contains autostart mask for this devnode.
    103  */
    104 	extern DSP_STATUS CFG_GetAutoStart(IN struct CFG_DEVNODE* hDevNode,
    105 					   OUT DWORD * pdwAutoStart);
    106 
    107 /*
    108  *  ======== CFG_GetCDVersion ========
    109  *  Purpose:
    110  *      Retrieves the version of the PM Class Driver.
    111  *  Parameters:
    112  *      pdwVersion: Ptr to DWORD to contain version number upon return.
    113  *  Returns:
    114  *      DSP_SOK:    Success.  pdwVersion contains Class Driver version in
    115  *                  the form: 0xAABBCCDD where AABB is Major version and
    116  *                  CCDD is Minor.
    117  *      DSP_EFAIL:  Failure.
    118  *  Requires:
    119  *      CFG initialized.
    120  *  Ensures:
    121  *      DSP_SOK:    Success.
    122  *      else:       *pdwVersion is NULL.
    123  */
    124 	extern DSP_STATUS CFG_GetCDVersion(OUT DWORD * pdwVersion);
    125 
    126 /*
    127  *  ======== CFG_GetDevObject ========
    128  *  Purpose:
    129  *      Retrieve the Device Object handle for a given devnode.
    130  *  Parameters:
    131  *      hDevNode:       Platform's DevNode handle from which to retrieve value.
    132  *      pdwValue:       Ptr to location to store the value.
    133  *  Returns:
    134  *      DSP_SOK:                Success.
    135  *      CFG_E_INVALIDHDEVNODE:  hDevNode is invalid.
    136  *      CFG_E_INVALIDPOINTER:   phDevObject is invalid.
    137  *      CFG_E_RESOURCENOTAVAIL: The resource is not available.
    138  *  Requires:
    139  *      CFG initialized.
    140  *  Ensures:
    141  *      DSP_SOK:    *pdwValue is set to the retrieved DWORD.
    142  *      else:       *pdwValue is set to 0L.
    143  */
    144 	extern DSP_STATUS CFG_GetDevObject(IN struct CFG_DEVNODE* hDevNode,
    145 					   OUT DWORD * pdwValue);
    146 
    147 /*
    148  *  ======== CFG_GetDSPResources ========
    149  *  Purpose:
    150  *      Get the DSP resources available to a given device.
    151  *  Parameters:
    152  *      hDevNode:       Handle to the DEVNODE who's resources we are querying.
    153  *      pDSPResTable:   Ptr to a location to store the DSP resource table.
    154  *  Returns:
    155  *      DSP_SOK:                On success.
    156  *      CFG_E_INVALIDHDEVNODE:  hDevNode is invalid.
    157  *      CFG_E_RESOURCENOTAVAIL: The DSP Resource information is not
    158  *                              available
    159  *  Requires:
    160  *      CFG initialized.
    161  *  Ensures:
    162  *      DSP_SOK:    pDSPResTable points to a filled table of resources allocated
    163  *                  for the specified WMD.
    164  */
    165 	extern DSP_STATUS CFG_GetDSPResources(IN struct CFG_DEVNODE* hDevNode,
    166 					      OUT struct CFG_DSPRES * pDSPResTable);
    167 
    168 
    169 /*
    170  *  ======== CFG_GetExecFile ========
    171  *  Purpose:
    172  *      Retreive the default executable, if any, for this board.
    173  *  Parameters:
    174  *      hDevNode:       Handle to the DevNode who's WMD we are querying.
    175  *      cBufSize:       Size of buffer.
    176  *      pstrExecFile:   Ptr to character buf to hold ExecFile.
    177  *  Returns:
    178  *      DSP_SOK:                Success.
    179  *      CFG_E_INVALIDHDEVNODE:  hDevNode is invalid.
    180  *      CFG_E_INVALIDPOINTER:   pstrExecFile is invalid.
    181  *      CFG_E_RESOURCENOTAVAIL: The resource is not available.
    182  *  Requires:
    183  *      CFG initialized.
    184  *  Ensures:
    185  *      DSP_SOK:    Not more than cBufSize bytes were copied into pstrExecFile,
    186  *                  and *pstrExecFile contains default executable for this
    187  *                  devnode.
    188  */
    189 	extern DSP_STATUS CFG_GetExecFile(IN struct CFG_DEVNODE* hDevNode,
    190 					  IN ULONG cBufSize,
    191 					  OUT PSTR pstrExecFile);
    192 
    193 /*
    194  *  ======== CFG_GetHostResources ========
    195  *  Purpose:
    196  *      Get the Host PC allocated resources assigned to a given device.
    197  *  Parameters:
    198  *      hDevNode:       Handle to the DEVNODE who's resources we are querying.
    199  *      pHostResTable:  Ptr to a location to store the host resource table.
    200  *  Returns:
    201  *      DSP_SOK:                On success.
    202  *      CFG_E_INVALIDPOINTER:   pHostResTable is invalid.
    203  *      CFG_E_INVALIDHDEVNODE:  hDevNode is invalid.
    204  *      CFG_E_RESOURCENOTAVAIL: The resource is not available.
    205  *  Requires:
    206  *      CFG initialized.
    207  *  Ensures:
    208  *      DSP_SOK:    pHostResTable points to a filled table of resources
    209  *                  allocated for the specified WMD.
    210  *
    211  */
    212 	extern DSP_STATUS CFG_GetHostResources(IN struct CFG_DEVNODE* hDevNode,
    213 					       OUT struct CFG_HOSTRES * pHostResTable);
    214 
    215 /*
    216  *  ======== CFG_GetObject ========
    217  *  Purpose:
    218  *      Retrieve the Driver Object handle From the Registry
    219  *  Parameters:
    220  *      pdwValue:   Ptr to location to store the value.
    221  *      dwType      Type of Object to Get
    222  *  Returns:
    223  *      DSP_SOK:    Success.
    224  *  Requires:
    225  *      CFG initialized.
    226  *  Ensures:
    227  *      DSP_SOK:    *pdwValue is set to the retrieved DWORD(non-Zero).
    228  *      else:       *pdwValue is set to 0L.
    229  */
    230 	extern DSP_STATUS CFG_GetObject(OUT DWORD * pdwValue, DWORD dwType);
    231 
    232 /*
    233  *  ======== CFG_GetPerfValue ========
    234  *  Purpose:
    235  *      Retrieve a flag indicating whether PERF should log statistics for the
    236  *      PM class driver.
    237  *  Parameters:
    238  *      pfEnablePerf:   Location to store flag.  0 indicates the key was
    239  *                      not found, or had a zero value.  A nonzero value
    240  *                      means the key was found and had a nonzero value.
    241  *  Returns:
    242  *  Requires:
    243  *      pfEnablePerf != NULL;
    244  *  Ensures:
    245  */
    246 	extern VOID CFG_GetPerfValue(OUT bool * pfEnablePerf);
    247 
    248 /*
    249  *  ======== CFG_GetWMDFileName ========
    250  *  Purpose:
    251  *    Get the mini-driver file name for a given device.
    252  *  Parameters:
    253  *      hDevNode:       Handle to the DevNode who's WMD we are querying.
    254  *      cBufSize:       Size of buffer.
    255  *      pWMDFileName:   Ptr to a character buffer to hold the WMD filename.
    256  *  Returns:
    257  *      DSP_SOK:                On success.
    258  *      CFG_E_INVALIDHDEVNODE:  hDevNode is invalid.
    259  *      CFG_E_RESOURCENOTAVAIL: The filename is not available.
    260  *  Requires:
    261  *      CFG initialized.
    262  *  Ensures:
    263  *      DSP_SOK:        Not more than cBufSize bytes were copied
    264  *                      into pWMDFileName.
    265  *
    266  */
    267 	extern DSP_STATUS CFG_GetWMDFileName(IN struct CFG_DEVNODE* hDevNode,
    268 					     IN ULONG cBufSize,
    269 					     OUT PSTR pWMDFileName);
    270 
    271 /*
    272  *  ======== CFG_GetZLFile ========
    273  *  Purpose:
    274  *      Retreive the ZLFile, if any, for this board.
    275  *  Parameters:
    276  *      hDevNode:       Handle to the DevNode who's WMD we are querying.
    277  *      cBufSize:       Size of buffer.
    278  *      pstrZLFileName: Ptr to character buf to hold ZLFileName.
    279  *  Returns:
    280  *      DSP_SOK:                Success.
    281  *      CFG_E_INVALIDPOINTER:   pstrZLFileName is invalid.
    282  *      CFG_E_INVALIDHDEVNODE:  hDevNode is invalid.
    283  *      CFG_E_RESOURCENOTAVAIL: couldn't find the ZLFileName.
    284  *  Requires:
    285  *      CFG initialized.
    286  *  Ensures:
    287  *      DSP_SOK:    Not more than cBufSize bytes were copied into
    288  *                  pstrZLFileName, and *pstrZLFileName contains ZLFileName
    289  *                  for this devnode.
    290  */
    291 	extern DSP_STATUS CFG_GetZLFile(IN struct CFG_DEVNODE* hDevNode,
    292 					IN ULONG cBufSize,
    293 					OUT PSTR pstrZLFileName);
    294 
    295 /*
    296  *  ======== CFG_Init ========
    297  *  Purpose:
    298  *      Initialize the CFG module's private state.
    299  *  Parameters:
    300  *  Returns:
    301  *      TRUE if initialized; FALSE if error occured.
    302  *  Requires:
    303  *  Ensures:
    304  *      A requirement for each of the other public CFG functions.
    305  */
    306 	extern bool CFG_Init();
    307 
    308 /*
    309  *  ======== CFG_SetDevObject ========
    310  *  Purpose:
    311  *      Store the Device Object handle for a given devnode.
    312  *  Parameters:
    313  *      hDevNode:   Platform's DevNode handle we are storing value with.
    314  *      dwValue:    Arbitrary value to store.
    315  *  Returns:
    316  *      DSP_SOK:                Success.
    317  *      CFG_E_INVALIDHDEVNODE:  hDevNode is invalid.
    318  *      DSP_EFAIL:              Internal Error.
    319  *  Requires:
    320  *      CFG initialized.
    321  *  Ensures:
    322  *      DSP_SOK:    The Private DWORD was successfully set.
    323  */
    324 	extern DSP_STATUS CFG_SetDevObject(IN struct CFG_DEVNODE* hDevNode,
    325 					   IN DWORD dwValue);
    326 
    327 /*
    328  *  ======== CFG_SetDrvObject ========
    329  *  Purpose:
    330  *      Store the Driver Object handle.
    331  *  Parameters:
    332  *      dwValue:        Arbitrary value to store.
    333  *      dwType          Type of Object to Store
    334  *  Returns:
    335  *      DSP_SOK:        Success.
    336  *      DSP_EFAIL:      Internal Error.
    337  *  Requires:
    338  *      CFG initialized.
    339  *  Ensures:
    340  *      DSP_SOK:        The Private DWORD was successfully set.
    341  */
    342 	extern DSP_STATUS CFG_SetObject(IN DWORD dwValue, IN DWORD dwType);
    343 
    344 	extern DSP_STATUS CFG_GetC55Procs(OUT DWORD * numProcs);
    345 #ifdef __cplusplus
    346 }
    347 #endif
    348 #endif				/* CFG_ */
    349