int main(int argc,char* argv[]){ int ch; if(argc < 2){ usage(argv[0]); } while((ch=getopt(argc,argv,"dfhv"))!= EOF){ switch(ch){ case 'd': app_daemon(1,1); app_init(); break; case 'f': app_init(); break; case 'h': usage(argv[0]); break; case 'v': version(argv[0]); break; default: break; } } }
/** Gazell Link Layer Configuration tool main application. */ void main(void) { bool radio_activity; uint8_t buttons; mcu_init(); gzll_init(); app_init(); lcd_init(); EA = 1; app_execute(0); while(1) { buttons = buttons_read(); radio_activity = com_execute(); if(buttons || radio_activity) { app_execute(buttons); } } }
/** Application Main <BR> * ====================================================================== */ void main(void) { ///1. Standard Power-on routine (Clocks, Timers, IRQ's, etc) ///2. Standard OpenTag Init (most stuff actually will not be used) otapi_poweron(); otapi_init(); ///3. Top-level application init app_init(); ///4. Load a message to show that main startup has passed WAIT_FOR_MPIPE(); OTAPI_LOG_MSG(MSG_utf8, 6, 26, (ot_u8*)"SYS_ON", (ot_u8*)"System on and Mpipe active"); // LPM3/LPM4 not properly working on old CC430 silicon // LDO LPM causes RF module to fail // setting bit PMMHPMRE in PMMCTL0 register // global high power module request is enabled # ifndef __DEBUG__ //PMMCTL0 = 0xA580; // <-- disable for debugging # endif ///5. MAIN RUNTIME (post-init) <BR> ///<LI> Use a main loop with platform_ot_run(), and nothing more. </LI> ///<LI> You could put code before or after sys_runtime_manager, which will /// run before or after the (task + kernel). If you do, keep the code /// very short or else you are risking timing glitches.</LI> ///<LI> To run any significant amount of user code, use tasks. </LI> while(1) { platform_ot_run(); } }
int main(void) { app_init(); app_launch(0); return 0; }
void main(void) { ///1. Standard Power-on routine (Clocks, Timers, IRQ's, etc) ///2. Standard OpenTag Init (most stuff actually will not be used) platform_poweron(); platform_init_OT(); ///3. Initialize the User Applet & interrupts app_init(); ///4a. The device will wait (and block anything else) until you connect /// it to a valid console app. mpipedrv_standby(); ///4b. Load a message to show that main startup has passed otapi_log_msg(MSG_utf8, 6, 26, (ot_u8*)"SYS_ON", (ot_u8*)"System on and Mpipe active"); ///5. MAIN RUNTIME (post-init) <BR> ///<LI> Use a main loop with platform_ot_run(), and nothing more. </LI> ///<LI> You could put code before or after sys_runtime_manager, which will /// run before or after the (task + kernel). If you do, keep the code /// very short or else you are risking timing glitches.</LI> ///<LI> To run any significant amount of user code, use tasks. </LI> while(1) { platform_ot_run(); } }
int main (int argc, char *argv[]) { App *app; app = (App *) g_new (App, 1); gtk_init (&argc, &argv); app_init (app); GET_UI_ELEMENT (GtkWidget, mainwindow); GET_UI_ELEMENT (GtkWidget, layout1); g_signal_connect (G_OBJECT (layout1), "draw", G_CALLBACK (layout_draw_cb), app); make_button ("eventbox1", app); make_button ("eventbox2", app); gtk_widget_show_all (mainwindow); gtk_main (); return 0; }
void main(void) { app_init(); while(1){ out7seg(keyb()); } }
int main(int argc, char *argv[]) { int err; struct httpd httpd; char *bind; err = libre_init(); if(err != 0) { goto out; } if(argc == 1) { bind = "127.0.0.1:8013"; } else { bind = argv[1]; } err = prepare(&httpd, bind); err = app_init(); if(err != 0) goto out; err = re_main(signal_handler); out: return err; }
int main(int argc, char **argv) { rte_openlog_stream(stderr); /* Config */ app_config_init(&app); app_config_args(&app, argc, argv); app_config_parse(&app, app.config_file); app_config_check(&app); /* Init */ app_init(&app); /* Run-time */ rte_eal_mp_remote_launch( app_thread, (void *) &app, CALL_MASTER); return 0; }
static void create_base_gui(appdata_s *ad) { /* Window */ ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE); elm_win_autodel_set(ad->win, EINA_TRUE); if (elm_win_wm_rotation_supported_get(ad->win)) { int rots[] = { 270 }; elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), sizeof(rots) / sizeof(rots[0])); } evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL); eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad); /* Conformant */ ad->conform = elm_conformant_add(ad->win); elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW); elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE); evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(ad->win, ad->conform); evas_object_show(ad->conform); app_init(ad->conform); /* Show window after base gui is set up */ evas_object_show(ad->win); }
int main() { uart_config_t uart_conf; DISABLE_IRQ(); hal_clk_init(); sys_tick_init(); I2cInit( &I2c, I2C_SCL, I2C_SDA ); uart_conf.baud = 9600; uart_conf.word_length = 8; uart_conf.parity = NONE; uart_conf.stop_bits = 1; uart_init(&uart_conf); ENABLE_IRQ(); app_init(); DISABLE_IRQ(); led_init(); while(1){ /** polling all events */ app_evt(); led_evt(); } }
/** Application Main <BR> * ====================================================================== */ void main(void) { ///1. Standard Power-on routine (Clocks, Timers, IRQ's, etc) ///2. Standard OpenTag Init (most stuff actually will not be used) otapi_poweron(); otapi_init(); ///3. Palfi Application Initialization /// Palfi app acts as an interupt-driven thread. An interrupt pre-empts /// the kernel and seeds the thread. After this, the kernel takes-over /// the execution of the thread. This function enables these driving /// interrupts. palfi_init(); ///4. Top-level application init /// In this demo, the top-level application does very little. app_init(); WAIT_FOR_MPIPE(); ///4b. Load a message to show that main startup has passed OTAPI_LOG_MSG(MSG_utf8, 6, 26, (ot_u8*)"SYS_ON", (ot_u8*)"System on and Mpipe active"); ///5. MAIN RUNTIME (post-init) <BR> ///<LI> Use a main loop with platform_ot_run(), and nothing more. </LI> ///<LI> You could put code before or after sys_runtime_manager, which will /// run before or after the (task + kernel). If you do, keep the code /// very short or else you are risking timing glitches.</LI> ///<LI> To run any significant amount of user code, use tasks. </LI> while(1) { platform_ot_run(); } }
int main(int argc, char **argv){ static struct app app; // first thing is to fork off all services if(app_load_services(&app, UBUS_SERVICE_ROOT) != 0){ fprintf(stderr, "***** ERROR ***** there were errors while loading lua services!\n"); //app_destroy(&app); //return -1; } app_init(&app); if(app_connect_to_ubus(&app, NULL) != 0){ DEBUG("failed to connect to ubus!\n"); return -1; } if(app_load_scripts(&app, UBUS_ROOT) != 0){ fprintf(stderr, "***** ERROR ******* there were errors while loading ubus scripts\n"); fprintf(stderr, "***** some ubus rpc call may not be available!\n"); //app_destroy(&app); //return -1; } app_run(&app); app_destroy(&app); return 0; }
int main(void) { app_init(); app_event_loop(); app_deinit(); return 0; }
int MAIN(int argc, char **argv) { uint32_t lcore; int ret; /* Init EAL */ ret = rte_eal_init(argc, argv); if (ret < 0) return -1; argc -= ret; argv += ret; /* Parse application arguments (after the EAL ones) */ ret = app_parse_args(argc, argv); if (ret < 0) { app_print_usage(); return -1; } /* Init */ app_init(); app_print_params(); /* Launch per-lcore init on every lcore */ rte_eal_mp_remote_launch(app_lcore_main_loop, NULL, CALL_MASTER); RTE_LCORE_FOREACH_SLAVE(lcore) { if (rte_eal_wait_lcore(lcore) < 0) { return -1; } } return 0; }
/****f* simple.c/c_main * * SUMMARY * This function is called at application start-up. * It is used to register event callbacks and begin the simulation. * * SYNOPSIS * int c_main() * * SOURCE */ void c_main() { io_printf (IO_STD, ">> simple\n"); /* get this core's IDs */ coreID = spin1_get_core_id(); chipID = spin1_get_chip_id(); /* TODO: Works on 4-chip board only! */ /* set the core map for the simulation */ if (NUMBER_OF_CHIPS > 0) core_map[0] = CORE_MAP_00; if (NUMBER_OF_CHIPS > 1) core_map[1] = CORE_MAP_01; if (NUMBER_OF_CHIPS > 2) core_map[2] = CORE_MAP_10; if (NUMBER_OF_CHIPS > 3) core_map[3] = CORE_MAP_11; spin1_set_core_map(NUMBER_OF_CHIPS, core_map); /* set timer tick value (in microseconds) */ spin1_set_timer_tick(TIMER_TICK_PERIOD); /* register callbacks */ spin1_callback_on(MC_PACKET_RECEIVED, count_packets, -1); spin1_callback_on(DMA_TRANSFER_DONE, check_memcopy, 0); spin1_callback_on(USER_EVENT, send_packets, 2); spin1_callback_on(TIMER_TICK, flip_led, 3); /* initialize application */ app_init(); /* go */ spin1_start(); /* report results */ app_done(); }
void init(void) { app_init(); doi_init(); exchange_init(); group_init(); ipsec_init(); isakmp_doi_init(); libcrypto_init(); timer_init(); /* The following group are depending on timer_init having run. */ conf_init(); connection_init(); /* This depends on conf_init, thus check as soon as possible. */ log_reinit(); /* policy_init depends on conf_init having run. */ policy_init(); /* Depends on conf_init and policy_init having run */ cert_init(); crl_init(); sa_init(); transport_init(); virtual_init(); udp_init(); nat_t_init(); udp_encap_init(); vendor_init(); }
/**************************************************************************** * main ****************************************************************************/ int main(int argc, char* argv[]) { int exitCode = EXIT_SUCCESS; #ifdef _DEBUG remove("syslog.out"); //毎回ログを削除する事にした。 #ifndef USE_JOB_DEBUG openlog(NULL, LOG_PERROR, LOG_USER); //デバッグビルドでは、システムログを標準エラーにも出力する。ただし、デバッグジョブを使用する場合は、デバッグジョブのcurses表示と衝突しないよう、標準エラーには出力しない。 #endif//USE_JOB_DEBUG #else //_DEBUG setlogmask(LOG_UPTO(LOG_INFO)); //リリースビルドでは、LOG_DEBUGを抑制する。 #endif//_DEBUG #if (defined(GC_H) && !defined(USE_BISON_FLEX)) // putenv("GC_LOG_FILE=CON");//ログ出力先を指定する。 // GC_set_find_leak(1);//メモリリーク検出を開始する。 #endif//(defined(GC_H) && !defined(USE_BISON_FLEX)) #ifdef __CLIP_SEH_H__ SEH_init(); #endif//__CLIP_SEH_H__ #ifdef USE_GDIPLUS Gdiplus_Init(); #endif//USE_GDIPLUS app_init(argc, argv); exitCode = app_main(argc, argv); app_exit(); #ifdef USE_GDIPLUS Gdiplus_Exit(); #endif//USE_GDIPLUS #if (defined(GC_H) && !defined(USE_BISON_FLEX)) // CHECK_LEAKS();//メモリリークを検出する。 //★当ツールにおいては、ExprExceptionを補足して継続する箇所で、メモリリークは発生します。ガベージコレクションを有効にしているので、動作上の問題は有りません。★ #endif//(defined(GC_H) && !defined(USE_BISON_FLEX)) return exitCode; }
int main(int argc, char** argv) { GLFWwindow* window; glfwSetErrorCallback(on_error); if (!glfwInit()) exit(EXIT_FAILURE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); window = glfwCreateWindow(800, 600, "show mesh", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwSetKeyCallback(window, on_key); glfwSetCursorPosCallback(window, on_mouse); glfwSetMouseButtonCallback(window, on_click); glfwSetScrollCallback(window, on_scroll); glfwMakeContextCurrent(window); gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); glfwSwapInterval(1); app_init(argc, argv); gui_init(window); while (!glfwWindowShouldClose(window)) { float ratio; int width, height; glfwGetFramebufferSize(window, &width, &height); ratio = width / (float) height; glViewport(0, 0, width, height); glClear(GL_COLOR_BUFFER_BIT); glfwPollEvents(); app_draw(ratio); gui_logic(); gui_draw(); glfwSwapBuffers(window); } glfwDestroyWindow(window); glfwTerminate(); app_cleanup(); gui_cleanup(); exit(EXIT_SUCCESS); }
void main() { app_init(); app_run(); app_Exit(); }
/* this is the main function of the service. when this function returns the * service will be terminated by the SCM */ void WINAPI ServiceMain(DWORD argc, PTSTR *argv) { SERVICE_STATUS *pSt = &ctx->status; /* register the service with the ServiceControlManager */ ctx->hServiceStatus = RegisterServiceCtrlHandlerEx(ss_name, HandlerEx, ctx); dbg_err_if( ctx->hServiceStatus == 0 ); /* init the status struct and update the service status */ ZeroMemory(pSt, sizeof(SERVICE_STATUS)); /* just one service in this exe */ pSt->dwServiceType = SERVICE_WIN32_OWN_PROCESS; /* action supported by the service */ pSt->dwControlsAccepted = SERVICE_ACCEPT_STOP; /* error returned while starting/stopping */ pSt->dwWin32ExitCode = NO_ERROR; /* service specific exit code */ pSt->dwServiceSpecificExitCode = 0; /* we're still initializing */ pSt->dwCurrentState = SERVICE_START_PENDING; /* for progress operation */ pSt->dwCheckPoint = 1; /* wait hint */ pSt->dwWaitHint = 1000; /* set status */ dbg_err_if(SetServiceStatus(ctx->hServiceStatus, pSt) == 0); dbg_err_if(parse_opt(argc, argv)); /* load config and initialize */ dbg_err_if(app_init()); /* this should happen after initialization but I don't want to mess main.c with win32-only code */ /* notify the end of initialization */ u_dbg("SERVICE_RUNNING"); ctx->status.dwCurrentState = SERVICE_RUNNING; ctx->status.dwCheckPoint = ctx->status.dwWaitHint = 0; dbg_err_if(!SetServiceStatus(ctx->hServiceStatus, &ctx->status)); /* run the main loop */ app_run(); /* let the service terminate */ ctx->status.dwCurrentState = SERVICE_STOPPED; dbg_err_if(!SetServiceStatus(ctx->hServiceStatus, &ctx->status)); return; err: warn_strerror(GetLastError()); /* let the service terminate */ ctx->status.dwCurrentState = SERVICE_STOPPED; dbg_err_if(!SetServiceStatus(ctx->hServiceStatus, &ctx->status)); }
int main(void) { halInit(); chSysInit(); chThdSleepMilliseconds(1000); hw_init_gpio(); LED_RED_OFF(); LED_GREEN_OFF(); conf_general_init(); ledpwm_init(); mc_configuration mcconf; conf_general_read_mc_configuration(&mcconf); mc_interface_init(&mcconf); commands_init(); comm_usb_init(); app_configuration appconf; conf_general_read_app_configuration(&appconf); app_init(&appconf); timeout_init(); timeout_configure(appconf.timeout_msec, appconf.timeout_brake_current); #if CAN_ENABLE comm_can_init(); #endif #if WS2811_ENABLE ws2811_init(); led_external_init(); #endif #if ENCODER_ENABLE encoder_init(); #endif #if SERVO_OUT_ENABLE #if SERVO_OUT_SIMPLE servo_simple_init(); #else servo_init(); #endif #endif // Threads chThdCreateStatic(periodic_thread_wa, sizeof(periodic_thread_wa), NORMALPRIO, periodic_thread, NULL); chThdCreateStatic(sample_send_thread_wa, sizeof(sample_send_thread_wa), NORMALPRIO - 1, sample_send_thread, NULL); chThdCreateStatic(timer_thread_wa, sizeof(timer_thread_wa), NORMALPRIO, timer_thread, NULL); for(;;) { chThdSleepMilliseconds(5000); } }
int main() { app_init(); app_run(); app_exit(); return 0; }
int main( int argc, char *argv[] ) { int i; DFBResult ret; IDirectFB *dfb; IDirectFBDisplayLayer *layer = NULL; App apps[1]; DFBDisplayLayerConfig config; /* Parse arguments. */ for (i=1; i<argc; i++) { if (!strcmp( argv[i], "-h" )) return show_usage( argv[0] ); } /* Initialize DirectFB. */ ret = DirectFBInit( &argc, &argv ); if (ret) { D_DERROR( ret, "DFBTest/WindowFlip: DirectFBInit() failed!\n" ); return ret; } /* Create super interface. */ ret = DirectFBCreate( &dfb ); if (ret) { D_DERROR( ret, "DFBTest/WindowFlip: DirectFBCreate() failed!\n" ); return ret; } /* Get primary layer. */ ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer ); if (ret) { D_DERROR( ret, "DFBTest/WindowFlip: IDirectFB::GetDisplayLayer( PRIMARY ) failed!\n" ); goto out; } layer->GetConfiguration( layer, &config ); app_init( &apps[0], layer, 100, 50, config.width-300, config.height-150, 0 ); while (true) { direct_thread_sleep( 1000000 ); app_update( &apps[0] ); } out: /* Shutdown DirectFB. */ dfb->Release( dfb ); return ret; }
// Main routine to initialize esp-link. void user_init(void) { // get the flash config so we know how to init things //configWipe(); // uncomment to reset the config for testing purposes bool restoreOk = configRestore(); // Init gpio pin registers gpio_init(); gpio_output_set(0, 0, 0, (1<<15)); // some people tie it to GND, gotta ensure it's disabled // init UART uart_init(flashConfig.baud_rate, 115200); logInit(); // must come after init of uart // Say hello (leave some time to cause break in TX after boot loader's msg os_delay_us(10000L); os_printf("\n\n** %s\n", esp_link_version); os_printf("Flash config restore %s\n", restoreOk ? "ok" : "*FAILED*"); // Status LEDs statusInit(); serledInit(); // Wifi wifiInit(); // init the flash filesystem with the html stuff espFsInit(&_binary_espfs_img_start); //EspFsInitResult res = espFsInit(&_binary_espfs_img_start); //os_printf("espFsInit %s\n", res?"ERR":"ok"); // mount the http handlers httpdInit(builtInUrls, 80); // init the wifi-serial transparent bridge (port 23) serbridgeInit(23, 2323); uart_add_recv_cb(&serbridgeUartCb); #ifdef SHOW_HEAP_USE os_timer_disarm(&prHeapTimer); os_timer_setfn(&prHeapTimer, prHeapTimerCb, NULL); os_timer_arm(&prHeapTimer, 10000, 1); #endif struct rst_info *rst_info = system_get_rst_info(); NOTICE("Reset cause: %d=%s", rst_info->reason, rst_codes[rst_info->reason]); NOTICE("exccause=%d epc1=0x%x epc2=0x%x epc3=0x%x excvaddr=0x%x depc=0x%x", rst_info->exccause, rst_info->epc1, rst_info->epc2, rst_info->epc3, rst_info->excvaddr, rst_info->depc); uint32_t fid = spi_flash_get_id(); NOTICE("Flash map %s, manuf 0x%02lX chip 0x%04lX", flash_maps[system_get_flash_size_map()], fid & 0xff, (fid&0xff00)|((fid>>16)&0xff)); NOTICE("** esp-link ready"); // Init SNTP service cgiServicesSNTPInit(); #ifdef MQTT NOTICE("initializing MQTT"); mqtt_client_init(); #endif NOTICE("initializing user application"); app_init(); NOTICE("Waiting for work to do..."); }
int main() { title = window_create(); menu = window_create(); search = window_create(); answers = window_create(); questions = window_create(); help = window_create(); app_init(); window_set_window_handlers(title, (WindowHandlers){.load = title_load, .unload = title_unload});
int main(int argc, char **argv) { struct app_data data; if (app_init(&data, argc, argv)) { app_run(&data); app_fini(&data); } return 0; }
int main(int argc,char *argv[]) { app_init(); menu_start(); open_model_xml(); doloop(); app_shutdown(); return(0); }
int main(int argc, char* argv[]) { CoClusterParams params; app_init(params, argc, argv, PROG_ALL, "co-cluster"); GlobalInfo *global_info = new GlobalInfo(); Environment::init(params, global_info); Environment::set(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
int main(int ac, char **av) { t_app app; if (ac < 2) put_error(); ft_bzero(&app, sizeof(t_app)); app.ac = ac; app.av = av; app_init(&app); app_run(&app); return (0); }