📄 csl_mmcsdgethwsetup.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_mmcsdGetHwSetup.c
* Path: \\(CSLPATH)\\ipmodules\\mmcsd\\src
* @brief File for functional layer of CSL API @a CSL_mmcsdGetHwSetup()
*
* Description
* - The @a CSL_mmcsdGetHwSetup() function definition & it's associated
* functions
*
* @date 9 May, 2004
* @author Pratheesh Gangadhar
*/
/* =============================================================================
* Revision History
* ===============
* 12-Oct-2004 Hs Added code to validate input parameters
* Updated according to review comments
* 31-aug-2004 Hs Updated CSL_mmcsdGetHwSetup to call respective functions.
* =============================================================================
*/
#include <csl_mmcsd.h>
/** ============================================================================
* @n@b CSL_mmcsdGetHwSetup
*
* @b Description
* @n It retrives the hardware setup parameters of the mmcsd
* specified by the given handle.
*
* @b Arguments
* @verbatim
hMmcsd Handle to the mmcsd
hwSetup Pointer to the harware setup structure
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Retrieving the hardware setup
* parameters is successful
* @li CSL_ESYS_BADHANDLE - The handle is passed is
* invalid
* @li CSL_ESYS_INVPARAMS - Invalid parameter
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The hardware setup structure is populated with the hardware setup
* parameters
*
* @b Modifies
* @n hwSetup variable
*
* @b Example
* @verbatim
CSL_MmcsdHandle hMmcsd;
CSL_MmcsdHwSetup hwSetup;
...
status = CSL_mmcsdGetHwSetup(hMmcsd, &hwSetup);
...
@endverbatim
* ===========================================================================
*/
#pragma CODE_SECTION (CSL_mmcsdGetHwSetup, ".text:csl_section:mmcsd");
CSL_Status CSL_mmcsdGetHwSetup (
CSL_MmcsdHandle hMmcsd,
CSL_MmcsdHwSetup *setup
)
{
CSL_MmcsdRegsOvly mmcsdRegs = hMmcsd->regs;
Uint32 tempReg;
/* MISTRAL: Hs Added code to validate input parameter hMmcsd
* according to review comment no. 2
*/
if (hMmcsd == NULL) {
return CSL_ESYS_BADHANDLE;
}
if (setup == NULL) {
return CSL_ESYS_INVPARAMS;
}
tempReg = mmcsdRegs->MMCCTL;
setup->writeEndian = (CSL_MmcsdEndian) CSL_FEXT (tempReg,
MMCSD_MMCCTL_PERMDX);
setup->readEndian = (CSL_MmcsdEndian) CSL_FEXT (tempReg,
MMCSD_MMCCTL_PERMDR);
setup->dat3Detect = (CSL_MmcsdDat3EdgeDetect) CSL_FEXT (tempReg,
MMCSD_MMCCTL_DATEG);
setup->busWidth = (CSL_MmcsdBusWidth) CSL_FEXT (tempReg,
MMCSD_MMCCTL_WIDTH);
tempReg = mmcsdRegs->MMCTOR;
setup->responseTimeout = CSL_FEXT (tempReg, MMCSD_MMCTOR_TOR);
setup->dataTimeout = ((CSL_FEXT (tempReg, MMCSD_MMCTOR_TOD_20_16) << 16)
| CSL_FEXT (mmcsdRegs->MMCTOD, MMCSD_MMCTOD_TOD_15_0));
setup->intEnable = mmcsdRegs->MMCIM;
tempReg = mmcsdRegs->MMCCLK;
setup->memClkEnable = (CSL_MmcsdMclkCtl) CSL_FEXT (tempReg,
MMCSD_MMCCLK_CLKEN);
setup->clockPinRate = CSL_FEXT (tempReg, MMCSD_MMCCLK_CLKRT);
return CSL_SOK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -