示例#1
0
文件: wdt_if.c 项目: ArunBoddu/CC3200
//****************************************************************************
//
//! Initialize the watchdog timer
//!
//! \param fpAppWDTCB is the WDT interrupt handler to be registered
//! \param uiReloadVal is the reload value to be set to the WDT
//! 
//! This function  
//!        1. Initializes the WDT
//!
//! \return None.
//
//****************************************************************************
void WDT_IF_Init(fAPPWDTDevCallbk fpAppWDTCB,
                   unsigned int uiReloadVal)
{
    //
    // Enable the peripherals used by this example.
    //
    MAP_PRCMPeripheralClkEnable(PRCM_WDT, PRCM_RUN_MODE_CLK);

    //
    // Unlock to be able to configure the registers
    //
    MAP_WatchdogUnlock(WDT_BASE);

    if(fpAppWDTCB != NULL)
    {
#ifdef USE_TIRTOS
        osi_InterruptRegister(INT_WDT, fpAppWDTCB, INT_PRIORITY_LVL_1);
#else
        MAP_WatchdogIntRegister(WDT_BASE,fpAppWDTCB);
#endif
    }

    //
    // Set the watchdog timer reload value
    //
    MAP_WatchdogReloadSet(WDT_BASE,uiReloadVal);

    //
    // Start the timer. Once the timer is started, it cannot be disable.
    //
    MAP_WatchdogEnable(WDT_BASE);

}
示例#2
0
Thread::Error Watchdog::start() {

  MAP_PRCMPeripheralClkEnable(PRCM_WDT, PRCM_RUN_MODE_CLK);

  MAP_WatchdogUnlock(WDT_BASE);

  MAP_WatchdogStallEnable(WDT_BASE);

  MAP_IntPrioritySet(INT_WDT, INT_PRIORITY_LVL_1);

  MAP_WatchdogIntRegister(WDT_BASE, isr);

  MAP_WatchdogReloadSet(WDT_BASE, 240000000UL);

  MAP_WatchdogEnable(WDT_BASE);

  Thread::Error err = Thread::start();

  if (err != Thread::kOK)
    stop();

  return err;
}