csl_tmrgetbaseaddress.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_tmrGetBaseAddress.c * *  @brief File for functional layer of CSL API @a CSL_tmrGetBaseAddress() * *  Path: \\(CSLPATH)\\soc\\davinci\\arm9\\src * *//* ============================================================================= *  Revision History *  =============== *  1-Sept-2004 HMM File Created. * ============================================================================= */#include <soc.h>#include <csl_tmr.h>/* ============================================================================ *   @n@b CSL_tmrGetBaseAddress * *   @b Description *   @n  This function gets the base address of the given GP timer *       instance. * *   @b Arguments *   @verbatim            hTmr            Pointer to the peripheral data object of the                            GP timer instance            tmrNum          Specifies the instance of the GP timer for                            which the base address is requested            pTmrParam       Module specific parameters.            pBaseAddress    Pointer to the base address structure to return the                            base address details.     @endverbatim * *   <b> Return Value </b>  CSL_Status *   @li                    CSL_OK              Open call is successful *   @li                    CSL_ESYS_FAIL       The instance number is invalid. *   @li                    CSL_ESYS_INVPARAMS  Invalid parameter * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *   @n  Base address structure is populated * *   @b Modifies *   @n    1. The status variable * *         2. Base address structure. * *   @b Example *   @verbatim        CSL_Status          status;        CSL_TmrBaseAddress  baseAddress;       ...      status = CSL_tmrGetBaseAddress(CSL_TMR_1, NULL, &baseAddress);    @endverbatim * =========================================================================== */#pragma CODE_SECTION (CSL_tmrGetBaseAddress, ".text:csl_section:tmr");CSL_Status CSL_tmrGetBaseAddress (    CSL_InstNum                     tmrNum,    CSL_TmrParam                   *pTmrParam,    CSL_TmrBaseAddress             *pBaseAddress){    CSL_Status status = CSL_SOK;    pTmrParam = pTmrParam;    if (pBaseAddress == NULL) {        return CSL_ESYS_INVPARAMS;    }    switch (tmrNum) {        case CSL_TMR_1:            pBaseAddress->regs = (CSL_TmrRegsOvly)CSL_TMR_1_REGS;            break;        case CSL_TMR_2:            pBaseAddress->regs = (CSL_TmrRegsOvly)CSL_TMR_2_REGS;            break;        case CSL_TMR_3:            pBaseAddress->regs = (CSL_TmrRegsOvly)CSL_TMR_3_REGS;            break;        case CSL_TMR_4:            pBaseAddress->regs = (CSL_TmrRegsOvly)CSL_TMR_4_REGS;            break;        default:            pBaseAddress->regs = (CSL_TmrRegsOvly)NULL;            status             = CSL_ESYS_FAIL;            break;    }    return status;}

⌨️ 快捷键说明

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