drv_wdt.c

来自「最新版IAR FOR ARM(EWARM)5.11中的代码例子」· C语言 代码 · 共 71 行

C
71
字号
/**********************************************************************************/
/*                                                                                */
/*    Copyright (C) 2006 Oki Electric Industry Co., LTD.                          */
/*                                                                                */
/*    System Name    :  ML675050 series                                           */
/*    Module Name    :  ML675050system I2C drives program                         */
/*    File   Name    :  drv_i2c.c                                                 */
/*    Revision       :  01.00                                                     */
/*    Date           :  2006/1/16 initial version                                 */
/*                                                                                */
/**********************************************************************************/
#include "common.h"
#include "drv_common.h"
#include "drv_wdt.h"
#include "hal_api.h"
#include "intrinsics.h"

/***********************************/
/*     Static functions prototype  */
/***********************************/

/*****************************************************************************/
/*                                                                           */
/*  Function Name   : smpDrv_OpenWDT                                         */
/*  Input           : Nothing                                                */
/*  Output          : DRV_OK(1)                                              */
/*                  : DRV_PARAM_ERROR(-2)                                    */
/*  Note : Open WDT.                                                         */
/*                                                                           */
/*****************************************************************************/
int16_t smpDrv_OpenWDT( ML675050_WDTParam *param )
{
    int16_t rtnVal = DRV_OK;
    uPLAT_InterruptParam int_param;
    
    if(param->mode != WDT_OVF_INT_MODE){
        rtnVal = DRV_PARAM_ERROR;
    }
    if(rtnVal == DRV_OK){
        rtnVal = ml675050HAL_WDTInit( param->mode );
    }
    if(rtnVal == DRV_OK){
        /* Registration Callback function */
        int_param.primary = DRV_INT_WDT;           /* WDT interrupt */
        int_param.level = ILC0_ILR1 & INT_LV7;     /* level */
        int_param.callback = param->callback;      /* Call back function for WDT driver */
        rtnVal = HALInterrupt_SetPrimary(&int_param);            
           __enable_interrupt(); //irq_en();

    }
    
    return rtnVal;
}

/*****************************************************************************/
/*                                                                           */
/*  Function Name   : int16_t smpDrv_CloseWDT( void )                        */
/*  Input           : Nothing                                                */
/*  Output          : DRV_OK(1)                                              */
/*                                                                           */
/*  Note : Close WDT                                                         */
/*                                                                           */
/*****************************************************************************/
int16_t smpDrv_CloseWDT( void )
{
    int16_t rtnVal = DRV_OK;
    __disable_interrupt(); //irq_dis();                              /* Disable Interrupt */
    return rtnVal;
}

⌨️ 快捷键说明

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