📄 csl_tmrhwsetupraw.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_tmrHwSetupRaw.c * * @brief File for functional layer of CSL API @a CSL_tmrHwSetupRaw() * * Description * - The @a CSL_tmrHwSetupRaw() 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_tmrHwSetupRaw * * @b Description * @n This function initializes the device registers with the register-values * provided through the Config Data structure. * * @b Arguments * @verbatim hTmr Handle to the TMR instance config Pointer to config structure @endverbatim * * <b> Return Value </b> CSL_Status * @li CSL_SOK - Configuration successful * @li CSL_ESYS_BADHANDLE - Invalid handle * @li CSL_ESYS_INVPARAMS - Configuration is not properly initialized * <b> Pre Condition </b> * @n None * * <b> Post Condition </b> * @n The registers of the specified TMR instance will be setup * according to input configuration structure values. * * @b Modifies * @n Hardware registers of the specified TMR instance. * * @b Example * @verbatim CSL_TmrHandle hTmr; CSL_TmrConfig config = CSL_TMR_CONFIG_DEFAULTS; CSL_Status status; status = CSL_tmrHwSetupRaw (hTmr, &config); @endverbatim * ============================================================================ */#pragma CODE_SECTION (CSL_tmrHwSetupRaw, ".text:csl_section:tmr");CSL_Status CSL_tmrHwSetupRaw ( CSL_TmrHandle hTmr, CSL_TmrConfig *config){ if (hTmr == NULL) { return CSL_ESYS_BADHANDLE; } if (config == NULL) { return CSL_ESYS_INVPARAMS; } /* General purpose timer Emulation Management/Clock Speed Register */ hTmr->regs->EMUMGT_CLKSPD = config->EMUMGT_CLKSPD; /* General purpose timer GPIO Interrupt Control/Enable Register */ hTmr->regs->GPINT_GPEN = config->GPINT_GPEN; /* General purpose timer GPIO Direction/Data Register */ hTmr->regs->GPTDAT_GPDIR = config->GPTDAT_GPDIR; /* General purpose timer Timer Counter Register 12 */ hTmr->regs->TIM12 = config->TIM12; /* General purpose timer Timer Counter Register 34 */ hTmr->regs->TIM34 = config->TIM34; /* General purpose timer Timer Period Register 12 */ hTmr->regs->PRD12 = config->PRD12; /* General purpose timer Timer Period Register 34 */ hTmr->regs->PRD34 = config->PRD34; /* General purpose timer Timer Control Register */ hTmr->regs->TCR = config->TCR; /* General purpose timer Timer Global Control Register */ hTmr->regs->TGCR = config->TGCR; /* General purpose timer General purpose Timer Control Register */ hTmr->regs->WDTCR = config->WDTCR; return CSL_SOK;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -