📄 csl_wdthwsetupraw.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_wdtHwSetupRaw.c
*
* @brief File for functional layer of CSL API @a CSL_wdtHwSetupRaw()
*
* Path: \\(CSLPATH)\\ipmodules\\wdt\\src
*
*/
/* =============================================================================
* Revision History
* ===============
* 01-Sep-2004 Hmm File created.
* =============================================================================
*/
#include <csl_wdt.h>
#include <csl_wdtAux.h>
/** ============================================================================
* @n@b CSL_wdtHwSetupRaw
*
* @b Description
* @n This function initializes the device registers with the register-values
* provided through the config data structure.
*
* @b Arguments
* @verbatim
hWdt Handle to the watchdog timer instance
config Pointer to the config structure containing the
device register values
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Configuration successful
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_INVPARAMS - Configuration structure
* pointer is not properly
* initialized
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The registers of the specified watchdog timer instance will be setup
* according to the values passed through the config structure
*
* @b Modifies
* @n Hardware registers of the specified watchdog timer instance
*
* @b Example
* @verbatim
CSL_WdtHandle hWdt;
CSL_WdtConfig config = CSL_WDT_CONFIG_DEFAULTS;
CSL_Status status;
status = CSL_wdtHwSetupRaw (hWdt, &config);
@endverbatim
* ===========================================================================
*/
#pragma CODE_SECTION (CSL_wdtHwSetupRaw, ".text:csl_section:wdt");
CSL_Status CSL_wdtHwSetupRaw (
CSL_WdtHandle hWdt,
CSL_WdtConfig *config
)
{
if (hWdt == NULL)
return CSL_ESYS_BADHANDLE;
if (config == NULL )
return CSL_ESYS_INVPARAMS;
/** Watchdog timer Emulation Management/Clock Speed Register */
hWdt->regs->EMUMGT_CLKSPD = config->EMUMGT_CLKSPD;
/** Watchdog timer GPIO Interrupt Control/Enable Register */
hWdt->regs->GPINT_GPEN = config->GPINT_GPEN;
/** Watchdog timer GPIO Direction/Data Register */
hWdt->regs->GPTDAT_GPDIR = config->GPTDAT_GPDIR;
/** Watchdog timer Timer Counter Register 12 */
hWdt->regs->TIM12 = config->TIM12;
/** Watchdog timer Timer Counter Register 34 */
hWdt->regs->TIM34 = config->TIM34;
/** Watchdog timer Timer Period Register 12 */
hWdt->regs->PRD12 = config->PRD12;
/** Watchdog timer Timer Period Register 34 */
hWdt->regs->PRD34 = config->PRD34;
/** Watchdog timer Timer Control Register */
hWdt->regs->TCR = config->TCR;
/** Watchdog timer Timer Global Control Register */
hWdt->regs->TGCR = config->TGCR;
/** Watchdog timer Watchdog Timer Control Register */
hWdt->regs->WDTCR = config->WDTCR;
return CSL_SOK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -