Exemple #1
0
//*****************************************************************************
//
//! The interrupt handler for the watchdog timer
//!
//! \param  None
//!
//! \return None
//
//*****************************************************************************
void WatchdogIntHandler(void)
{
    //
    // If we have been told to stop feeding the watchdog, return immediately
    // without clearing the interrupt.  This will cause the system to reset
    // next time the watchdog interrupt fires.
    //
    if(!g_ucFeedWatchdog)
    {
        return;
    }

    unsigned char ucQueueMsg = 0;
    if(g_ucWdogCount < CONNECTION_RETRIES)
    {
        g_ucWdogCount++;
        ucQueueMsg = (unsigned char)WDOG_EXPIRED;
        MAP_WatchdogIntClear(WDT_BASE);
    }
    else
    {
        g_ucFeedWatchdog = 0;
        ucQueueMsg = (unsigned char)CONNECTION_FAILED;
        MAP_WatchdogIntClear(WDT_BASE);
    }
    if(g_tConnection != 0)
    {
        osi_MsgQWrite(&g_tConnection, &ucQueueMsg, OSI_NO_WAIT);
    }
    else
    {
        UART_PRINT("Error: WatchdogIntHandler: Queue does not exist\n\r");
    }
}
/*---------------------------------------------------------------------------*/
void
watchdog_periodic(void)
{
#if WATCHDOG_ENABLED == 1
  MAP_WatchdogIntClear(WATCHDOG0_BASE);
#endif
}
Exemple #3
0
//*****************************************************************************
//
//! The interrupt handler for the watchdog timer
//!
//! \param  None
//!
//! \return None
//
//*****************************************************************************
void WatchdogIntHandler(void)
{
    //
    // If we have been told to stop feeding the watchdog, return immediately
    // without clearing the interrupt.  This will cause the system to reset
    // next time the watchdog interrupt fires.
    //
    if(!g_bFeedWatchdog)
    {
        return;
    }
    //
    // After 10 interrupts, switch On LED6 to indicate system reset
    // and don't clear watchdog interrupt which causes system reset
    //
    if(g_ulWatchdogCycles >= 10)
    {
        GPIO_IF_LedOn(MCU_RED_LED_GPIO);
        MAP_UtilsDelay(800000);
        return;
    }
    //
    // Clear the watchdog interrupt.
    //
    MAP_WatchdogIntClear(WDT_BASE);
    GPIO_IF_LedOn(MCU_RED_LED_GPIO);
    MAP_UtilsDelay(800000);
    GPIO_IF_LedOff(MCU_RED_LED_GPIO);
    //
    // Increment our interrupt counter.
    //
    g_ulWatchdogCycles++;

}
Exemple #4
0
void Watchdog::run() {
  while (1) {
    MAP_WatchdogReloadSet(WDT_BASE, 240000000UL);
    MAP_WatchdogIntClear(WDT_BASE);
    sys::Thread::sleep_ms(kWdtClearTime);
  }
}
Exemple #5
0
STATIC mp_obj_t pyb_wdt_feed(mp_obj_t self_in) {
    pyb_wdt_obj_t *self = self_in;
    if ((self->servers || self->servers_sleeping) && self->simplelink && self->running) {
        self->servers = false;
        self->simplelink = false;
        MAP_WatchdogIntClear(WDT_BASE);
    }
    return mp_const_none;
}
Exemple #6
0
void Watchdog::stop() {
  MAP_WatchdogUnlock(WDT_BASE);

  MAP_WatchdogIntClear(WDT_BASE);

  MAP_WatchdogIntUnregister(WDT_BASE);

  Thread::stop();
}
Exemple #7
0
/* Error LED blink------------------------------------------------------------*/
static void Err_led(unsigned char err)
{
    bool b_err;

    while (1)
    {
        MAP_WatchdogIntClear(WATCHDOG0_BASE);
        if (b_err)
           pin_on(OPIN_ERR_LED);
         else
           pin_off(OPIN_ERR_LED);
         b_err=!b_err;
        hw_delay(700000);
    }
}
Exemple #8
0
/*----------------------------------------------------------------------------*/
void hw_watchdog_int_handler()
{
    //MAP_WatchdogIntClear(WATCHDOG0_BASE);
    if (g_watchdog_clear)
    {
        MAP_WatchdogIntClear(WATCHDOG0_BASE);
        g_watchdog_clear = FALSE;
    }else
    {
#ifdef DEBUG
        dbg_trace();
#endif // DEBUG
        tn_reset();
    }
}
Exemple #9
0
//****************************************************************************
//
//! DeInitialize the watchdog timer
//!
//! \param None
//! 
//! This function  
//!        1. DeInitializes the WDT
//!
//! \return None.
//
//****************************************************************************
void WDT_IF_DeInit()
{
    //
    // Unlock to be able to configure the registers
    //
    MAP_WatchdogUnlock(WDT_BASE);

    //
    // Disable stalling of the watchdog timer during debug events
    //
    MAP_WatchdogStallDisable(WDT_BASE);

    //
    // Clear the interrupt
    //
    MAP_WatchdogIntClear(WDT_BASE);

    //
    // Unregister the interrupt
    //
    MAP_WatchdogIntUnregister(WDT_BASE);
}
Exemple #10
0
/*---------------------------------------------------------------------------*/
void
IsrWatchdog(void)
{
  MAP_WatchdogIntClear(WATCHDOG0_BASE);
}
Exemple #11
0
//*****************************************************************************
//
//! Application callback handler for WDT interrupt
//!
//! \param none
//!
//! This function
//!    1. Clears the WDT interrupt
//!
//! \return None.
//
//*****************************************************************************
void AppWDTCallBackHandler()
{
    MAP_WatchdogIntClear(WDT_BASE);
    DBG_PRINT("WDT Interrupt occured\n\r");
}
/******************************************************************************
* name:
* description:
* param description:
* return value description:
******************************************************************************/
ERROR_CODE ineedmd_watchdog_setup(void)
{
#ifdef USING_TIRTOS
  ERROR_CODE eEC = ER_FAIL;

  Watchdog_Params_init(&params);
  params.resetMode = Watchdog_RESET_OFF;
#ifdef DEBUG
  //For debugging Watchdog counter will stop while stepping through code and reset is disabled
  //
  ineedmd_watchdog_debug_mode();

#endif
  params.callbackFxn = vINMD_watchdog_callback;
  handle = Watchdog_open(Board_WATCHDOG0, &params);
  if (!handle)
  {
    System_printf("Watchdog did not open");
    eEC = ER_FAIL;
  }
  else
  {
    Watchdog_setReload(handle, WD_BIG_PAT);
    eEC = ER_OK;
  }

  return eEC;
#else
  ERROR_CODE eEC = ER_OK;
  uint32_t uiWD_shake = 0;
  MAP_SysCtlPeripheralEnable(WD_PHERF);
  MAP_SysCtlPeripheralReset(WD_PHERF);

  eMaster_int_enable();

  //Unlock the watchdog
  //
  if(MAP_WatchdogLockState(WD_BASE) == true)
  {
    MAP_WatchdogUnlock(WD_BASE);
  }

  //Enable the Watchdog timer interrupt
  //
  MAP_WatchdogIntEnable(WD_BASE);
  MAP_IntEnable(INT_WATCHDOG);
  MAP_WatchdogIntClear(WD_BASE);

  //Set the watchdog default timeout
  //
  MAP_WatchdogReloadSet(WD_BASE, WD_PAT);

  //Enable the watchdog to reset the system
  //
  MAP_WatchdogResetEnable(WD_BASE);

#ifdef DEBUG
  //For debugging Watchdog counter will stop while stepping through code and reset is disabled
  //
  ineedmd_watchdog_debug_mode();
//  MAP_WatchdogResetDisable(WD_BASE);
#endif

  //Finally enable the watchdog
  //
  MAP_WatchdogEnable(WD_BASE);

  //Check to make sure the watchdog is running
  //
  uiWD_shake = MAP_WatchdogValueGet(WD_BASE);
  if(uiWD_shake < WD_PAT)
  {
    eEC = ER_OK;
  }
  else
  {
    eEC = ER_FAIL;
  }
  return eEC;
#endif //#ifdef USING_TIRTOS
}
Exemple #13
0
void Watchdog::clear() {
  MAP_WatchdogIntClear(WDT_BASE);
}