csl_cache.h

来自「dsp在音频处理中的运用」· C头文件 代码 · 共 515 行 · 第 1/2 页

H
515
字号
 	 *  implementation.
	 */
	CSL_BitMask16   flags;
} CSL_CacheParam;

/** Module specific context information. Present implementation doesn't have
 *  any Context information.
 */

typedef struct {
	/** Context information of CACHE.
     *  The below declaration is just a place-holder for future
 	 *  implementation.
 	 */
    Uint16	contextInfo;
} CSL_CacheContext;


/**
 *   Cache data object Handle
 */
typedef struct CSL_CacheObj *CSL_CacheHandle;

/** Global function declarations */

/*
 * =============================================================================
 *   @func   CSL_cacheInit
 *   @desc
 *      This is CACHE module's initialization function. 
 *      Currently this function is doing nothing.
 *      This needs to be called before using CACHE module.
 *
 *   @arg  pContext 
 *          CACHE specific context information
 *
 *   @ret  CSL_Status
 *          CSL_SOK : Successful, desired operation is done.
 *          CSL_ESYS_BADHANDLE : Handle pass is INVALID.
 *   @eg
 *      status = CSL_cacheInit(NULL);
 *
 * =============================================================================
*/

CSL_Status CSL_cacheInit(
	CSL_CacheContext * pContext
);

/*
 * ============================================================================
 *   @func CSL_cacheOpen
 *
 *   @desc
 *   @n This function returns the handle to the specified CACHE instance.. 
 *
 *   @arg
 *
 *          pCacheObj    Pointer to the object that holds reference to the 
 *			             instance of CACHE requested after the call.
 *
 *          cacheNum     Instance of CACHE to which a handle is requested
 *
 *          pCacheParam  Module specific parameters; currently there are no module
 *			             specificparameters and the user should pass 'NULL'.
 *
 *          pStatus      This returns the status (success/error)  of the call. The
 *			             user may pass NULL', if status information is not required.
 *
 *   @ret  CSL_CacheHandle handle to the CACHE instance
 *   
 *   @eg
 *          CSL_Status status;
 *			CSL_CacheObj cacheObj;
 *          status = CSL_cacheOpen (&cacheObj, CSL_CACHE, NULL, &status);;
 *    
 * =============================================================================
 */

CSL_CacheHandle CSL_cacheOpen (
    CSL_CacheObj*		     pCacheObj,
    CSL_InstNum              cacheNum,
    CSL_CacheParam           *pCacheParam,
    CSL_Status               *pStatus
);

/*
 * ======================================================
 *   @func   CSL_cacheClose
 *   @desc   
 *      Close (Invalidate) cache Module. The CSL for cache
 *      cannot be accessed any more until it is explicitly
 *      opened again
 *
 *   @arg  hCache
 *              Handle to cache
 *   @ret  CSL_Status
 *          CSL_SOK : Successful, desired operation is done.
 *          CSL_ESYS_BADHANDLE : Handle pass is INVALID.
 *   @eg
 *      status = CSL_cacheClose(hCache);
 *
 * ======================================================
*/

CSL_Status  CSL_cacheClose(
    CSL_CacheHandle         hCache
);

/*
 * ======================================================
 *   @func   CSL_cacheHwControl
 *   @desc   Controls the runtime behavior of cache
 *           Usage Constraints:
 *              Cache module should have been opened already 
 *              The application should be in privileged mode.
 *
 *      The following commands are supported:
 *       1) Enable cache
 *       2) Disable cache
 *       3) Invalidate cache(data cache,instruction cache both)
 *       4) Invalidate specific cache line using virtual address or set and way
 *       5) Clean data cache entries
 *       6) Prefetch instructions into instruction cache
 *       7) Test and clean data cache lines
 *       8) Cache way lock down
 *       9) Draining write buffer
 * 
 *       The function will return an error if cannot complete
 *       the request
 *
 *
 *   @arg  hCache
 *              Handle to the instance
 *   @arg  cmd
 *              The operation to be performed.
 *   @arg  cmdArg
 *              This is a void pointer, and will be cast to the 
 *              required type.
 *   @ret  CSL_Status
 *         CSL_SOK : Successful command execution,
 *         CSL_ESYS_BADHANDLE : Invalid handle
 *         CSL_ESYS_INVCMD : Control Command is not supported.
 *
 *   @eg
 *      status = CSL_cacheHwControl(hCache, 
 *                            CSL_CACHE_CMD_ENABLE,
 *                            NULL);
 *
 * ======================================================
*/

CSL_Status  CSL_cacheHwControl(
    CSL_CacheHandle        hCache,
    CSL_CacheHwControlCmd  cmd,
    void                   *cmdArg
);

/*
 * ======================================================
 *   @func   CSL_cacheGetHwStatus
 *   @desc
 *     Reads various parameters of cache
 *
 *       Usage Constraints:
 *       Cache should have been opened before with a valid
 *       handle. 
 *       The application should be in privileged mode.
 *
 *       The following querries are supported:
 *       1) Query Information on cache organization
 *       2) Query the status of instruction cache
 *       3) Query the status of data cache
 *       4) Query the status instruction cache way lockdown
 *       5) Query the status data cache way lockdown
 *
 *       The function will return an error if cannot complete
 *       the request
 *
 *   @arg  hCache
 *              Handle to the Cache module
 *   @arg  query
 *              Identifies the Value to be read
 *   @arg  response
 *              This is a void pointer, and will be cast to 
 *              the required type.
 *   @ret  CSL_Status
 *         CSL_SOK : Successful Retreive, (* response) will have
 *                   the desired value.
 *         CSL_ESYS_BADHANDLE : Invalid handle
 *         CSL_ESYS_INVQUERY : Query Command is not supported.
 *
 *  @eg
 *         status =CSL_cacheGetHwStatus(hCache, 
 *                         CSL_CACHE_QUERY_ICACHE_STATUS,
 *                         &cacheStatus);
 * ======================================================
*/

CSL_Status  CSL_cacheGetHwStatus(
    CSL_CacheHandle           hCache,
    CSL_CacheHwStatusQuery    query,
    void                      *response
);

/** ============================================================================
 *   @n@b CSL_cacheGetBaseAddress
 *
 *   @b Description
 *   @n This function is used for returning the base address of the peripheral
 *      instance. In the case of CACHE since it is not controlled using memory 
 *      mapped registers this function is not doing anything currently.This 
 *      function is open for re-implementing if the user wants to modify
 *      the base address of the peripheral object to point to a different 
 *      location and there by allow CSL initiated write/reads into peripheral
 *      MMR's go to an alternate location.
 *
 *   @b Arguments
 *   @verbatim
            cacheNum        Specifies the instance of the CACHE to be opened 
 
            pCacheParam     Module specific parameters. 
 
            pBaseAddress    Pointer to base address structure containing base 
                            address details.
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK - Query successful
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n   None
 *
 *   @b Modifies
 *   @n   None
 *
 *   @b Example
 *   @verbatim
            status = CSL_cacheGetBaseAddress(CSL_CACHE, NULL, &baseAddress);
     @endverbatim
 * ===========================================================================
 */
CSL_Status CSL_cacheGetBaseAddress(      
        CSL_InstNum               cacheNum,
        CSL_CacheParam            *pCacheParam,
        CSL_CacheBaseAddress      *pBaseAddress
);
                       
#ifdef __cplusplus
}
#endif

#endif  /* _CSL_CACHE_H_ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?