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

📄 csl_tmrhwcontrol.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_tmrHwControl.c * *  @brief    File for functional layer of CSL API @a CSL_tmrHwControl() * *  Description *    - The @a CSL_tmrHwControl() function definition & it's associated *      functions * *  Path: \\(CSLPATH)\\ipmodules\\timer\\src *//* ============================================================================= *  Revision History *  =============== *  1-Sept-2004 HMM File Created. * ============================================================================= */#include <csl_tmr.h>#include <csl_tmrAux.h>/** ============================================================================ *   @n@b CSL_tmrHwControl * *   @b Description *   @n Takes a command of TMR with an optional argument & implements it. * *   @b Arguments *   @verbatim            hTmr            Handle to the TMR instance            cmd             The command to this API indicates the action to be                            taken on TMR.            arg             An optional argument.     @endverbatim * *   <b> Return Value </b>  CSL_Status *   @li                    CSL_SOK             - Status info return successful. *   @li                    CSL_ESYS_BADHANDLE  - Invalid handle *   @li                    CSL_ESYS_INVCMD     - Invalid command *   @li                    CSL_ESYS_FAIL       - Invalid instance number * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *   @n  None * *   @b Modifies *   @n The hardware registers of TMR. * *   @b Example *   @verbatim         CSL_TmrCount    tmrCount = 0xABCD;         status = CSL_tmrHwControl(hTmr, CSL_TIMER_CMD_LOAD, &tmrCount);     @endverbatim *  ============================================================================ */#pragma CODE_SECTION (CSL_tmrHwControl, ".text:csl_section:tmr");CSL_Status CSL_tmrHwControl (    CSL_TmrHandle              hTmr,    CSL_TmrHwControlCmd        cmd,    void                      *arg){    CSL_Status status = CSL_SOK ;    if (hTmr == NULL) {        return CSL_ESYS_BADHANDLE;    }    switch (cmd) {        /* Load PRD12 */        case CSL_TMR_CMD_LOAD_PRD12:            CSL_TmrLoadPrd12 (hTmr, (Uint32 *)arg);            break;        /* Load PRD34 */        case CSL_TMR_CMD_LOAD_PRD34:            CSL_TmrLoadPrd34 (hTmr, (Uint32 *)arg);            break;        /* Load PSC34 */        case CSL_TMR_CMD_LOAD_PRESCALAR34:            CSL_TmrLoadPrescalar34 (hTmr, (Uint8 *)arg);            break;        /* start the timer12 */        case CSL_TMR_CMD_START12:            CSL_TmrStart12 (hTmr, *((CSL_TmrEnamode *)arg) );            break;        /* start the timer12 */        case CSL_TMR_CMD_START34:            CSL_TmrStart34 (hTmr, *((CSL_TmrEnamode *)arg) );            break;        /* Stop the Timer12 */        case CSL_TMR_CMD_STOP12:            CSL_TmrStop12 (hTmr);            break;        /* Stop the Timer34 */        case CSL_TMR_CMD_STOP34:            CSL_TmrStop34 (hTmr);            break;        /* Reset the Timer12 */        case CSL_TMR_CMD_RESET12:            CSL_TmrReset12 (hTmr);            break;        /* Reset the Timer34 */        case CSL_TMR_CMD_RESET34:            CSL_TmrReset34 (hTmr);            break;        /* Set the data for TINP12 pin */        case CSL_TMR_CMD_SET_GPIO_DATA_TINP12:            CSL_tmrSetTinp12Data (hTmr, *((Bool *)arg) );            break;        /* Set the data for TOUTP12 pin */        case CSL_TMR_CMD_SET_GPIO_DATA_TOUTP12:            CSL_tmrSetToutp12Data (hTmr, *((Bool *)arg) );            break;        /* Set the data for TINP34 pin */        case CSL_TMR_CMD_SET_GPIO_DATA_TINP34:            CSL_tmrSetTinp34Data (hTmr, *((Bool *)arg) );            break;        /* Set the data for TOUTP34 pin */        case CSL_TMR_CMD_SET_GPIO_DATA_TOUTP34:            CSL_tmrSetToutp34Data (hTmr, *((Bool *)arg) );            break;        /* Set the data direction TINP12 pin */        case CSL_TMR_CMD_CONFIG_GPIO_DIR_TINP12:            CSL_tmrConfigTinp12Dir (hTmr, *((Bool *)arg) );            break;        /* Set the data direction TINP34 pin */        case CSL_TMR_CMD_CONFIG_GPIO_DIR_TINP34:            CSL_tmrConfigTinp34Dir (hTmr, *((Bool *)arg) );            break;        /* Set the data direction TOUTP12 pin */        case CSL_TMR_CMD_CONFIG_GPIO_DIR_TOUTP12:            CSL_tmrConfigToutp12Dir (hTmr, *((Bool *)arg) );            break;        /* Set the data direction TOUTP34 pin */        case CSL_TMR_CMD_CONFIG_GPIO_DIR_TOUTP34:            CSL_tmrConfigToutp34Dir (hTmr, *((Bool *)arg) );            break;        /* Start the timer in GPtimer64 OR Chained mode */        case CSL_TMR_CMD_START64:            CSL_TmrStart64 (hTmr, *((CSL_TmrEnamode *)arg) );            break;        /* Stop the timer of GPtimer64 OR Chained */        case CSL_TMR_CMD_STOP64:            CSL_TmrStop64 (hTmr);            break;        /* Reset the timer of GPtimer64 OR Chained */        case CSL_TMR_CMD_RESET64:            CSL_TmrReset64 (hTmr);            break;        default:            status = CSL_ESYS_INVCMD;    }    return status;}

⌨️ 快捷键说明

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