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

📄 csl_tmropen.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_tmrOpen.c * *  @brief File for functional layer of CSL API @a CSL_tmrOpen() * *  Description *    - The @a CSL_tmrOpen() function definition & it's associated *      functions * *  Path: \\(CSLPATH)\\ipmodules\\timer\\src *//* ============================================================================= *  Revision History *  =============== *  1-Sept-2004 HMM File Created. * ============================================================================= */#include <csl_tmr.h>/** ============================================================================ *   @n@b CSL_tmrOpen * *   @b Description *   @n This function populates the peripheral data object for the TMR instance *      and returns a handle to the instance. *      The open call sets up the data structures for the particular instance *      of TMR 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              pTmrObj      Pointer to the TMR instance object              tmrNum       Instance of the TMR to be opened              pTmrParam    Pointer to module specific parameters              pStatus      pointer for returning status of the function call     @endverbatim * *   <b> Return Value </b>  CSL_TmrHandle *   @n                     Valid TMR 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.    The status is returned in the status variable. If status *              returned is *   @li            CSL_SOK             Valid tmr handle is returned *   @li            CSL_ESYS_FAIL       The tmr instance is invalid *   @li            CSL_ESYS_INVPARAMS  Invalid parameter * *        2.    TMR object structure is populated * *   @b Modifies *   @n    1. The status variable * *         2. TMR object structure * *   @b Example *   @verbatim            CSL_status         status;            CSL_TmrObj         tmrObj;            CSL_TmrHandle      hTmr;            ...            hTmr = CSL_tmrOpen (&tmrObj, CSL_TMR_PER_CNT, NULL, &status);    @endverbatim *  ============================================================================ */#pragma CODE_SECTION (CSL_tmrOpen, ".text:csl_section:tmr");CSL_TmrHandle CSL_tmrOpen (    CSL_TmrObj              *pTmrObj,    CSL_InstNum              tmrNum,    CSL_TmrParam            *pTmrParam,    CSL_Status              *pStatus){    CSL_Status            status;    CSL_TmrHandle         hTmr;    CSL_TmrBaseAddress    baseAddress;    if (pStatus == NULL) {        hTmr = (CSL_TmrHandle)NULL;        return hTmr;    }    if (pTmrObj == NULL) {        *pStatus = CSL_ESYS_INVPARAMS;        hTmr = (CSL_TmrHandle)NULL;        return hTmr;    }    status = CSL_tmrGetBaseAddress (tmrNum, pTmrParam, &baseAddress);    if (status == CSL_SOK) {        pTmrObj->regs   = baseAddress.regs;        pTmrObj->perNum = (CSL_InstNum)tmrNum;        hTmr            = (CSL_TmrHandle)pTmrObj;    }    else {        pTmrObj->regs   = (CSL_TmrRegsOvly)NULL;        pTmrObj->perNum = (CSL_InstNum)-1;        hTmr            = (CSL_TmrHandle)NULL;    }    if (pStatus) {        *pStatus = status;    }    return hTmr;}

⌨️ 快捷键说明

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