📄 csl_memprotgetbaseaddress.c
字号:
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied.
* ===========================================================================
*/
/** @file csl_memprotGetBaseAddress.c
*
* @brief Implementation of @a CSL_memprotGetBaseAddress()
*
* Description
* - The @a CSL_memprotGetBaseAddress() function returns the base-address of
* the specified Memory Protection instance.
*
* Note: 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
* there by allow CSL initiated write/reads into peripheral MMR's go to an
* alternate location. Please refer documentation for more details.
*
* Modification 1
* - Modified on: 7/16/2004
* - Reason: created the sources
*
* @author Ruchika Kharwar.
*/
#include <soc64plus.h>
#include <csl_memprot.h>
/** ============================================================================
* @n@b CSL_memprotGetBaseAddress
*
* @b Description
* @n Function to get the base address of the peripheral instance.
* This function is used for getting the base address of the peripheral
* instance. This function will be called inside the CSL_memprotOpen()
* function call. 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
memprotNum Specifies the instance of the memprot to be opened.
pMemprotParam Module specific parameters.
pBaseAddress Pointer to base address structure containing base
address details.
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_OK Open call is successful
* @li CSL_ESYS_FAIL The instance number is invalid.
* @li CSL_ESYS_INVPARAMS Invalid parameter
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Base address structure is populated
*
* @b Modifies
* @n 1. The status variable
*
* 2. Base address structure is modified.
*
* @b Example
* @verbatim
CSL_Status status;
CSL_MemprotBaseAddress baseAddress;
...
status = CSL_memprotGetBaseAddress(CSL_MEMPROT_L2, NULL, &baseAddress);
@endverbatim
* ===========================================================================
*/
#pragma CODE_SECTION (CSL_memprotGetBaseAddress, ".text:csl_section:memprot");
CSL_Status CSL_memprotGetBaseAddress (
/** Module instance number
*/
CSL_InstNum memprotNum,
/** Module specific parameters.
*/
CSL_MemprotParam * pMemprotParam,
/** Base address details.
*/
CSL_MemprotBaseAddress * pBaseAddress
)
{
CSL_Status st = CSL_SOK;
switch (memprotNum){
case CSL_MEMPROT_L2:
pBaseAddress->regs = (CSL_MemprotRegsOvly)CSL_MEMPROT_L2_REGS;
break;
case CSL_MEMPROT_L1D:
pBaseAddress->regs = (CSL_MemprotRegsOvly)CSL_MEMPROT_L1D_REGS;
break;
case CSL_MEMPROT_L1P:
pBaseAddress->regs = (CSL_MemprotRegsOvly)CSL_MEMPROT_L1P_REGS;
break;
case CSL_MEMPROT_CONFIG:
pBaseAddress->regs = (CSL_MemprotRegsOvly)CSL_MEMPROT_CONFIG_REGS;
break;
default:
pBaseAddress->regs = (CSL_MemprotRegsOvly)NULL;
st = CSL_ESYS_FAIL;
break;
}
return st;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -