📄 csl_nandopen.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_nandOpen.c
*
* @brief File for functional layer of CSL API @a CSL_nandOpen()
*
* Description
* - The @a CSL_nandOpen() function definition & it's associated functions
*
* Path: \\(CSLPATH)\\ipmodules\\nfc\\src
*
* Modification 1
* - Created on: 28/06/2004
* - Reason: Created the sources
*
* @date 28th June, 2004
* @author Santosh Narayanan.
*/
/* =============================================================================
* Revision History
* ===============
* 03-sep-2004 Nsr Updated function and documentation for CSL_nandOpen.
* - Removed the include file, csl_resource.h.
*
* =============================================================================
*/
#include <csl_nand.h>
/** ============================================================================
* @n@b CSL_nandOpen
*
* @b Description
* @n This function populates the peripheral data object for the NAND instance
* and returns a handle to the instance.
* The open call sets up the data structures for the particular instance
* of NAND device. The device can be re-opened anytime after it has been
* normally closed if so required. The handle returned by this call is
* input as an essential argument for rest of the APIs described
* for this module.
*
* @b Arguments
* @verbatim
pNandObj Pointer to the NAND instance object
nandNum Instance of the NAND to be opened
pNandParam Pointer to module specific parameters
pStatus pointer for returning status of the function call
@endverbatim
*
* <b> Return Value </b> CSL_NandHandle
* @n Valid NAND instance handle will be returned if status
value is equal to CSL_SOK.
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n 1. NAND object structure is populated
* @n 2. The status is returned in the status variable. If status
* returned is
* @li CSL_SOK Valid nand handle is returned
* @li CSL_ESYS_FAIL The nand instance is invalid
* @li CSL_ESYS_INVPARAMS Invalid parameter
*
* @b Modifies
* @n 1. The status variable
* @n 2. NAND object structure
*
* @b Example
* @verbatim
CSL_status status;
CSL_NandObj nandObj;
CSL_NandHandle hNand;
...
hNand = CSL_nandOpen (&nandObj, CSL_NAND_PER_CNT, NULL, &status);
...
@endverbatim
* =============================================================================
*/
#pragma CODE_SECTION (CSL_nandOpen, ".text:csl_section:nand");
CSL_NandHandle CSL_nandOpen (
CSL_NandObj *pNandObj,
CSL_InstNum nandNum,
CSL_NandParam *pNandParam,
CSL_Status *pStatus
)
{
CSL_Status status;
CSL_NandHandle hNand;
CSL_NandBaseAddress baseAddress;
if (pNandObj == NULL) {
*pStatus = CSL_ESYS_INVPARAMS;
return NULL;
}
status = CSL_nandGetBaseAddress(nandNum, pNandParam, &baseAddress);
if (status == CSL_SOK) {
pNandObj->regs = baseAddress.regs;
pNandObj->perNum = (CSL_InstNum)nandNum;
hNand = (CSL_NandHandle)pNandObj;
}
else {
pNandObj->regs = (CSL_NandRegsOvly)NULL;
pNandObj->perNum = (CSL_InstNum)-1;
hNand = (CSL_NandHandle)NULL;
}
if (pStatus) {
*pStatus = status;
}
return hNand;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -