📄 csl_wdtgethwsetup.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_wdtGetHwSetup.c
*
* @brief File for functional layer of CSL API @a CSL_wdtGetHwSetup()
*
* Path: \\(CSLPATH)\\ipmodules\\wdt\\src
*
*/
/* =============================================================================
* Revision History
* ===============
* 11-Oct-2004 Hs updated the code review comments
* 01-Sep-2004 Hmm File created.
* =============================================================================
*/
#include <csl_wdt.h>
/** ============================================================================
* @n@b CSL_wdtGetHwSetup
*
* @b Description
* @n It retrives the hardware setup parameters of the watchdog timer module
* specified by the given handle.
*
* @b Arguments
* @verbatim
hWdt Handle to the watchdog timer
hwSetup Pointer to the harware setup structure
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Retrieving the hardware setup
* parameters is successful
* @li CSL_ESYS_BADHANDLE - The handle is passed is
* invalid
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The hardware setup structure is populated with the hardware setup
* parameters
*
* @b Modifies
* @n hwSetup variable
*
* @b Example
* @verbatim
CSL_WdtHandle hWdt;
CSL_WdtHwSetup hwSetup;
status = CSL_wdtGetHwSetup(hWdt, &hwSetup);
@endverbatim
* ===========================================================================
*/
#pragma CODE_SECTION (CSL_wdtGetHwSetup, ".text:csl_section:wdt");
CSL_Status CSL_wdtGetHwSetup(
CSL_WdtHandle hWdt,
CSL_WdtHwSetup *hwSetup
)
{
if (hWdt == NULL )
return CSL_ESYS_BADHANDLE;
if(hwSetup == NULL) {
return CSL_ESYS_INVPARAMS;
}
/* Get the Timer Period Register 12*/
hwSetup->wdtTimerPeriod12 = hWdt->regs->PRD12;
/* Get the Timer Period Register 34*/
hwSetup->wdtTimerPeriod12 = hWdt->regs->PRD34;
/* Get the timer operating mode */
hwSetup->wdtTcr12Enamode =
(CSL_WdtTcr12Enamode)CSL_FEXT(hWdt->regs->TCR, WDT_TCR_ENAMODE12);
/* Get the Pulse width value */
hwSetup->wdtTcr12PulseWidth =
(CSL_WdtTcr12PulseWidth)CSL_FEXT(hWdt->regs->TCR, WDT_TCR_PWID12);
/* Get the watchdog timer mode */
hwSetup->wdtTimerMode =
(CSL_WdtTmrMode)CSL_FEXT(hWdt->regs->TGCR, WDT_TGCR_TIMMODE);
/* Get TIM34RS_ */
hwSetup->wdtTmr34State =
(CSL_WdtTmr34State)CSL_FEXT(hWdt->regs->TGCR, WDT_TGCR_TIM34RS);
/* Get TIM12RS_ */
hwSetup->wdtTmr12State =
(CSL_WdtTmr12State)CSL_FEXT(hWdt->regs->TGCR, WDT_TGCR_TIM12RS);
/* load the Watchdog flag bit */
hwSetup->wdtFlagBit =
(CSL_WdtFlagBitStatus)CSL_FEXT(hWdt->regs->WDTCR, WDT_WDTCR_WDFLAG);
return CSL_SOK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -