📄 csl_mcbspopen.c
字号:
/** \file csl_mcbspOpen.c
*
* \brief File for functional layer of CSL API \a CSL_mcbspOpen()
*
* Description
* - The \a CSL_mcbspOpen() function contains definition of the
* functional layer API
*
* Path: \\(CSLPATH)\\ipmodules\\mcbsp\\src
*
*/
/* =============================================================================
* Revision History
* ================
* 15-Feb-2005 NSR Updated function and documentation for CSL_i2cOpen.
* - Removed the include file, csl_resource.h.
*
* =============================================================================
*/
#include <csl_mcbsp.h>
/**
* Reserves the specified MCBSP for use. The device can be re-opened anytime
* after it has been normally closed, if so required.
* The MCBSP handle returned by this call is input as an essential argument for
* the rest of the APIs in MCBSP module.
* If @a hwSetup parameter is non-NULL, it configures MCBSP depending on the
* paramters passed in this structure, after successful open
*
* <b> Usage Constraints: </b>
* The CSL system as well as MCBSP must be succesfully initialized via
* @a CSL_sysInit() and @a CSL_mcbspInit() before calling this function. Memory
* for the @a CSL_McbspObj must be allocated outside this call. This object must
* be retained while using this peripheral instance.
*
* @b Example:
* @verbatim
CSL_McbspHandle hMcbsp;
CSL_McbspObj mcbspObj;
CSL_McbspHwSetup mcbspSetup;
CSL_Status status;
...
hMcbsp = CSL_mcbspOpen(&mcbspObj,
CSL_MCBSP_PER_CNT,
NULL,
&status);
@endverbatim
*
* @return @a CSL_McbspHandle to the requested instance of MCBSP if the
* call is successful, otherwise @a NULL is returned.
*
*/
#pragma CODE_SECTION (CSL_mcbspOpen, ".text:csl_section:mcbsp");
CSL_McbspHandle CSL_mcbspOpen(
/** Pointer to MCBSP object that holds the context.
* Memory for this object should be allocated by the user */
CSL_McbspObj *pMcbspObj,
/** The instance of MCBSP to be opened */
CSL_InstNum mcbspNum,
/** Parameter for McBSP */
CSL_McbspParam *pMcbspParam,
/** Pointer to the variable that holds the status of the open call */
CSL_Status *pStatus
)
{
CSL_Status status;
CSL_McbspHandle hMcbsp;
CSL_McbspBaseAddress baseAddress;
if ((pMcbspObj == NULL) || (mcbspNum < CSL_MCBSP)) {
*pStatus = CSL_ESYS_INVPARAMS;
return NULL;
}
/* Added according to review comment 1. */
if (pStatus == NULL) {
return NULL;
}
*pMcbspParam = *pMcbspParam; /* To remove compiler warning/remark.*/
status = CSL_mcbspGetBaseAddress(mcbspNum, pMcbspParam, &baseAddress);
if (status == CSL_SOK) {
pMcbspObj->regs = baseAddress.regs;
pMcbspObj->perNum = (CSL_InstNum)mcbspNum;
hMcbsp = (CSL_McbspHandle)pMcbspObj;
}
else {
pMcbspObj->regs = (CSL_McbspRegsOvly)NULL;
pMcbspObj->perNum = (CSL_InstNum)-1;
hMcbsp = (CSL_McbspHandle)NULL;
}
if (pStatus) {
*pStatus = status;
}
return hMcbsp;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -