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

📄 csl_wdtopen.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_wdtOpen.c
 *
 *   @brief  File for functional layer of CSL API @a CSL_wdtOpen()
 *
 *  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_wdtOpen
 *
 *   @b Description
 *   @n This function returns the handle to the Watchdog timer controller
 *      instance. This handle is passed to all other CSL APIs.
 *
 *   @b Arguments
 *   @verbatim
            wdtObj          Pointer to watchdog timer object.

            wdtNum          Instance of watchdog timer CSL to be opened.
                            There is only one instance of the watchdog timer
                            available. So, the value for this parameter will be
                            CSL_WDT always.

            pWdtParam       Module specific parameters.

            status          Status of the function call
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_WdtHandle
 *   @n                         Valid watchdog timer handle will be returned if
 *                              status value is equal to CSL_SOK.
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n   1.    The status is returned in the status variable. If status
 *              returned is
 *   @li            CSL_SOK             Valid watchdog timer handle is returned
 *   @li            CSL_ESYS_FAIL       The watchdog timer instance is invalid
 *
 *        2.    Watchdog timer object structure is populated
 *
 *   @b Modifies
 *   @n    1. The status variable
 *
 *         2. Watchdog timer object structure
 *
 *   @b Example
 *   @verbatim
            CSL_status              status;
            CSL_WdtObj              wdtObj;
            CSL_WdtHandle           hWdt;

            hWdt = CSL_wdtOpen (&wdtObj, CSL_WDT, NULL, &status);
            ...
    @endverbatim
 * =============================================================================
 */
#pragma CODE_SECTION (CSL_wdtOpen, ".text:csl_section:wdt");
CSL_WdtHandle   CSL_wdtOpen (
    CSL_WdtObj      *pWdtObj,
    CSL_InstNum     wdtNum,
    CSL_WdtParam    *pWdtParam,
    CSL_Status      *pStatus
)
{
    CSL_Status            status;
    CSL_WdtHandle         hWdt;
    CSL_WdtBaseAddress    baseAddress;

    /* Added according to review comment 1.*/
    if(pWdtObj == NULL) {
        *pStatus = CSL_ESYS_INVPARAMS;
        return NULL;
    }

    status = CSL_wdtGetBaseAddress(wdtNum, pWdtParam, &baseAddress);

    if (status == CSL_SOK) {

        pWdtObj->regs = baseAddress.regs;
        pWdtObj->perNum = (CSL_InstNum)wdtNum;
        hWdt = (CSL_WdtHandle)pWdtObj;
    }
    else {
        pWdtObj->regs = (CSL_WdtRegsOvly)NULL;
        pWdtObj->perNum = (CSL_InstNum)-1;
        hWdt = (CSL_WdtHandle)NULL;
    }

    if (pStatus) {
        *pStatus = status;
    }

    return hWdt;
}

⌨️ 快捷键说明

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