⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csl_emifopen.c

📁 TI达芬奇dm644x各硬件模块测试代码
💻 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_emifOpen.c
 *  
 *  @brief    File for functional layer of CSL API @a CSL_emifOpen()
 *
 *    Path: \\(CSLPATH)\\ipmodules\\emifs\\src
 *
 *  Description
 *    - The @a CSL_emifOpen() function definition & it's associated functions
 *
 *  Modification 1
 *    - Created on: 10/06/2004
 *    - Reason:       Created the sources
 *
 *  @date 10th June, 2004
 *  @author Santosh Narayanan.
 *
 */
 
/* =============================================================================
 *  Revision History
 *  ===============
 *  02-Sept-2004 brn      Updated for the new CSL architecture
 *  11-Oct-2004  brn      Updated with the code review comments. Changed the  
 *                        status arameter to "status" from "st"
 * =============================================================================
 */
 
#include <csl_emif.h>

/** =============================================================================
 *   @n@b   CSL_emifOpen
 *
 *   @b Description
 *   @n This function returns the handle to the EMIF instance. This
 *      handle is passed to all other CSL APIs.
 *
 *   @b Arguments
 *   @verbatim

            hEmif            Handle to EMIF instance

            pEmifObj         Pointer to the EMIF instance object

            emifNum          Instance of the EMIF to be opened.

            pEmifParam       Pointer to module specific parameters

            pStatus         pointer for returning status of the function call

     @endverbatim
 *
 *   <b> Return Value </b>
 *      CSL_EmifHandle
 *        Valid EMIF instance handle will be returned if status value is
 *        equal to CSL_SOK.
 *
 *   <b> Pre Condition </b>
 *   @n  @a CSL_emifInit() must be called successfully.
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b  Modifies
 *   @n  None
 *
 *   @b Example:
 *   @verbatim
         CSL_status        status;
         CSL_EmifObj        emifObj;
         CSL_EmifHandle     hEmif;

         hI2c = CSL_EmifOpen (&emifObj,
                             CSL_EMIF,
                             NULL,
                             &status
                             );
     @endverbatim
 *
 * ===========================================================================
 */
#pragma CODE_SECTION (CSL_emifOpen, ".text:csl_section:emif");
CSL_EmifHandle CSL_emifOpen (
    /** Pointer to the object that holds reference to the
     *  instance of EMIF requested after the call 
     */
    CSL_EmifObj              *pEmifObj,
    /** Instance of EMIF to which a handle is requested 
     */
    CSL_InstNum              emifNum,
    /** The module specific parameters
     */
    CSL_EmifParam            *pEmifParam,
    /** This returns the status (success/errors) of the call 
     */
    CSL_Status               *pStatus
)
{
    /* Mistral: Brn Changed the variable name from st to status 
     * according to the code review comments
     */
    CSL_Status            status;
    CSL_EmifHandle        hEmif;
    CSL_EmifBaseAddress   baseAddress;
    
    /* Added the code with the review comments */
    *pEmifParam          = *pEmifParam;
    
    if (pEmifObj == NULL)
        return NULL;
        
    status = CSL_emifGetBaseAddress(emifNum, pEmifParam, &baseAddress);

    if (status == CSL_SOK) {
        pEmifObj->regs = baseAddress.regs;
        pEmifObj->perNum = (CSL_InstNum)emifNum;
        hEmif = (CSL_EmifHandle)pEmifObj;
    } 
    else {
        pEmifObj->regs = (CSL_EmifRegsOvly)NULL;
        pEmifObj->perNum = (CSL_InstNum)-1;
        hEmif = (CSL_EmifHandle)NULL;
    }

    if (pStatus != NULL) {
        *pStatus = status;
    }
    
    return hEmif;
}

⌨️ 快捷键说明

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