csl_cacheaux.h

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

H
913
字号
 *   @b Arguments
 *   @verbatim
            Invalidate	This should be set to true if the dirty entry needs 
                        to be invalidated
     @endverbatim
 *   <b> Return Value </b>  Bool
 *   @li			    TRUE  - if dirty entry was found
 *   @li		          FALSE - otherwise

 *   <b> Pre Condition </b>
 *   @n  Should be in privileged mode
 *
 *   <b> Post Condition </b>
 *   @n  The first dirty entry in data cache is cleaned. It is also 
 *       invalidated if specified  
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
            Bool dirtyEntryFound;
            dirtyEntryFound = CSL_cacheTestDCache (TRUE);
     @endverbatim
 * ===========================================================================
 */

extern Bool CSL_cacheTestDCache (
    Bool invalidate
);

/** ============================================================================
 *   @n@b CSL_cacheCleanAndInvDCacheEntryMVA            
 *
 *   @b Description
 *   @n This routine cleans and invalidates the data cache line specified
 *
 *   @b Arguments
 *   @verbatim
            virtAddress	Modified virtual address of the entry to be cleaned and
            invalidated
     @endverbatim
 *     
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  Should be in privileged mode
 *
 *   <b> Post Condition </b>
 *   @n  The memory is updated from the specified data cache entry and the entry 
 *       is invalidated
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
 		CSL_cacheCleanAndInvDCacheEntryMVA (0x20000000);
     @endverbatim
 * ===========================================================================
 */

extern void CSL_cacheCleanAndInvDCacheEntryMVA (
    Uint32    virtAddress
);

/** ============================================================================
 *   @n@b CSL_cacheCleanAndInvDCacheEntrySetWay             
 *
 *   @b Description
 *   @n This routine cleans and invalidates the data cache line specified
 *
 *   @b Arguments
 *   @verbatim
             way	Specifies the cache way. Value should be in the range 0 to 3 
             set	Specifies the set way. Value should be in the range 0 to 63
      @endverbatim
 *      
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  Should be in privileged mode
 *
 *   <b> Post Condition </b>
 *   @n  The memory is updated from the specified data cache entry and the entry
 *        is invalidated
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
 		CSL_cacheCleanAndInvDCacheEntrySetWay (2, 50);
     @endverbatim
 * ===========================================================================
 */

extern void CSL_cacheCleanAndInvDCacheEntrySetWay (
    Uint16 way,
    Uint16 set
);

/** ============================================================================
 *   @n@b CSL_cacheLockCacheWay             
 *
 *   @b Description
 *   @n This routine gets the status bits corresponding to all the
 *      cache ways of the specified cache type     
 *
 *   @b Arguments
 *   @verbatim
             type    CSL_CACHE_TYPE_INSTR  - To lock instruction cache way
                     CSL_CACHE_TYPE_DATA   - To lock data cache way
             way     cache way to be locked

      @endverbatim
 *      
 *   <b> Return Value </b>  None 
 *
 *   <b> Pre Condition </b>
 *   @n  Should be in privileged mode
 *
 *   <b> Post Condition </b>
 *   @n  The specified cache way is locked
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
 		CSL_cacheLockCacheWay (CSL_CACHE_TYPE_INSTR, 3);
     @endverbatim
 * ===========================================================================
 */

extern void CSL_cacheLockCacheWay (
    CSL_CacheType  type,
    Uint16 way
);

/** ============================================================================
 *   @n@b CSL_cacheUnlockCacheWay             
 *
 *   @b Description
 *   @n This routine gets the status bits corresponding to all the
 *      cache ways of the specified cache type     
 *
 *   @b Arguments
 *   @verbatim
             type   CSL_CACHE_TYPE_INSTR  - To unlock instruction cache way
                    CSL_CACHE_TYPE_DATA   - To unlock data cache way
             way    cache way to be locked

      @endverbatim
 *      
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  Should be in privileged mode
 *
 *   <b> Post Condition </b>
 *   @n  The specified cache way is unlocked
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
 		CSL_cacheUnlockCacheWay (CSL_CACHE_TYPE_INSTR, 3);
     @endverbatim
 * ===========================================================================
 */

extern void CSL_cacheUnlockCacheWay(
    CSL_CacheType  type, 
    Uint16         way
);

/** ============================================================================
 *   @n@b CSL_cacheGetCacheWayStatus             
 *
 *   @b Description
 *   @n This routine gets the status bits corresponding to all the
 *      cache ways of the specified cache type     
 *      
 *   @b Arguments
 *   @verbatim
             type 	CSL_CACHE_TYPE_INSTR - To lock instruction cache way
                  	CSL_CACHE_TYPE_DATA  - To lock data cache way
     @endverbatim
 *     
 *   <b> Return Value </b>  Bool
 *   @li		        	TRUE  - if the cache way is locked
 *   @li			      FALSE - if the cache way is not locked
 *
 *   <b> Pre Condition </b>
 *   @n  Should be in privileged mode
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
            Bool lockStatus;	
            lockStatus = CSL_cacheGetCacheWayStatus(CSL_CACHE_TYPE_INSTR);
     @endverbatim
 * ===========================================================================
 */

extern Uint32 CSL_cacheGetCacheWayStatus(
    CSL_CacheType  type
);

