int main(void) { uart_init(); shift_init(); timer_init(); display_init(); keypad_init(); serial_init(); edit_init(); clock_init(); watchdog_init(WDTO_15MS, &oops); sei(); // enable interrupts printf("\r\n*** BOOTED ***\r\nSpaceTime, yay!\r\n"); timer_beep(10); while(1) { display_update(); serial_update(); edit_update(); clock_update(); } }
int main( void ) { ALWAYS_KEEP(info_block); cpu_init(); pr_info("*** Start! ***\r\n"); watchdog_init(WATCHDOG_TIMEOUT_MS); /* * Start the scheduler. * * NOTE : Tasks run in system mode and the scheduler runs in * Supervisor mode. The processor MUST be in supervisor mode * when vTaskStartScheduler is called. The demo applications * included in the FreeRTOS.org download switch to supervisor * mode prior to main being called. If you are not using one * of these demo application projects then ensure Supervisor * mode is used here. */ if (TASK_TASK_INIT) { xTaskCreate(setupTask,(signed portCHAR*) "Hardware Init", configMINIMAL_STACK_SIZE + 500, (void *) true, tskIDLE_PRIORITY, NULL); } else { setupTask((void *) false); } vTaskStartScheduler(); fatalError(FATAL_ERROR_SCHEDULER); return 0; }
int main() { bool newreadings; bool buttonschanged; load_init(); initsystem(); watchdog_init(); initserial(); timer_init(); display_init(); initfan(); adc_init(); buttons_init(); enableInterrupts(); protocol_onbooted(); while (1) { watchdog_kick(); newreadings = adc_updatereadings(); if (newreadings) { checkstate(); } buttonschanged = buttons_check(); if (newreadings || buttonschanged) { protocol_sendstate(); display_update(); } protocol_checkcommand(); } }
// ---------------------------------------------------------------------------------------------- // Обработка пришедшей команды // ---------------------------------------------------------------------------------------------- void Process_data(void) {char tmp=0; // команда на ресет if ( (can_msg_in.data[0]==0x33)&&(can_msg_in.data[1]==0x22)&&(can_msg_in.data[2]==0x11) ) { watchdog_init(); while(1); } else { tmp=(can_msg_in.data[0]); // 0-й бит - Подсветка B1 // 1 -й бит - Подсветка B2 if ((tmp&BIT(0))==0x01) B1LED_ON; else B1LED_OFF; if ((tmp&BIT(1))==0x02) B2LED_ON; else B2LED_OFF; /*Buzzer*/ if ((can_msg_in.data[1])&BIT(0)) PORTE|= BIT(0);//BUZZER ON else PORTE&=~BIT(0);// BUZZER OFF } }
main() { P1DIR = LED1; __enable_interrupt(); watchdog_init(); while(1); }
int main() { pFunction Jump_To_Application; uint32_t JumpAddress; SystemInit(); /* 配置系统时钟为72M */ NVIC_Configuration(); watchdog_init(); delay_init(72); //72M w25x64_init(); InitSerial(); Signel_led_init(); TIM_init(); SerialPutString("BootLoader Runing...\n"); SerialPutString("BootLoader for "); SerialPutString(SYSTEM_NAME); SerialPutString("\n"); ymodem(); iap(); SerialPutString("Load App!\n"); TIM_Cmd(TIM2,DISABLE); if (((*(__IO uint32_t*)APP_LOCATION) & 0x2FFE0000 ) == 0x20000000) { JumpAddress = *(__IO uint32_t*) (APP_LOCATION + 4); Jump_To_Application = (pFunction) JumpAddress; __set_MSP(*(__IO uint32_t*) APP_LOCATION); Jump_To_Application(); } return 0; }
/** * @ingroup firmware * * * * @param boot_dev * @param arm_m_type * @param atags * @return */ int notmain(uint32_t boot_dev, uint32_t arm_m_type, uint32_t atags) { hardware_init(); dmx_init(); printf("Compiled on %s at %s\n", __DATE__, __TIME__); ui_start(0x00); // User Interface ui_reinit(); ui_text_line_1("DMX512 Receiver", 15); ui_text_line_2("Booting........", 15); dmx_devices_read_config(); dmx_devices_init(); watchdog_init(); events_init(); for (;;) { watchdog_feed(); int i = 0; for (i = 0; i < sizeof(poll_table) / sizeof(poll_table[0]); i++) { poll_table[i].f(); } events_check(); } return 0; }
void bl_init_clks(void) { watchdog_init(); PCONP = PCRTC; // switch off everything except RTC init_clks1(); init_clks2(); init_mam(); }
/** \brief Initialize the MSP430 CPU. * * This function initializes : * <ol> * <li>WatchDog</li> * <li>Ports</li> * </ol> */ void msp430_cpu_init(void) { dint(); watchdog_init(); init_ports(); eint(); }
int main(int argc, char ** argv) { usb_cdc_class_t * cdc; DCC_LOG_INIT(); DCC_LOG_CONNECT(); DCC_LOG(LOG_TRACE, "1. cm3_udelay_calibrate()"); cm3_udelay_calibrate(); DCC_LOG(LOG_TRACE, "2. thinkos_init()"); thinkos_init(THINKOS_OPT_PRIORITY(8) | THINKOS_OPT_ID(7)); DCC_LOG(LOG_TRACE, "3. io_init()"); io_init(); DCC_LOG(LOG_TRACE, "4. external_bus_init()"); external_bus_init(); DCC_LOG(LOG_TRACE, "5. stdio_init()"); stdio_init(); printf("\n---\n"); DCC_LOG(LOG_TRACE, "6. trace_init()"); trace_init(); DCC_LOG(LOG_TRACE, "7. env_init()"); env_init(); /* create some threads */ DCC_LOG(LOG_TRACE, "8. monitor_init()"); monitor_init(); DCC_LOG(LOG_TRACE, "9. watchdog_init()"); watchdog_init(); DCC_LOG(LOG_TRACE, "10. net_init()"); net_init(); DCC_LOG(LOG_TRACE, "11. pkt_xmt_init()"); pkt_xmt_init(); net_pkt_mode(true); DCC_LOG(LOG_TRACE, "12. console_shell_init()"); console_shell_init(); DCC_LOG(LOG_TRACE, "13. usb_cdc_init()"); usb_cdc_sn_set(*((uint64_t *)STM32F_UID)); cdc = usb_cdc_init(&stm32f_otg_fs_dev, cdc_acm_def_str, cdc_acm_def_strcnt); DCC_LOG(LOG_TRACE, "14. usb_shell()"); for (;;) { usb_shell(cdc); } }
/********************************************************** * Routine: s_init * Description: Does early system init of muxing and clocks. * - Called path is with sram stack. **********************************************************/ void s_init(void) { watchdog_init(); set_muxconf_regs(); delay(100); peripheral_enable(); icache_enable(); }
static void state_enter(void) { switch (state) { case STATE_EARLY: LOG("- early -\n"); watchdog_init(0); hotplug("/etc/hotplug.json"); procd_coldplug(); break; case STATE_INIT: // try to reopen incase the wdt was not available before coldplug watchdog_init(0); LOG("- init -\n"); log_init(); procd_connect_ubus(); procd_inittab(); procd_inittab_run("respawn"); procd_inittab_run("askconsole"); procd_inittab_run("askfirst"); procd_inittab_run("sysinit"); break; case STATE_RUNNING: LOG("- init complete -\n"); break; case STATE_SHUTDOWN: LOG("- shutdown -\n"); procd_inittab_run("shutdown"); sync(); break; case STATE_HALT: LOG("- reboot -\n"); reboot(reboot_event); break; default: ERROR("Unhandled state %d\n", state); return; }; }
void watchdog(var_t *table, char *stage) { watchdog_t *wd; char *id; if (pthread_mutex_lock(&watchdog_mutex)) { log_sys_error("watchdog: pthread_mutex_lock"); return; } watchdog_init(); // In init id is not set. No problem. id = vtable_get(table, "id"); if (id == NULL) { goto exit; } // Record does not exist wd = sht_lookup(&watchdog_table, id); if (wd == NULL) { wd = watchdog_create(id, stage); if (wd == NULL) { log_error("watchdog: watchdog_create failed"); goto exit; } if (sht_insert(&watchdog_table, id, wd)) { log_error("watchdog: sht_insert failed"); goto exit; } } else { wd->wd_stage = stage; wd->wd_instage = time(NULL); } exit: if (pthread_mutex_unlock(&watchdog_mutex)) { log_sys_error("watchdog: pthread_mutex_unlock"); } return; }
int main(void) { watchdog_init(); clock_init(); port_init(); timer_init(); adc_init(); __bis_SR_register(LPM0_bits + GIE); return 0; }
int main(int argc, char **argv) { pid_t pid; ulog_open(ULOG_KMSG, LOG_DAEMON, "init"); sigaction(SIGTERM, &sa_shutdown, NULL); sigaction(SIGUSR1, &sa_shutdown, NULL); sigaction(SIGUSR2, &sa_shutdown, NULL); early(); cmdline(); watchdog_init(1); pid = fork(); if (!pid) { char *kmod[] = { "/sbin/kmodloader", "/etc/modules-boot.d/", NULL }; if (debug < 3) { int fd = open("/dev/null", O_RDWR); if (fd > -1) { dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); if (fd > STDERR_FILENO) close(fd); } } execvp(kmod[0], kmod); ERROR("Failed to start kmodloader\n"); exit(-1); } if (pid <= 0) { ERROR("Failed to start kmodloader instance\n"); } else { int i; for (i = 0; i < 120; i++) { if (waitpid(pid, NULL, WNOHANG) > 0) break; sleep(1); watchdog_ping(); } } uloop_init(); preinit(); uloop_run(); return 0; }
void initialize(void) { watchdog_init(); watchdog_start(); #if STACKMONITOR /* Simple stack pointer highwater monitor. Checks for magic numbers in the main * loop. In conjuction with TESTRTIMER, never-used stack will be printed * every STACKMONITOR seconds. */ { extern uint16_t __bss_end; uint16_t p=(uint16_t)&__bss_end; do { *(uint16_t *)p = 0x4242; p+=4; } while (p<SP-4); //don't overwrite our own stack } #endif /* rtimers needed for radio cycling */ rtimer_init(); rs232_init(RS232_PORT_0, BAUD_RATE(38400), USART_DATA_BITS_8 | USART_PARITY_NONE | USART_STOP_BITS_1); rs232_redirect_stdout(RS232_PORT_0); clock_init(); sei(); /* Initialize drivers and event kernel */ process_init(); led_init(); #if 0 procinit_init(); #else process_start(&etimer_process, NULL); process_start(&led_process, NULL); process_start(&led2_process, NULL); #endif PRINTA(CONTIKI_VERSION_STRING " started\r\n"); /* Comment this out if autostart_processes not defined at link */ /* Note AUTOSTART_PROCESSES(...) is only effective in the .co module */ autostart_start(autostart_processes); }
int main(void) { led_init(); key_init(); // timer0_init(); watchdog_init(); led_on(LED0); /* feed dog, otherwise will reset when watchdog time expire */ watchdog_feed(); return 0; }
/** * Initialize BMC main application */ void bmc_init(void) { vSemaphoreCreateBinary(sel_in_use); memset(&wd_timer, 0x00, sizeof(watchdog_t)); watchdog_init(); /* create bmc task */ if (pdPASS != xTaskCreate(bmc_task, (const signed portCHAR * const)"bmc_task", STACK_SIZE_BMC_TASK, NULL, BMC_TASK_PRIO, NULL)) { uart_printf("Could not create bmc_task!\n"); while (1); } return; }
/* do some early init */ void s_init(void) { int in_sdram = 0; #ifdef CONFIG_SPL in_sdram = is_running_in_sdram(); #endif watchdog_init(); sw_gpio_init(); clock_init(); gpio_init(); #ifdef CONFIG_SPL if (!in_sdram) sdram_init(); #endif }
int main(void) { /* Bring up processor */ cpu_init(); watchdog_init(); #ifdef CONFIG_HW_LED_ALIVE_CHECK /* Bring up low level LED */ hw_led_init(); #endif #ifdef CONFIG_HW_UART /* Bring up low level hardware UART */ hw_uart_init(); #endif /* Setup timer for tick counting */ tick_init(); /* Bring up high level LED */ led_init(); /* Bring up console */ console_init(); #ifdef CONFIG_DEBUG_RESET_REASON /* Report reason for last reset */ console_puts_P(PSTR("Reset cause:")); console_puthex8(MCUSR); console_newline(); #endif /* Set default LED pattern */ led_set_seq(LED_SEQ_SINE); #ifdef CONFIG_USBDEV usbdev_init(USBMODE_DEFAULT); #endif /* HiZ bus mode selected by default */ bus_init(&bus_hiz); /* Enable interrupts */ cpu_enable_int(); while(1) { driver_tick(); } }
/****************************************************************************** * Routine: s_init * Description: Does early system init of muxing and clocks. * - Called path is with SRAM stack. *****************************************************************************/ void s_init(void) { int in_sdram = is_running_in_sdram(); watchdog_init(); try_unlock_memory(); /* * Right now flushing at low MPU speed. * Need to move after clock init */ invalidate_dcache(get_device_type()); #ifdef CONFIG_L2_OFF l2_cache_disable(); #else l2_cache_enable(); #endif /* * Writing to AuxCR in U-boot using SMI for GP DEV * Currently SMI in Kernel on ES2 devices seems to have an issue * Once that is resolved, we can postpone this config to kernel */ if (get_device_type() == GP_DEVICE) setup_auxcr(); set_muxconf_regs(); sdelay(100); prcm_init(); per_clocks_enable(); #ifdef CONFIG_USB_EHCI_OMAP ehci_clocks_enable(); #endif #ifdef CONFIG_SPL_BUILD preloader_console_init(); timer_init(); #endif if (!in_sdram) mem_init(); }
void boot(void) { if (warm_reset()) force_emif_self_refresh(); watchdog_init(); mux_init(); enable_uart_clocks(); cons_init(); scale_vcores(); clock_init(); sdram_init(); bzero(__bss_start, __bss_end - __bss_start); timer_init(); storage_init(); }
int main() { gps_init(); log_init(); radio_init(); sms_init(); statusled_init(); timer1_init(); timer3_init(); watchdog_init(); /* Interrupts on - go go go! */ sei(); /* Now sleep - the whole program is interrupt driven */ for (;;) sleep_mode(); }
/********************************************************** * Routine: s_init * Description: Does early system init of muxing and clocks. * - Called path is with sram stack. **********************************************************/ void s_init(void) { int in_sdram = running_in_sdram(); watchdog_init(); set_muxconf_regs(); delay(100); try_unlock_sram(); if(!in_sdram) prcm_init(); peripheral_enable(); icache_enable(); if (!in_sdram) sdrc_init(); }
/********************************************************** * Routine: s_init * Description: Does early system init of muxing and clocks. * - Called path is with SRAM stack. **********************************************************/ void s_init(void) { int i; int external_boot = 0; int in_sdram = running_in_sdram(); watchdog_init(); external_boot = (get_boot_type() == 0x1F) ? 1 : 0; /* Right now flushing at low MPU speed. Need to move after clock init */ v7_flush_dcache_all(get_device_type(), external_boot); try_unlock_memory(); if (cpu_is_3410()) { /* Lock down 6-ways in L2 cache so that effective size of L2 is 64K */ __asm__ __volatile__("mov %0, #0xFC":"=r" (i)); __asm__ __volatile__("mcr p15, 1, %0, c9, c0, 0":"=r" (i)); } #ifndef CONFIG_ICACHE_OFF icache_enable(); #endif #ifdef CONFIG_L2_OFF l2cache_disable(); #else l2cache_enable(); #endif set_muxconf_regs(); delay(100); /* Writing to AuxCR in U-boot using SMI for GP/EMU DEV */ /* Currently SMI in Kernel on ES2 devices seems to have an isse * Once that is resolved, we can postpone this config to kernel */ setup_auxcr(get_device_type(), external_boot); prcm_init(); per_clocks_enable(); }
int main( void ) { ALWAYS_KEEP(info_block); cpu_init(); pr_info("*** Start! ***\r\n"); /* Defined as part of our compilation process */ if (true == ASL_WATCHDOG) watchdog_init(WATCHDOG_TIMEOUT_MS); const signed portCHAR task_name[] = "Hardware Init"; xTaskCreate(setupTask, task_name, HARDWARE_INIT_STACK_SIZE, NULL, RCP_LUA_PRIORITY, NULL); vTaskStartScheduler(); /* SHOULD NEVER GET HERE */ panic(PANIC_CAUSE_SCHEDULER); return 1; }
void system_init(void) { /* NOTE: don't use anything here that might require tick task ! * It is initialized by kernel_init *after* system_init(). * The main() will naturally set cpu speed to normal after kernel_init() * so don't bother if the cpu is running at 24MHz here. * Make sure IO clock is running at expected speed */ imx233_clkctrl_init(); imx233_clkctrl_enable(CLK_PLL, true); #if IMX233_SUBTARGET >= 3700 imx233_clkctrl_set_frac_div(CLK_IO, 18); // clk_io@clk_pll #endif imx233_rtc_init(); imx233_icoll_init(); imx233_pinctrl_init(); imx233_timrot_init(); imx233_dma_init(); imx233_ssp_init(); #if IMX233_SUBTARGET >= 3700 imx233_dcp_init(); #endif imx233_pwm_init(); imx233_lradc_init(); imx233_power_init(); imx233_i2c_init(); imx233_powermgmt_init(); /* setup watchdog */ watchdog_init(); /* make sure auto-slow is disable now, we don't know at which frequency we * are running and auto-slow could violate constraints on {xbus,hbus} */ imx233_clkctrl_enable_auto_slow(false); imx233_clkctrl_set_auto_slow_div(BV_CLKCTRL_HBUS_SLOW_DIV__BY8); cpu_frequency = imx233_clkctrl_get_freq(CLK_CPU); #if !defined(BOOTLOADER) && CONFIG_TUNER != 0 fmradio_i2c_init(); #endif }
/********************************************************** * Routine: s_init * Description: Does early system init of muxing and clocks. * - Called path is with sram stack. **********************************************************/ void s_init(void) { int in_sdram = running_in_sdram(); /* u32 rev = get_cpu_rev(); unused as of now.. */ watchdog_init(); try_unlock_sram(); /* Do SRAM availability first - take care of permissions too */ set_muxconf_regs(); delay(100); if (!in_sdram){ prcm_init(); } peripheral_enable(); icache_enable(); if (!in_sdram) sdrc_init(); }
int main(void) { watchdog_init(); clock_init(); gpio_init(); led_init(); uart_init(); while (1) { led_tx_off(); led_rx_on(); sdelay(10000000); led_tx_on(); led_rx_off(); sdelay(10000000); uart_putchar('z'); } return 0; }
/****************************************************************************** * Routine: s_init * Description: Does early system init of muxing and clocks. * - Called path is with SRAM stack. *****************************************************************************/ void s_init(void) { int in_sdram = is_running_in_sdram(); watchdog_init(); try_unlock_memory(); /* * Right now flushing at low MPU speed. * Need to move after clock init */ v7_flush_dcache_all(get_device_type()); #ifndef CONFIG_ICACHE_OFF icache_enable(); #endif #ifdef CONFIG_L2_OFF l2cache_disable(); #else l2cache_enable(); #endif /* * Writing to AuxCR in U-boot using SMI for GP DEV * Currently SMI in Kernel on ES2 devices seems to have an issue * Once that is resolved, we can postpone this config to kernel */ if (get_device_type() == GP_DEVICE) setup_auxcr(); set_muxconf_regs(); delay(100); prcm_init(); per_clocks_enable(); if (!in_sdram) sdrc_init(); }