/* * Copyright 2001-2008 Texas Instruments - http://www.ti.com/ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * ======== dbdcd.h ======== * DSP-BIOS Bridge driver support functions for TI OMAP processors. * Description: * Defines the DSP/BIOS Bridge Configuration Database (DCD) API. * *! Revision History *! ================ *! 03-Dec-2003 map Changed DCD_OBJTYPE to DSP_DCDOBJTYPE *! 24-Feb-2003 kc Updated DCD_AutoUnregister and DCD_GetObjects to simplify *! DCD implementation. *! 05-Aug-2002 jeh Added DCD_GetObjects(). *! 11-Jul-2002 jeh Added DCD_GetDepLibs(), DCD_GetNumDepLibs(). *! 22-Apr-2002 jeh Added DCD_GetLibraryName(). *! 03-Apr-2001 sg Changed error names to have DCD_E* format. *! 13-Feb-2001 kc Name changed from dcdbs.h to dbdcd.h. *! 12-Dec-2000 kc Added DCD_AutoUnregister. *! 09-Nov-2000 kc Updated usage of DCD_EnumerateObject. *! 30-Oct-2000 kc Added DCD_AutoRegister. Updated error DCD error codes. *! 29-Sep-2000 kc Incorporated code review comments. See *! /src/reviews/dcd_review.txt. *! 26-Jul-2000 kc Created. *! */ #ifndef DBDCD_ #define DBDCD_ #ifdef __cplusplus extern "C" { #endif #include #include /* * ======== DCD_AutoRegister ======== * Purpose: * This function automatically registers DCD objects specified in a * special COFF section called ".dcd_register" * Parameters: * hDcdMgr: A DCD manager handle. * pszCoffPath: Pointer to name of COFF file containing DCD * objects to be registered. * Returns: * DSP_SOK: Success. * DSP_EDCDNOAUTOREGISTER: Unable to find auto-registration section. * DSP_EDCDREADSECT: Unable to read object code section. * DSP_EDCDLOADBASE: Unable to load code base. * DSP_EHANDLE: Invalid DCD_HMANAGER handle.. * Requires: * DCD initialized. * Ensures: * Note: * Due to the DCD database construction, it is essential for a DCD-enabled * COFF file to contain the right COFF sections, especially * ".dcd_register", which is used for auto registration. */ extern DSP_STATUS DCD_AutoRegister(IN struct DCD_MANAGER* hDcdMgr, IN CHAR * pszCoffPath); /* * ======== DCD_AutoUnregister ======== * Purpose: * This function automatically unregisters DCD objects specified in a * special COFF section called ".dcd_register" * Parameters: * hDcdMgr: A DCD manager handle. * pszCoffPath: Pointer to name of COFF file containing * DCD objects to be unregistered. * Returns: * DSP_SOK: Success. * DSP_EDCDNOAUTOREGISTER: Unable to find auto-registration section. * DSP_EDCDREADSECT: Unable to read object code section. * DSP_EDCDLOADBASE: Unable to load code base. * DSP_EHANDLE: Invalid DCD_HMANAGER handle.. * Requires: * DCD initialized. * Ensures: * Note: * Due to the DCD database construction, it is essential for a DCD-enabled * COFF file to contain the right COFF sections, especially * ".dcd_register", which is used for auto unregistration. */ extern DSP_STATUS DCD_AutoUnregister(IN struct DCD_MANAGER* hDcdMgr, IN CHAR * pszCoffPath); /* * ======== DCD_CreateManager ======== * Purpose: * This function creates a DCD module manager. * Parameters: * pszZlDllName: Pointer to a DLL name string. * phDcdMgr: A pointer to a DCD manager handle. * Returns: * DSP_SOK: Success. * DSP_EMEMORY: Unable to allocate memory for DCD manager handle. * DSP_EFAIL: General failure. * Requires: * DCD initialized. * pszZlDllName is non-NULL. * phDcdMgr is non-NULL. * Ensures: * A DCD manager handle is created. */ extern DSP_STATUS DCD_CreateManager(IN CHAR * pszZlDllName, OUT struct DCD_MANAGER* * phDcdMgr); /* * ======== DCD_DestroyManager ======== * Purpose: * This function destroys a DCD module manager. * Parameters: * hDcdMgr: A DCD manager handle. * Returns: * DSP_SOK: Success. * DSP_EHANDLE: Invalid DCD manager handle. * Requires: * DCD initialized. * Ensures: */ extern DSP_STATUS DCD_DestroyManager(IN struct DCD_MANAGER* hDcdMgr); /* * ======== DCD_EnumerateObject ======== * Purpose: * This function enumerates currently visible DSP/BIOS Bridge objects * and returns the UUID and type of each enumerated object. * Parameters: * cIndex: The object enumeration index. * objType: Type of object to enumerate. * pUuid: Pointer to a DSP_UUID object. * Returns: * DSP_SOK: Success. * DSP_EFAIL: Unable to enumerate through the DCD database. * DSP_SENUMCOMPLETE: Enumeration completed. This is not an error code. * Requires: * DCD initialized. * pUuid is a valid pointer. * Ensures: * Details: * This function can be used in conjunction with DCD_GetObjectDef to * retrieve object properties. */ extern DSP_STATUS DCD_EnumerateObject(IN INT cIndex, IN DSP_DCDOBJTYPE objType, OUT struct DSP_UUID * pUuid); /* * ======== DCD_Exit ======== * Purpose: * This function cleans up the DCD module. * Parameters: * Returns: * Requires: * DCD initialized. * Ensures: */ extern VOID DCD_Exit(); /* * ======== DCD_GetDepLibs ======== * Purpose: * Given the uuid of a library and size of array of uuids, this function * fills the array with the uuids of all dependent libraries of the input * library. * Parameters: * hDcdMgr: A DCD manager handle. * pUuid: Pointer to a DSP_UUID for a library. * numLibs: Size of uuid array (number of library uuids). * pDepLibUuids: Array of dependent library uuids to be filled in. * pPersistentDepLibs: Array indicating if corresponding lib is persistent. * phase: phase to obtain correct input library * Returns: * DSP_SOK: Success. * DSP_EMEMORY: Memory allocation failure. * DSP_EDCDREADSECT: Failure to read section containing library info. * DSP_EFAIL: General failure. * Requires: * DCD initialized. * Valid hDcdMgr. * pUuid != NULL * pDepLibUuids != NULL. * Ensures: */ extern DSP_STATUS DCD_GetDepLibs(IN struct DCD_MANAGER* hDcdMgr, IN struct DSP_UUID * pUuid, USHORT numLibs, OUT struct DSP_UUID * pDepLibUuids, OUT bool * pPersistentDepLibs, IN NLDR_PHASE phase); /* * ======== DCD_GetNumDepLibs ======== * Purpose: * Given the uuid of a library, determine its number of dependent * libraries. * Parameters: * hDcdMgr: A DCD manager handle. * pUuid: Pointer to a DSP_UUID for a library. * pNumLibs: Size of uuid array (number of library uuids). * pNumPersLibs: number of persistent dependent library. * phase: Phase to obtain correct input library * Returns: * DSP_SOK: Success. * DSP_EMEMORY: Memory allocation failure. * DSP_EDCDREADSECT: Failure to read section containing library info. * DSP_EFAIL: General failure. * Requires: * DCD initialized. * Valid hDcdMgr. * pUuid != NULL * pNumLibs != NULL. * Ensures: */ extern DSP_STATUS DCD_GetNumDepLibs(IN struct DCD_MANAGER* hDcdMgr, IN struct DSP_UUID * pUuid, OUT USHORT * pNumLibs, OUT USHORT * pNumPersLibs, IN NLDR_PHASE phase); /* * ======== DCD_GetLibraryName ======== * Purpose: * This function returns the name of a (dynamic) library for a given * UUID. * Parameters: * hDcdMgr: A DCD manager handle. * pUuid: Pointer to a DSP_UUID that represents a unique DSP/BIOS * Bridge object. * pstrLibName: Buffer to hold library name. * pdwSize: Contains buffer size. Set to string size on output. * phase: Which phase to load * fPhaseSplit: Are phases in multiple libraries * Returns: * DSP_SOK: Success. * DSP_EFAIL: General failure. * Requires: * DCD initialized. * Valid hDcdMgr. * pstrLibName != NULL. * pUuid != NULL * pdwSize != NULL. * Ensures: */ extern DSP_STATUS DCD_GetLibraryName(IN struct DCD_MANAGER* hDcdMgr, IN struct DSP_UUID * pUuid, IN OUT PSTR pstrLibName, IN OUT DWORD * pdwSize, IN NLDR_PHASE phase, OUT bool * fPhaseSplit); /* * ======== DCD_GetObjectDef ======== * Purpose: * This function returns the properties/attributes of a DSP/BIOS Bridge * object. * Parameters: * hDcdMgr: A DCD manager handle. * pUuid: Pointer to a DSP_UUID that represents a unique * DSP/BIOS Bridge object. * objType: The type of DSP/BIOS Bridge object to be * referenced (node, processor, etc). * pObjDef: Pointer to an object definition structure. A * union of various possible DCD object types. * Returns: * DSP_SOK: Success. * DSP_EDCDPARSESECT: Unable to parse content of object code section. * DSP_EDCDREADSECT: Unable to read object code section. * DSP_EDCDGETSECT: Unable to access object code section. * DSP_EDCDLOADBASE: Unable to load code base. * DSP_EFAIL: General failure. * DSP_EHANDLE: Invalid DCD_HMANAGER handle. * Requires: * DCD initialized. * pObjUuid is non-NULL. * pObjDef is non-NULL. * Ensures: */ extern DSP_STATUS DCD_GetObjectDef(IN struct DCD_MANAGER* hDcdMgr, IN struct DSP_UUID * pObjUuid, IN DSP_DCDOBJTYPE objType, OUT struct DCD_GENERICOBJ *pObjDef); /* * ======== DCD_GetObjects ======== * Purpose: * This function finds all DCD objects specified in a special * COFF section called ".dcd_register", and for each object, * call a "register" function. The "register" function may perform * various actions, such as 1) register nodes in the node database, 2) * unregister nodes from the node database, and 3) add overlay nodes. * Parameters: * hDcdMgr: A DCD manager handle. * pszCoffPath: Pointer to name of COFF file containing DCD * objects. * registerFxn: Callback fxn to be applied on each located * DCD object. * handle: Handle to pass to callback. * Returns: * DSP_SOK: Success. * DSP_EDCDNOAUTOREGISTER: Unable to find .dcd_register section. * DSP_EDCDREADSECT: Unable to read object code section. * DSP_EDCDLOADBASE: Unable to load code base. * DSP_EHANDLE: Invalid DCD_HMANAGER handle.. * Requires: * DCD initialized. * Ensures: * Note: * Due to the DCD database construction, it is essential for a DCD-enabled * COFF file to contain the right COFF sections, especially * ".dcd_register", which is used for auto registration. */ extern DSP_STATUS DCD_GetObjects(IN struct DCD_MANAGER* hDcdMgr, IN CHAR * pszCoffPath, DCD_REGISTERFXN registerFxn, PVOID handle); /* * ======== DCD_Init ======== * Purpose: * This function initializes DCD. * Parameters: * Returns: * FALSE: Initialization failed. * TRUE: Initialization succeeded. * Requires: * Ensures: * DCD initialized. */ extern bool DCD_Init(); /* * ======== DCD_RegisterObject ======== * Purpose: * This function registers a DSP/BIOS Bridge object in the DCD database. * Parameters: * pUuid: Pointer to a DSP_UUID that identifies a DSP/BIOS * Bridge object. * objType: Type of object. * pszPathName: Path to the object's COFF file. * Returns: * DSP_SOK: Success. * DSP_EFAIL: Failed to register object. * Requires: * DCD initialized. * pUuid and szPathName are non-NULL values. * objType is a valid type value. * Ensures: */ extern DSP_STATUS DCD_RegisterObject(IN struct DSP_UUID * pUuid, IN DSP_DCDOBJTYPE objType, IN CHAR * pszPathName); /* * ======== DCD_UnregisterObject ======== * Purpose: * This function de-registers a valid DSP/BIOS Bridge object from the DCD * database. * Parameters: * pUuid: Pointer to a DSP_UUID that identifies a DSP/BIOS Bridge * object. * objType: Type of object. * Returns: * DSP_SOK: Success. * DSP_EFAIL: Unable to de-register the specified object. * Requires: * DCD initialized. * pUuid is a non-NULL value. * objType is a valid type value. * Ensures: */ extern DSP_STATUS DCD_UnregisterObject(IN struct DSP_UUID * pUuid, IN DSP_DCDOBJTYPE objType); #ifdef __cplusplus } #endif #endif /* _DBDCD_H */