/** ============================================================================
 *   @n@b CSL_cacheDrainWriteBuffer              
 *
 *   @b Description
 *   @n This routine drains the write buffers  and if specified enters
 *      low power mode waiting for interrupt   
 *
 *   @b Arguments
 *   @verbatim
             waitForInt	 TRUE  - write buffers will be drained and processor
                                 is put in low power mode till an interrupt 
                                 occurs. 
                         FALSE - only Draining of the write buffer will 
                                 be performed
     @endverbatim
 *      
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  Should be in privileged mode
 *
 *   <b> Post Condition </b>
 *   @n  Write buffers are drained
 *       Enters low power mode, if specified
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
 		CSL_cacheDrainWriteBuffer(TRUE);
     @endverbatim
 * ===========================================================================
 */

extern void  CSL_cacheDrainWriteBuffer(
    Bool  waitForInt
);

/** ============================================================================
 *   @n@b CSL_cacheInvLineAddr    
 *
 *   @b Description
 *   @n This routine is used for invalidating specific entry in cache 
 *      identified using virtual address
 *
 *   @b Arguments
 *   @verbatim
            arg         pointer to structure used to pass virtual address
                        for invalidating cache command
     @endverbatim
 *     
 *   <b> Return Value </b>  status
 *
 *   <b> Pre Condition </b>
 *   @n  Should be in privileged mode
 *
 *   <b> Post Condition </b>
 *   @n  The specified entry is invalidated 
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
 		CSL_cacheInvLineAddr(arg);
     @endverbatim
 * ===========================================================================
 */
static inline
CSL_Status  CSL_cacheInvLineAddr(
   CSL_CacheLineInvAddr *arg
)
{
	CSL_Status   status = CSL_SOK;
	if (arg->type == CSL_CACHE_INSTR)
    {
        CSL_cacheInvICacheEntryMVA (arg->virtAddress);
    }
    else
    {
        if (arg->type == CSL_CACHE_DATA)
        {
            CSL_cacheInvDCacheEntryMVA (arg->virtAddress);
        }
        else
            status = CSL_ESYS_INVCMD;
    }
    return status;
       
}  

/** ============================================================================
 *   @n@b CSL_cacheInvLineSetway      
 *
 *   @b Description
 *   @n This routine is for invalidating specific entry in cache identified 
 *      set and way 
 *
 *   @b Arguments
 *   @verbatim
            arg  pointer to structure used to pass set and way for 
                 invalidating cache
     @endverbatim
 *    
 *   <b> Return Value </b>  status
 *
 *   <b> Pre Condition </b>
 *   @n  Should be in privileged mode
 *
 *   <b> Post Condition </b>
 *   @n  the specified entry  is invalidated
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
 		CSL_cacheInvLineSetway(arg);
     @endverbatim
 * ===========================================================================
 */
static inline
CSL_Status CSL_cacheInvLineSetway (
    CSL_CacheLineInvSetWay *arg
)
{
    CSL_Status status = CSL_SOK;
    if (arg->type == CSL_CACHE_INSTR)
    {
        CSL_cacheInvICacheEntrySetWay (arg->set,arg->way);
    }
    else
    {
        if (arg->type == CSL_CACHE_DATA)
        {

            CSL_cacheInvDCacheEntrySetWay(arg->set, arg->way);
        }
        else
            status = CSL_ESYS_INVPARAMS;
    }
    return status;
                           
}

/** ============================================================================
 *   @n@b CSL_cacheCleanLineAddr        
 *
 *   @b Description
 *   @n This routine is used for cleaning an entry identified using set and way
 *
 *   @b Arguments
 *   @verbatim
            arg  pointer to the structure used to pass virtual address 
                 for cleaning data cache entry
     @endverbatim
 *     
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  Should be in privileged mode
 *
 *   <b> Post Condition </b>
 *   @n  The memory is updated/updated and inavalidated from the specified 
 *        data cache entry 
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
 		CSL_cacheCleanLineAddr (arg);
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_cacheCleanLineAddr(
    CSL_CacheLineCleanAddr *arg
)
{
    if (arg->invalidate == FALSE)
        {
            CSL_cacheCleanDCacheEntryMVA(arg->virtAddress);
        }
        else
        {
            CSL_cacheCleanAndInvDCacheEntryMVA(arg->virtAddress);
        }
}            
            
/** ============================================================================
 *   @n@b CSL_cacheCleanLineSetway         
 *
 *   @b Description
 *   @n This routine is used for clean and invalidate operation
 *
 *   @b Arguments
 *   @verbatim
            arg   pointer to structure used to pass set and way 
                  for cleaning data cache entry
     @endverbatim
 *     
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  Should be in privileged mode
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
 		CSL_cacheCleanLineSetway(arg);
     @endverbatim
 * ===========================================================================
 */
static inline        
void CSL_cacheCleanLineSetway(
    CSL_CacheLineCleanSetWay *arg
)
{        
    if (arg->invalidate == FALSE)
    {
        CSL_cacheCleanDCacheEntrySetWay  (arg->set, arg->way);
    }
    else
    {
       CSL_cacheCleanAndInvDCacheEntrySetWay(arg->set, arg->way);
    }

}  
        
#endif /*CSL_CACHEAUX_H_*/


⌨️ 快捷键说明

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