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

📄 csl_pmxopen.c

📁 TI的DM6446的硬件平台搭建的相关例子
💻 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_pmxOpen.c
 *
 *    @brief    File for functional layer of CSL API @a CSL_pmxOpen()
 *
 *  Path: \\(CSLPATH)\\ipmodules\\pmx\\src
 *
 *  Description
 *    - The @a CSL_pmxOpen() function definition & it's associated functions
 *
 *
 */

/* =============================================================================
 *  Revision History
 *  ===============
 *  18-dec-2004 BRN file created
 *
 * =============================================================================
 */

#include <csl_pmx.h>


/*
 * =============================================================================
 *   @n@b CSL_pmxOpen
 *
 *   @b Description
 *   @n 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 PMX device. The device can be re-opened anytime after it has been
 *        normally closed if so required. PMX 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  pmxObj
 *              Pointer to the PMX object - to be allocated by the
 *                                                     user
 *   @arg  instNum
 *              Instance number of the PMX to be opened
 *
 *   @arg pPmxParam
 *              PMX module specific parameters.
 *   @arg  status
 *              Pointer to CSL Error Status. Possible values for status after
 *              function call returns are:
 *              CSL_SOK            : Open call is successful
 *              CSL_ESYS_FAIL      : Invalid Instance
 *              CSL_ESYS_INVPARAMS : Invalid Parameter
 *
 *   @ret CSL_PmxHandle
 *              Valid handle, if status is CSL_SOK
 *
 *   @eg
 *        CSL_status        status;
 *        CSL_PmxObj        pmxObj;
 *        CSL_PmxHandle     hPmx;
 *
 *          ...
 *
 *          hPmx = CSL_pmxOpen (&pmxtObj, CSL_PMX, NULL, &status);
 *
 *          ...
 *
 * =============================================================================
 */
#pragma CODE_SECTION (CSL_pmxOpen, ".text:csl_section:pmx");
CSL_PmxHandle CSL_pmxOpen (
    CSL_PmxObj              *pPmxObj,
    CSL_InstNum              pmxNum,
    CSL_PmxParam            *pPmxParam,
    CSL_Status              *pStatus
)
{
    CSL_Status            status;
    CSL_PmxHandle         hPmx;
    CSL_PmxBaseAddress    baseAddress;

    if ((pPmxObj == NULL) || (pmxNum < CSL_PMX)) {
        *pStatus = CSL_ESYS_INVPARAMS;
        return NULL;
    }

    /* Added according to review comment 1. */
    if (pStatus == NULL) {
        return NULL;
    }

    *pPmxParam = *pPmxParam; /* To remove compiler warning/remark.*/

    status = CSL_pmxGetBaseAddress(pmxNum, pPmxParam, &baseAddress);

    if (status == CSL_SOK) {
        pPmxObj->regs = baseAddress.regs;
        pPmxObj->perNum = (CSL_InstNum)pmxNum;
        hPmx = (CSL_PmxHandle)pPmxObj;
    }
    else {
        pPmxObj->regs = (CSL_PmxRegsOvly)NULL;
        pPmxObj->perNum = (CSL_InstNum)-1;
        hPmx = (CSL_PmxHandle)NULL;
    }

    if (pStatus) {
        *pStatus = status;
    }

    return hPmx;
}

⌨️ 快捷键说明

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