csl_dspmmuaux.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 853 行 · 第 1/2 页
H
853 行
/** ============================================================================
* @file csl_dspmmuAux.h
*
* @path $(CSLPATH)\arm\dspmmu\src
*
* @desc API Auxilary header file for DSP MMU CSL.
*
*/
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied.
* ===========================================================================
*/
/* @(#) PSP/CSL 3.00.01.00[5912] (2004-06-22) */
/* =============================================================================
* Revision History
* ===============
* 22-June-2004 anj File Created.
*
* =============================================================================
*/
#ifndef _CSL_DSPMMUAUX_H_
#define _CSL_DSPMMUAUX_H_
/* Inline Functions */
#include<csl_dspmmu.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Masks for extracting the L2 index from the CAM L register */
#define CAM_L_REG_MASK_SECTION 0x0000C000
#define CAM_L_REG_MASK_TINY_PAGE 0x0000FFF0
#define CAM_L_REG_MASK_SMALL_PAGE 0x0000FFC0
#define CAM_L_REG_MASK_LARGE_PAGE 0x0000FC00
/**
* Hardware Control Functions of DSP MMU
*/
/** ===========================================================================
* @n@b CSL_dspmmuEnableWtl
*
* @b Description
* @n This function will enable the walking table logic.
*
* @b Arguments
* @verbatim
hDspmmu Handle to the DSP MMU instance
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Walking table logic is enabled
*
* @b Modifies
* @n Hardware register
*
* @b Example
* @verbatim
CSL_DspmmuHandle hDspmmu;
...
CSL_dspmmuEnableWtl(hDspMmu);
@endverbatim
* ============================================================================
*/
static inline
void CSL_dspmmuEnableWtl (
CSL_DspmmuHandle hDspmmu
)
{
CSL_FINS(hDspmmu->regs->CNTL_REG, DSPMMU_CNTL_REG_WTL_EN, 1);
}
/** ===========================================================================
* @n@b CSL_dspmmuDisableWtl
*
* @b Description
* @n This function will disable the walking table logic.
*
* @b Arguments
* @verbatim
hDspmmu Handle to the DSP MMU instance
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n Translation table must be initalized
*
* <b> Post Condition </b>
* @n Walking table logic is disabled
*
* @b Modifies
* @n Hardware register
*
* @b Example
* @verbatim
CSL_DspmmuHandle hDspmmu;
...
CSL_dspmmuDisableWtl(hDspMmu);
@endverbatim
* ============================================================================
*/
static inline
void CSL_dspmmuDisableWtl (
CSL_DspmmuHandle hDspmmu
)
{
CSL_FINS(hDspmmu->regs->CNTL_REG, DSPMMU_CNTL_REG_WTL_EN, 0);
}
/** ===========================================================================
* @n@b CSL_dspmmuEnableMmu
*
* @b Description
* @n This function enables the DSP MMU.
*
* @b Arguments
* @verbatim
hDspmmu Handle to the DSP MMU instance
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n DSP MMU is enabled
*
* @b Modifies
* @n Hardware register
*
* @b Example
* @verbatim
CSL_DspmmuHandle hDspmmu;
...
CSL_dspmmuEnableMmu (hDspMmu);
@endverbatim
* ============================================================================
*/
static inline
void CSL_dspmmuEnableMmu (
CSL_DspmmuHandle hDspmmu
)
{
CSL_FINS(hDspmmu->regs->CNTL_REG, DSPMMU_CNTL_REG_MMU_EN, 1);
}
/** ===========================================================================
* @n@b CSL_dspmmuDisableMmu
*
* @b Description
* @n This function disables the DSP MMU.
*
* @b Arguments
* @verbatim
hDspmmu Handle to the DSP MMU instance
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n DSP MMU is disabled
*
* @b Modifies
* @n Hardware register
*
* @b Example
* @verbatim
CSL_DspmmuHandle hDspmmu;
...
CSL_dspmmuDisableMmu (hDspMmu);
@endverbatim
* ============================================================================
*/
static inline
void CSL_dspmmuDisableMmu (
CSL_DspmmuHandle hDspmmu
)
{
CSL_FINS(hDspmmu->regs->CNTL_REG, DSPMMU_CNTL_REG_MMU_EN, 0);
}
/** ===========================================================================
* @n@b CSL_dspmmuResetMmu
*
* @b Description
* @n This function resets the DSP MMU.
*
* @b Arguments
* @verbatim
hDspmmu Handle to the DSP MMU instance
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n DSP MMU is reset
*
* @b Modifies
* @n Hardware register
*
* @b Example
* @verbatim
CSL_DspmmuHandle hDspmmu;
...
CSL_dspmmuResetMmu (hDspMmu);
@endverbatim
* ============================================================================
*/
static inline
void CSL_dspmmuResetMmu (
CSL_DspmmuHandle hDspmmu
)
{
CSL_FINS(hDspmmu->regs->CNTL_REG, DSPMMU_CNTL_REG_RESET_SW, 0);
}
/** ===========================================================================
* @n@b CSL_dspmmuResetReleaseMmu
*
* @b Description
* @n This function releases the DSP MMU from reset.
*
* @b Arguments
* @verbatim
hDspmmu Handle to the DSP MMU instance
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n DSP MMU is released from reset
*
* @b Modifies
* @n Hardware register
*
* @b Example
* @verbatim
CSL_DspmmuHandle hDspmmu;
...
CSL_dspmmuResetReleaseMmu (hDspMmu);
@endverbatim
* ============================================================================
*/
static inline
void CSL_dspmmuResetReleaseMmu (
CSL_DspmmuHandle hDspmmu
)
{
CSL_FINS(hDspmmu->regs->CNTL_REG, DSPMMU_CNTL_REG_RESET_SW, 1);
}
/** ===========================================================================
* @n@b CSL_dspmmuAckIntr
*
* @b Description
* @n This function acknowleges the fault interrupt.
*
* @b Arguments
* @verbatim
hDspmmu Handle to the DSP MMU instance
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Fault interrupt is acknowleged
*
* @b Modifies
* @n Hardware register
*
* @b Example
* @verbatim
CSL_DspmmuHandle hDspmmu;
...
CSL_dspmmuAckIntr (hDspMmu);
@endverbatim
* ============================================================================
*/
static inline
void CSL_dspmmuAckIntr (
CSL_DspmmuHandle hDspmmu
)
{
CSL_FINS(hDspmmu->regs->IT_ACK_REG, DSPMMU_IT_ACK_REG_IT_ACK, 1);
}
/** ===========================================================================
* @n@b CSL_dspmmuSetTtb
*
* @b Description
* @n This function sets the translation table base address.
*
* @b Arguments
* @verbatim
hDspmmu Handle to the DSP MMU instance
ttbAddr Transaltion table base address
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n TTB is configured
*
* @b Modifies
* @n Hardware register
*
* @b Example
* @verbatim
CSL_DspmmuHandle hDspmmu;
Uint32 ttbAddr = 0x100000000;
...
CSL_dspmmuSetTtb (hDspMmu, ttbAddr);
@endverbatim
* ============================================================================
*/
static inline
void CSL_dspmmuSetTtb (
CSL_DspmmuHandle hDspmmu,
Uint32 ttbAddr
)
{
Uint32 msbTtbAddr,lsbTtbAddr;
msbTtbAddr = (ttbAddr >> 16) & CSL_DSPMMU_TTB_H_REG_TTB_H_REG_MASK ;
lsbTtbAddr = (ttbAddr & 0xFFFF) >> CSL_DSPMMU_TTB_L_REG_TTB_L_REG_SHIFT ;
CSL_FINS(hDspmmu->regs->TTB_H_REG, DSPMMU_TTB_H_REG_TTB_H_REG, msbTtbAddr);
CSL_FINS(hDspmmu->regs->TTB_L_REG, DSPMMU_TTB_L_REG_TTB_L_REG, lsbTtbAddr);
}
/** ===========================================================================
* @n@b CSL_dspmmuConfigLockBaseVal
*
* @b Description
* @n This function configures the locked TLB range.
*
* @b Arguments
* @verbatim
hDspmmu Handle to the DSP MMU instance
lockTlbRange Locked TLB range
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Locked TLB range is configured
*
* @b Modifies
* @n Hardware register
*
* @b Example
* @verbatim
CSL_DspmmuHandle hDspmmu;
...
CSL_dspmmuConfigLockBaseVal (hDspMmu, 16);
@endverbatim
* ============================================================================
*/
static inline
void CSL_dspmmuConfigLockBaseVal (
CSL_DspmmuHandle hDspmmu,
Uint8 lckTlbRange
)
{
CSL_FINS (hDspmmu->regs->LOCK_REG, DSPMMU_LOCK_REG_BASE_VALUE, lckTlbRange);
}
/** ===========================================================================
* @n@b CSL_dspmmuConfigLockVictim
*
* @b Description
* @n This function configures the next victim value.
*
* @b Arguments
* @verbatim
hDspmmu Handle to the DSP MMU instance
tlbVictim TLB victim
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n None
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?