static void oregano_init (Oregano *object) { cursors_init (); stock_init (); oregano_config_load (); }
void init(const char *_cmd) { x11_init(); checkotherwm(); cmd = _cmd; /* Setup the motion struct */ motion = xcalloc(1, sizeof(struct motion)); motion->type = NoMotion; sysinfo_init(); clients_init(); bars_init(settings()->barfont); launcher_init(); /* Select wvents to handle */ XSelectInput(dpy, root, WM_EVENT_MASK); /* Setup cursors */ cursors_init(); cursor_set(root, NormalCursor); /* Setup key bindings */ keys = settings()->keys; key_init(); key_grab_all(keys); /* Init atoms and EWMH */ atoms_init(); ewmh_init(wm_name); /* Init program lists */ program_init(getenv("PATH")); /* Create monitors */ create_monitors(); /* Init ewmh desktop functionality */ ewmh_root_set_number_of_desktops( monitor_count(mons) * N_WORKSPACES); ewmh_root_set_current_desktop(0); get_windows(); set_environment(); }
//! You expected it: This routine is expected never to exit void main (void) { port_init(); watchdog_init(); timer_gpt3_init(); adc_init(); cursors_init(); power_init(); uart_init(); /* enable interrupts. */ EA = 1; get_board_id(); startup_message(); dump_xdata_sfr(); gpio_check_IO_direction(); dump_gpio(); dump_mcs51(); tx_drain(); // oops, UART routines seem not yet clean print_states_ruler(); print_states_enable = 1; print_states(); print_states_enable = 0; save_old_states(); states.number = 0; manufacturing_print_all(); ow_init(); timer1_init(); battery_charging_table_init(); LED_CHG_G_OFF(); LED_CHG_R_OFF(); LED_PWR_OFF(); /* The main loop contains several state machines handling various subsystems on the EC. The idea is to have each subroutine return as quickly as it can (no busy wait unless for a _very_ short delay). Also the subroutines should be pretty much self contained. Unless it is noted _here_ no state machine should need more than xxx microseconds before returning control. When a state machine returns control it is expected to have the variables it is working on in a consistent state. Period (just in case it was missed:^) If it helps: you may want to think of the main loop as a round-robin cooperative scheduler without the overhead this usually implies. This works well if, well, if _all_ routines within the main loop cooperate well. */ while(1) { STATES_TIMESTAMP(); busy = handle_command(); busy |= handle_cursors(); handle_leds(); handle_power(); handle_ds2756_requests(); handle_ds2756_readout(); busy |= handle_battery_charging_table(); watchdog_all_up_and_well |= WATCHDOG_MAIN_LOOP_IS_FINE; print_states(); monitor(); handle_debug(); sleep_if_allowed(); } }