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

📄 csl_wdthwcontrol.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_wdtHwControl.c
 *
 *   @brief  File for functional layer of CSL API @a CSL_wdtHwControl()
 *
 *  Path: \\(CSLPATH)\\ipmodules\\wdt\\src
 *
 */

/* =============================================================================
 *  Revision History
 *  ===============
 *  28-April-2005 HMM Added one control command function to set WDT mode.
 *  14-April-2005 HMM  added control command to load indepedently
 *  11-Oct-2004 Hs  updated the code review comments
 *  01-Sep-2004 Hmm File created.
 * =============================================================================
 */
#include <csl_wdt.h>
#include <csl_wdtAux.h>

/** ============================================================================
 *   @n@b CSL_wdtHwControl
 *
 *   @b Description
 *   @n This function performs various control operations on the watchdog timer,
 *      based on the command passed.
 *
 *   @b Arguments
 *   @verbatim
            hWdt         Handle to the watchdog timer

            cmd          Operation to be performed on the timer

            cmdArg       Arguement specific to the command
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK            - Command execution successful.
 *   @li                    CSL_ESYS_BADHANDLE - Invalid handle
 *   @li                    CSL_ESYS_INVCMD    - Invalid command
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  Watchdog timer registers are configured according to the command and
 *       the command arguements. The command determines which registers are
 *       modified.
 *
 *   @b Modifies
 *   @n Watchdog timer registers determined by the command
 *
 *   @b Example
 *   @verbatim
            Uint32    wdtCount = 0xABCDEF00;
            status = CSL_wdtHwControl(hWdt, CSL_WDT_CMD_LOAD12, &wdtCount);
     @endverbatim
 * =============================================================================
 */
#pragma CODE_SECTION (CSL_wdtHwControl, ".text:csl_section:wdt");
CSL_Status  CSL_wdtHwControl(
    CSL_WdtHandle          hWdt,
    CSL_WdtHwControlCmd    cmd,
    void *                 cmdArg
)
{
    CSL_Status    status = CSL_SOK ;

    if (hWdt == NULL)
        return CSL_ESYS_BADHANDLE;

    switch (cmd) {
        /* Loads the watchdog timer period register 12 */
        case CSL_WDT_CMD_LOAD12:
            CSL_wdtLoad12 (hWdt, (Uint32 *)cmdArg);
            break;
            
        /* Loads the watchdog timer period register 34 */
        case CSL_WDT_CMD_LOAD34:
            CSL_wdtLoad34 (hWdt, (Uint32 *)cmdArg);
            break;

        /* Starts the watchdog timer */
        case CSL_WDT_CMD_START:
            CSL_wdtStart (hWdt);
            break;

        /* set the watchdog timer to idle mode */
        case CSL_WDT_CMD_ALLOWIDLE:
            CSL_wdtAllowIdle(hWdt);
            break;

        /* do not set the watchdog timer to idle mode */
        case CSL_WDT_CMD_DISALLOWIDLE:
            CSL_wdtDisallowIdle(hWdt);
            break;

        /* controls the watchdog active state */
        case CSL_WDT_CMD_LOADKEY:
            CSL_wdtCmdKey(hWdt, *(Uint16*)cmdArg);
            break;

        /* sets the watchdog timer mode */
        case CSL_WDT_CMD_WDT_MODE:
            CSL_wdtSetWdtMode(hWdt, *(CSL_WdtTmrMode*)cmdArg);
            break;
        
        default:
            status = CSL_ESYS_INVCMD;
    }

    return status;
}

⌨️ 快捷键说明

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