📄 csl_bwmngmthwsetup.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_bwmngmtHwSetup.c
*
* @brief File for functional layer of CSL API @a CSL_bwmngmtHwSetup()
*
* Description
* - The @a CSL_bwmngmtHwSetup() function definition & it's associated
* functions
*
* PATH: \\(CSLPATH)\\ipmodules\\bwmngmt\\src
*
* @date 3 June, 2004
* @author Chad Courtney
*/
/* =============================================================================
* Revision History
* ===============
* 11-Apr-2005 Brn updated the file for doxygen compatibiliy
* 03-Aug-2005 Brn Butification
* =============================================================================
*/
#include <csl_bwmngmt.h>
/** ============================================================================
* @n@b CSL_bwmngmtHwSetup
*
* @b Description
*
* Configures the BWMNGMT using the values passed in through the
* setup structure.
*
* <b> Usage Constraints: </b>
* Both @a CSL_bwmngmtInit() and @a CSL_bwmngmtOpen() must be called
* successfully in that order before this function can be called. The
* main setup structure consists of fields used for the configuration at
* start up. The user must allocate space for it and fill in the main
* setup structure fields appropriately before a call to this function
* is made. \n
*
* @b Arguments
* @verbatim
hBwmngmt Handle to the BWMNGMT instance
setup Setup structure for BWMNGMT
* @endverbatim
*
* <b> Return Value </b> CSL_Status
* CSL_SOK - Close successful
* CSL_ESYS_BADHANDLE - Invalid handle
* CSL_ESYS_INVPARAMS - IF setup is NULL
*
* The following registers and fields are programmed by this API \n
1. CPU Arbitration Parameters \n
- PRI field set in L1D, L2 and/or EXT \n
- MAXWAIT field set in L1D, L2 and/or EXT \n
2. IDMA Arbitration Parameter \n
- MAXWAIT field set in L1D, L2 and/or EXT \n
3. SLAP Arbitration Parameter \n
- MAXWAIT field set in L1D, L2 and/or EXT \n
4. MAP Arbitration Parameter \n
- PRI field set in EXT \n
5. UC Arbitration Parameter \n
- MAXWAIT field set in L1D and/or L2 \n
The @b control: bitmask indicates which of the three control blocks \n
(L1D, L2 and EXT) will be set with the associated PRI and MAXWAIT values \n
Note: That if associated control block is not programmable for given requestor\n
then it will not ignored but no error will be provide. This allows the user \n
to set control to CSL_BWMNGMT_BLOCK_ALL which is the default value. This will
set \n all programmed arbitration values for a given requestor to the same
value across \n the blocks which is recommended. \n
If PRI is set to CSL_BWMNGMT_PRI_NULL (-1) then no change will be made for the \n
corresponding requestors priority level. \n
If MAXWAIT is set to CSL_BWMNGMT_MAXWAIT_NULL (-1) then no change will be made \n
for the corresponding requestors maxwait setting. \n
* @b Examples:
* @verbatim
Example 1: Sets Priorities and Maxwaits to default values
CSL_BwmngmtHandle hBwmngmt;
CSL_BwmngmtHwSetup hwSetup;
hwSetup = CSL_BWMNGMT_HWSETUP_DEFAULTS;
...
// Init Successfully done
...
// Open Successfully done
...
CSL_bwmngmtHwSetup(hBwmngmt, &hwSetup);
Example 2: Sets CPU Priority to 1, CPU Maxwait to 8, MAP Priority to 6 for all
blocks (L1D, L2 and EXT)
CSL_BwmngmtHandle hBwmngmt;
CSL_BwmngmtHwSetup hwSetup;
hwSetup.cpuPriority = CSL_BWMNGMT_PRI_1;
hwSetup.cpuMaxwait = CSL_BWMNGMT_MAXWAIT_8;
hwSetup.idmaMaxwait = CSL_BWMNGMT_MAXWAIT_NULL;
hwSetup.slapMaxwait = CSL_BWMNGMT_MAXWAIT_NULL;
hwSetup.mapPriority = CSL_BWMNGMT_PRI_6;
hwSetup.ucMaxwait = CSL_BWMNGMT_MAXWAIT_NULL;
hwSetup.control = CSL_BWMNGMT_BLOCK_ALL;
...
// Init Successfully done
...
// Open Successfully done
...
CSL_bwmngmtHwSetup(hBwmngmt, &hwSetup);
@endverbatim
*
* ===========================================================================
*/
#pragma CODE_SECTION (CSL_bwmngmtHwSetup, ".text:csl_section:bwmngmt");
CSL_Status CSL_bwmngmtHwSetup(
/** pointer to the object that holds reference to the
* instance of BWMNGMT requested after the call */
CSL_BwmngmtHandle hBwmngmt,
/** pointer to setup structure which contains the
* information to program BWMNGMT to a useful state */
CSL_BwmngmtHwSetup *setup
)
{
CSL_Status status = CSL_SOK;
Uint32 _tempControl;
if (setup == NULL )
return CSL_ESYS_INVPARAMS;
_tempControl = setup->control;
if (setup->cpuPriority != CSL_BWMNGMT_PRI_NULL) {
if (_tempControl & CSL_BWMNGMT_BLOCK_L1D) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->CPUARBL1D,
BWMNGMT_CPUARBL1D_PRI, setup->cpuPriority);
}
if (_tempControl & CSL_BWMNGMT_BLOCK_L2) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->CPUARBL2,
BWMNGMT_CPUARBL2_PRI, setup->cpuPriority);
}
if (_tempControl & CSL_BWMNGMT_BLOCK_EXT) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->CPUARBEXT,
BWMNGMT_CPUARBEXT_PRI, setup->cpuPriority);
}
}
if (setup->cpuMaxwait != CSL_BWMNGMT_MAXWAIT_NULL) {
if (_tempControl & CSL_BWMNGMT_BLOCK_L1D) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->CPUARBL1D,
BWMNGMT_CPUARBL1D_MAXWAIT, setup->cpuMaxwait);
}
if (_tempControl & CSL_BWMNGMT_BLOCK_L2) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->CPUARBL2,
BWMNGMT_CPUARBL2_MAXWAIT, setup->cpuMaxwait);
}
if (_tempControl & CSL_BWMNGMT_BLOCK_EXT) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->CPUARBEXT,
BWMNGMT_CPUARBEXT_MAXWAIT, setup->cpuMaxwait);
}
}
if (setup->idmaMaxwait != CSL_BWMNGMT_MAXWAIT_NULL) {
if (_tempControl & CSL_BWMNGMT_BLOCK_L1D) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->IDMAARBL1D,
BWMNGMT_IDMAARBL1D_MAXWAIT, setup->idmaMaxwait);
}
if (_tempControl & CSL_BWMNGMT_BLOCK_L2) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->IDMAARBL2,
BWMNGMT_IDMAARBL2_MAXWAIT, setup->idmaMaxwait);
}
if (_tempControl & CSL_BWMNGMT_BLOCK_EXT) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->IDMAARBEXT,
BWMNGMT_IDMAARBEXT_MAXWAIT, setup->idmaMaxwait);
}
}
if (setup->slapMaxwait != CSL_BWMNGMT_MAXWAIT_NULL) {
if (_tempControl & CSL_BWMNGMT_BLOCK_L1D) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->SLAPARBL1D,
BWMNGMT_SLAPARBL1D_MAXWAIT, setup->slapMaxwait);
}
if (_tempControl & CSL_BWMNGMT_BLOCK_L2) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->SLAPARBL2,
BWMNGMT_SLAPARBL2_MAXWAIT, setup->slapMaxwait);
}
if (_tempControl & CSL_BWMNGMT_BLOCK_EXT) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->SLAPARBEXT,
BWMNGMT_SLAPARBEXT_MAXWAIT, setup->slapMaxwait);
}
}
if (setup->mapPriority != CSL_BWMNGMT_PRI_NULL) {
if (_tempControl & CSL_BWMNGMT_BLOCK_EXT) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->MAPARBEXT,
BWMNGMT_MAPARBEXT_PRI, setup->mapPriority);
}
}
if (setup->ucMaxwait != CSL_BWMNGMT_MAXWAIT_NULL) {
if (_tempControl & CSL_BWMNGMT_BLOCK_L1D) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->UCARBL1D,
BWMNGMT_UCARBL1D_MAXWAIT, setup->ucMaxwait);
}
if (_tempControl & CSL_BWMNGMT_BLOCK_L2) {
CSL_FINS(((CSL_BwmngmtRegs*)CSL_BWMNGMT_REGS)->UCARBL2,
BWMNGMT_UCARBL2_MAXWAIT, setup->ucMaxwait);
}
}
return status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -