Пример #1
0
void wdt_init(E_WatchDogModes lub_watchdog_mode,E_WdtTimerPrescaler lub_wdt_prescaler)
{
	enable_protection();
	
	wdt_reset();										/* reset the watchdog*/
	switch(lub_watchdog_mode)
	{
		case WATCHDOG_INTERRUPT_MODE:
			WDTCSR|=(1<<WDIE);
		break;
		case WATCHDOG_RESET_MODE:
			WDTCSR|=(1<<WDE);
			break;
		case WATCHDOG_INTERRUPT_RESET:
			WDTCSR|=(1<<WDE)|(1<<WDIE);					/* set up int & reset mode */
			break;
		default:
			{
				BIT_CLEAR(WDTCSR,WDE);
				BIT_CLEAR(WDTCSR,WDIE);
				break;
			}
	}
	WDTCSR|=lub_wdt_prescaler;							/* set up timer prescaler */
	disable_protection();
	
}
Пример #2
0
int main(void)
{
  //mico_logic_partition_t *partition;
  
  init_clocks();
  init_memory();
  init_architecture();
  init_platform_bootloader();

  mico_set_bootload_ver();
  
  //update();

  enable_protection();

#ifdef MICO_ENABLE_STDIO_TO_BOOT
  if (stdio_break_in() == 1)
    goto BOOT;
#endif
  
  if( MicoShouldEnterBootloader() == false )
    bootloader_start_app( (MicoFlashGetInfo(MICO_PARTITION_APPLICATION))->partition_start_addr );
  /*else if( MicoShouldEnterMFGMode() == true )
    bootloader_start_app( (MicoFlashGetInfo(MICO_PARTITION_APPLICATION))->partition_start_addr );
  else if( MicoShouldEnterATEMode() ){
    partition = MicoFlashGetInfo( MICO_PARTITION_ATE );
    if (partition->partition_owner != MICO_FLASH_NONE) {
      bootloader_start_app( partition->partition_start_addr );
    }
  }*/

#ifdef MICO_ENABLE_STDIO_TO_BOOT
BOOT:
#endif
  
  _mount();
  printf ( menu, MODEL, Bootloader_REVISION, HARDWARE_REVISION );

  while(1){                             
    Main_Menu ();
  }
}
Пример #3
0
/*lint -save -e641 Fields of E_AvailableTasks have int values 5,10 and 20. It's save to convert to int. */
void Timer_Overflow_ServiceRoutine(void)
{
	
	enable_protection();
	rub_schd_counter++;

	disable_protection();
	
	if((rub_schd_counter%E_Task_5ms)==0)
	{
		execute_task(E_Task_5ms);
	}
	if((rub_schd_counter%E_Task_10ms)==0 )
	{
		execute_task(E_Task_10ms);
	}
	if((rub_schd_counter%E_Task_20ms)==0 )
	{

		execute_task(E_Task_20ms);
	}

	
}
Пример #4
0
/*
WEAK bool MicoShouldEnterMFGMode( void )
{
  return false;
}

WEAK bool MicoShouldEnterATEMode( void )
{
  return false;
}
*/
void bootloader_start_app( uint32_t app_addr )
{
  enable_protection( );
  startApplication( app_addr );
}