📄 csl_mmcsdopen.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_mmcsdOpen.c
* Path: \\(CSLPATH)\\ipmodules\\mmcsd\\src
* @brief File for functional layer of CSL API @a CSL_mmcsdOpen()
*
* Description
* - The @a CSL_mmcsdOpen() function definition & it's associated functions
*
* @date 6 May, 2004
* @author Pratheesh Gangadhar
*/
/* =============================================================================
* Revision History
* ===============
* 12-Oct-2004 Hs Added code to validate input argument pStatus
* Renamed 'st' to 'status'
* 31-aug-2004 Hs Updated function and documentation for CSL_mmcsdOpen.
* - Removed the include file, csl_resource.h.
*
* =============================================================================
*/
#include <csl_mmcsd.h>
/*
*============================================================================
* @func CSL_mmcsdOpen
*
* @desc
* This function populates the peripheral data object for the instance
* and returns a handle to the instance.
* The open call sets up the data structures for the particular instance
* of MMCSD device. The device can be re-opened anytime after it has been
* normally closed if so required. MMCSD Hardware setup will be performed
* at the end of the open call only if the HwSetup Pointer supplied was
* non- NULL. The handle returned by this call is input as an essential
* argument for rest of the APIs described for this module.
*
* @arg pMmcsdObj
* Pointer to the MMCSD instance object
*
* @arg mmcsdNum
* Instance of the MMCSD to be opened.
*
* @arg pMmcsdParam
* Pointer to module specific parameters
*
* @arg pStatus
* pointer for returning status of the function call
*
* @ret CSL_MmcsdHandle
* Valid MMCSD instance handle will be returned if status value is
* equal to CSL_SOK.
*
* @eg
* CSL_status status;
* CSL_MmcsdObj mmcsdObj;
* CSL_MmcsdHandle hMmcsd;
*
* hMmcsd = CSL_MmcsdOpen (&mmcsdObj,
* CSL_MMCSD_PER_CNT,
* NULL,
* &status
* );
*
* ===========================================================================
*/
#pragma CODE_SECTION (CSL_mmcsdOpen, ".text:csl_section:mmcsd");
CSL_MmcsdHandle CSL_mmcsdOpen (
CSL_MmcsdObj *pMmcsdObj,
CSL_InstNum mmcsdNum,
CSL_MmcsdParam *pMmcsdParam,
CSL_Status *pStatus
)
{
CSL_Status status;
CSL_MmcsdBaseAddress baseAddress;
CSL_MmcsdHandle hMmcsd = (CSL_MmcsdHandle)NULL;
/* MISTRAL: hs Added following code to validate input parameter pStatus
* according to review comment no. 1
*/
if (pStatus == NULL) {
hMmcsd = (CSL_MmcsdHandle)NULL;
return hMmcsd;
}
if ((pMmcsdObj == NULL) || (mmcsdNum < CSL_MMCSD)) {
*pStatus = CSL_ESYS_INVPARAMS;
return NULL; /* CSL_ESYS_INVPARAMS */
}
status = CSL_mmcsdGetBaseAddress(mmcsdNum, pMmcsdParam, &baseAddress);
if (status == CSL_SOK) {
pMmcsdObj->regs = baseAddress.regs;
pMmcsdObj->perNum = (CSL_InstNum)mmcsdNum;
hMmcsd = (CSL_MmcsdHandle)pMmcsdObj;
}
else {
pMmcsdObj->regs = (CSL_MmcsdRegsOvly)NULL;
pMmcsdObj->perNum = (CSL_InstNum)-1;
hMmcsd = (CSL_MmcsdHandle)NULL;
}
if (pStatus) {
*pStatus = status;
}
return hMmcsd;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -