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

📄 csl_wdtaux.h

📁 dsp在音频处理中的运用
💻 H
字号:
/** ============================================================================
 *   @file  csl_wdtAux.h
 *
 *   @path  $(CSLPATH)\dsp\wdt\inc
 *
 *   @desc  API header file for the watchdog timer CSL
 */
 
/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004
 *
 *   Use of this software is controlled by the terms and conditions found in the
 *   license agreement under which this software has been supplied.
 *   ===========================================================================
 */
 
/*  @(#) PSP/CSL 3.00.01.00[5912] (2004-05-15)  */

/* =============================================================================
 *  Revision History
 *  ===============
 *  29-Jun-2004 ka File Created.
 *  28-Jun-2004 ka Changes for new CSL architecture
 *
 * =============================================================================
 */
#ifndef _CSL_WDTAUX_H_
#define _CSL_WDTAUX_H_

#include <csl_wdt.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 *	Status query functions of the watchdog timer
 */

/** ============================================================================
 *   @n@b CSL_wdtGetCount
 *
 *   @b Description
 *   @n Gets the current count value from the watchdog timer read register
 *
 *   @b Arguments
 *   @verbatim
        hWdt     	    Handle to the watchdog timer instance
 *   @endverbatim
 *
 *   <b> Return Value </b>  Uint16
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Returns current value of the watchdog timer read register
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_WdtHandle     hWdt;
        Uint16            count;
      
        ...
        count = CSL_wdtGetCount (hWdt);
        ...
     @endverbatim
 * ===========================================================================
 */
 
static inline
Uint16 CSL_wdtGetCount (
	CSL_WdtHandle hWdt
)
{
    Uint16  count = 0;

    /* Read the current count value from the MPU_READ_TIMER register */
    count = (Uint16)hWdt->regs->LOADREAD;

    return count;
}

/** ============================================================================
 *   @n@b CSL_wdtGetStStat
 *
 *   @b Description
 *      In general purpose mode, this API returns the status about whether the
 *      watchdog timer is running or stopped 
 *
 *   @b Arguments
 *   @verbatim
        hWdt     	    Handle to the watchdog timer instance
 *   @endverbatim
 *
 *   <b> Return Value </b>  CSL_WdtStStat
                               CSL_WDT_CNTL_ST_RESET - Watchdog timer is stopped
                               CSL_WDT_CNTL_ST_SET   - Watchdog timer is running
 *
 *   <b> Pre Condition </b>
 *   @n  Watchdog timer should be configured in general purpose timer mode
 *
 *   <b> Post Condition </b>
 *   @n  Returns the status about whether watchdog timer is running or not 
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_WdtHandle     hWdt;
        CSL_WdtStStat     stStat;  
        ...
        stStat = CSL_wdtGetStStat (hWdt);
        ...
     @endverbatim
 * ===========================================================================
 */

static inline
CSL_WdtStStat CSL_wdtGetStStat (
	CSL_WdtHandle hWdt
)
{
    CSL_WdtStStat   stStat;

    /* Read the ST bit in the MPU_CNTL_TIMER register */
    stStat = (CSL_WdtStStat)CSL_FEXT (hWdt->regs->CNTL, WDT_CNTL_ST);

    return stStat;
}


/**
 *	Control command functions of the watchdog timer
 */

/** ============================================================================
 *   @n@b CSL_wdtLoad
 *
 *   @b Description
 *      Loads the watchdog timer load register (MPU_LOAD_TIMER)
 *
 *   @b Arguments
 *   @verbatim
        hWdt     	    Handle to the watchdog timer instance
        
        loadVal         Value to be loaded to the watchdog timer load register
     @endverbatim
 *
 *   <b> Return Value </b> 
 *       None 
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  Watchdog timer load register is loaded with the given value.  
 *       General-purpose timer mode:
 *          The new value is effected when the timer passes through 0 or when it
 *          starts.
 *           
 *       Watchdog timer mode: 
 *          The new value is effected immediately.
 *
 *   @b Modifies
 *   @n Watchdog timer load register
 *
 *   @b Example
 *   @verbatim
        CSL_WdtHandle     hWdt;
        Uint16            loadVal = 0xABCD;
        ...
        count = CSL_wdtLoad (hWdt, loadVal);
        ...
     @endverbatim
 * ===========================================================================
 */

static inline
void CSL_wdtLoad (
	CSL_WdtHandle   hWdt,
    Uint16          loadVal
)
{
    hWdt->regs->LOADREAD = loadVal;
}

/** ============================================================================
 *   @n@b CSL_wdtStart
 *
 *   @b Description
 *      In the general purpose mode, this API starts the watchdog timer
 *
 *   @b Arguments
 *   @verbatim
        hWdt    Handle to the watchdog timer instance
     @endverbatim
 *
 *   <b> Return Value </b> 
 *       None 
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  Watchdog timer is started
 *
 *   @b  Modifies
 *   @n  Watchdog timer control register
 *
 *   @b  Example
 *   @verbatim
        CSL_WdtHandle     hWdt;
        ...
        CSL_wdtStart (hWdt);
        ...
     @endverbatim
 * ===========================================================================
 */

static inline
void CSL_wdtStart (
	CSL_WdtHandle   hWdt
)
{
    CSL_FINST (hWdt->regs->CNTL, WDT_CNTL_ST, SET);
}

/** ============================================================================
 *   @n@b CSL_wdtStop
 *
 *   @b Description
 *      In the general purpose mode, this API stops the watchdog timer
 *
 *   @b Arguments
 *   @verbatim
        hWdt    Handle to the watchdog timer instance
     @endverbatim
 *
 *   <b> Return Value </b> 
 *       None 
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  Watchdog timer is stopped
 *
 *   @b  Modifies
 *   @n  Watchdog timer control register
 *
 *   @b  Example
 *   @verbatim
        CSL_WdtHandle     hWdt;
        ...
        CSL_wdtStop (hWdt);
        ...
     @endverbatim
 * ===========================================================================
 */

static inline
void CSL_wdtStop (
	CSL_WdtHandle   hWdt
)
{
    CSL_FINST (hWdt->regs->CNTL, WDT_CNTL_ST, RESET);
}

/** ============================================================================
 *   @n@b CSL_wdtDisable
 *
 *   @b Description
 *      This API disable the watchdog timer
 *
 *   @b Arguments
 *   @verbatim
        hWdt    Handle to the watchdog timer instance
     @endverbatim
 *
 *   <b> Return Value </b> 
 *       None 
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  Watchdog timer is disabled
 *
 *   @b  Modifies
 *   @n  Watchdog timer mode register
 *
 *   @b  Example
 *   @verbatim
        CSL_WdtHandle     hWdt;
        ...
        CSL_wdtDisable (hWdt);
        ...
     @endverbatim
 * ===========================================================================
 */
 
static inline
void CSL_wdtDisable (
	CSL_WdtHandle   hWdt
)
{
    CSL_FINST (hWdt->regs->MODE, WDT_MODE_WATCHDOG_DIS, CMD1);
    CSL_FINST (hWdt->regs->MODE, WDT_MODE_WATCHDOG_DIS, CMD2);
}

#ifdef __cplusplus
}
#endif

#endif /* _CSL_WDTAUX_H_ */

⌨️ 快捷键说明

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