csl_msopen.c

来自「TI达芬奇dm644x各硬件模块测试代码」· C语言 代码 · 共 112 行

C
112
字号
/*  ============================================================================ *   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_msOpen.c * *  @brief    File for functional layer of CSL API @a CSL_msOpen() * *  Path: \\(CSLPATH)\\ipmodules\\memstick\\src * *  Description *    - The @a CSL_msOpen() function definition & it's associated functions * *  Date 3 June, 2004 *  Author Santosh Narayanan *//* ============================================================================= *  Revision History *  ================ *  14-Dec-2004 kpn Updated function and documentation for CSL_msOpen *                  according to CSL upgradation guidelines. * ============================================================================= */#include <csl_ms.h>/** ============================================================================ *   @n@b CSL_msOpen * *   @b Description *   @n This function populates the peripheral data object for the MS instance *      and returns a handle to the instance. *      The open call sets up the data structures for the particular instance *      of MS 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         pMsObj      Pointer to the MS instance object         msNum       Instance of the MS to be opened         pMsParam    Pointer to module specific parameters         pStatus     Pointer for returning status of the function call     @endverbatim * *   <b> Return Value </b>  CSL_MsHandle *   @li                    hMs  - Valid MS instance handle *   @li                    NULL - Returned in case of invalid operation * *   @b Example *   @verbatim          CSL_status         status;          CSL_MsObj          msObj;          CSL_MsHandle       hMs;          ...          hMs = CSL_msOpen (&msObj, CSL_MS_PER_CNT, NULL, &status);     @endverbatim * ============================================================================= */#pragma CODE_SECTION (CSL_msOpen, ".text:csl_section:ms");CSL_MsHandle CSL_msOpen (    CSL_MsObj             *pMsObj,    CSL_InstNum            msNum,    CSL_MsParam           *pMsParam,    CSL_Status            *pStatus){    CSL_Status          status;    CSL_MsHandle        hMs;    CSL_MsBaseAddress   baseAddress;    if (pStatus == NULL) {	    hMs = (CSL_MsHandle)NULL;	    return hMs;    }    if (pMsObj == NULL) {        *pStatus = CSL_ESYS_INVPARAMS;        hMs = (CSL_MsHandle)NULL;        return hMs;    }    status = CSL_msGetBaseAddress(msNum, pMsParam, &baseAddress);    if (status == CSL_SOK) {        pMsObj->regs  = baseAddress.regs;        pMsObj->msNum = (CSL_InstNum)msNum;        hMs           = (CSL_MsHandle)pMsObj;    }    else {        pMsObj->regs  = (CSL_MsRegsOvly)NULL;        pMsObj->msNum = (CSL_InstNum)-1;        hMs           = (CSL_MsHandle)NULL;    }    if (pStatus)        *pStatus = status;    return hMs;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?