int checkboard(void) { struct ps2_bootinfo *info = (void *) CKSEG0ADDR(PS2_BOOTINFO_OLDADDR); uint32_t size; volatile uint32_t *sbios_magic; int sbversion = 0; struct ps2_bootinfo bootinfo; puts("Board: Sony Playstation 2 MIPS r5900\n"); memset(&bootinfo, 0, sizeof(bootinfo)); size = info->size; if (size > sizeof(bootinfo)) { size = sizeof(bootinfo); } memcpy(&bootinfo, info, size); sbios_magic = (uint32_t *) SBIOS_MAGIC; if (*sbios_magic == SBIOS_MAGICVAL) { gd->arch._sbios = *(int (**)(int, void *))(SBIOS_BASE); } else gd->arch._sbios = NULL; sbversion = sbios(SB_GETVER, NULL); printf("SBIOS Version 0x%08x\n", sbversion); driver_init(); return 0; }
int kernel_main() { /* * Tell the kernel memory allocator which memory it can't use. * It already knows not to touch kernel image. */ lmm_remove_free( &malloc_lmm, (void*)USER_MEM_START, USER_MEM_SIZE ); lmm_remove_free( &malloc_lmm, (void*)0, 0x100000 ); /* * Initialize drivers here. */ driver_init(); /* * initialize the PIC so that IRQs and * exception handlers don't overlap in the IDT. */ pic_init( BASE_IRQ_MASTER_BASE, BASE_IRQ_SLAVE_BASE ); /* This is all up to you... */ return -1; }
/*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) { /* Initialize the filter driver. */ int r; r = parse_arguments(env_argc, env_argv); if(r != OK) { printf("Filter: wrong argument!\n"); return 1; } if ((buf_array = flt_malloc(BUF_SIZE, NULL, 0)) == NULL) panic("no memory available"); sum_init(); driver_init(); /* Subscribe to driver events for VFS drivers. */ r = ds_subscribe("drv\\.vfs\\..*", DSF_INITIAL | DSF_OVERWRITE); if(r != OK) { panic("Filter: can't subscribe to driver events"); } /* Announce we are up! */ driver_announce(); return(OK); }
void ConfigureLinuxHWDev(VPNum vp) { if (vp) return; { LinuxEnv le(SysCall); vfs_caches_init(0x1<<8); driver_init(); buffer_init(); } ConfigureLinuxHWDevArch(); INITCALL(deadline_slab_setup); INITCALL(device_init); INITCALL(elevator_global_init); INITCALL(init_bio); INITCALL(vio_bus_init); if (!KernelInfo::OnSim() || KernelInfo::OnHV()) { INITCALL(pcibus_class_init); INITCALL(pci_driver_init); INITCALL(pci_init); } }
void dde_kit_subsys_linux_init(void) { /* invoked in vfs_cache_init in Linux */ chrdev_init(); driver_init(); __dde_call_machine_init(); do_initcalls(); }
/* * Ok, the machine is now initialized. None of the devices * have been touched yet, but the CPU subsystem is up and * running, and memory and process management works. * * Now we can finally start doing some real work.. */ static void __init do_basic_setup(void) { rcu_init_sched(); /* needed by module_init stage. */ init_workqueues(); usermodehelper_init(); driver_init(); init_irq_proc(); do_initcalls(); }
/* * Ok, the machine is now initialized. None of the devices * have been touched yet, but the CPU subsystem is up and * running, and memory and process management works. * * Now we can finally start doing some real work.. */ static void __init do_basic_setup(void) { /* drivers will send hotplug events */ init_workqueues(); usermodehelper_init(); driver_init(); init_irq_proc(); do_initcalls(); }
/** * @brief System initialization. * @param None * @retval None */ void system_init(void) { RCC_ClocksTypeDef tRCC; RCC_GetClocksFreq(&tRCC); delay_init(tRCC.HCLK_Frequency); device_init(); driver_init(); }
void dde_init() { /* invoked in vfs_cache_init in Linux */ chrdev_init(); driver_init(); dde_call_machine_init(); do_initcalls(); loadable_module_init(); }
/* * Ok, the machine is now initialized. None of the devices * have been touched yet, but the CPU subsystem is up and * running, and memory and process management works. * * Now we can finally start doing some real work.. */ static void __init do_basic_setup(void) { init_workqueues(); cpuset_init_smp(); usermodehelper_init(); init_tmpfs(); driver_init(); init_irq_proc(); do_ctors(); do_initcalls(); }
void __init __attribute__((used)) l4dde26_init(void) { /* first, initialize DDEKit */ ddekit_init(); l4dde26_kmalloc_init(); /* Init Linux driver framework before trying to add PCI devs to the bus */ driver_init(); printk("Initialized DDELinux 2.6\n"); }
int main(int argc, char *argv[]) { enum { SC = 3 }; int opt, n; int sigs[] = { SIGINT, SIGHUP, SIGTERM }; void (*sighandlers[])() = { sigint_handler, sighup_handler, sigterm_handler }; struct sigaction s[SC]; for (n = 0; n < SC; ++n) { s[n].sa_handler = SIG_IGN; sigfillset(&s[n].sa_mask); s[n].sa_flags = 0; sigaction(sigs[n], &s[n], NULL); } for (opt = 1; opt < argc; ++opt) { if (strcmp(argv[opt], "-h") == 0 || strcmp(argv[opt], "--help") == 0) { show_usage(); return 0; } } mod_src_create(); gtk_init(&argc, &argv); settings_init(); driver_init(); lfo_tables_init(); mixer_init(); patch_control_init(); dish_file_state_init(); session_init(argc, argv); gui_init(); for (n = 0; n < SC; ++n) { s[n].sa_handler = sighandlers[n]; sigfillset(&s[n].sa_mask); s[n].sa_flags = 0; sigaction(sigs[n], &s[n], NULL); } gtk_main(); cleanup(); return 0; }
int rmd_rec_start() { set_report_rec_stat(); if (driver_init() != 0) return -1; if (task_init() != 0) return -1; return 0; }
/* * Ok, the machine is now initialized. None of the devices * have been touched yet, but the CPU subsystem is up and * running, and memory and process management works. * * Now we can finally start doing some real work.. */ static void __init do_basic_setup(void) { /* drivers will send hotplug events */ init_workqueues(); usermodehelper_init(); driver_init(); #ifdef CONFIG_SYSCTL sysctl_init(); #endif do_initcalls(); }
int egl_init_opengl(void *erlCallbacks) { #ifdef _WIN32 driver_init((TWinDynDriverCallbacks *) erlCallbacks); #endif if(egl_initiated == 0) { if(load_gl_functions()) { init_tess(); egl_initiated = 1; } } return 1; }
/* * Ok, the machine is now initialized. None of the devices * have been touched yet, but the CPU subsystem is up and * running, and memory and process management works. * * Now we can finally start doing some real work.. */ static void __init do_basic_setup(void) { driver_init(); #ifdef CONFIG_SYSCTL sysctl_init(); #endif /* Networking initialization needs a process context */ sock_init(); init_workqueues(); do_initcalls(); }
/* * Ok, the machine is now initialized. None of the devices * have been touched yet, but the CPU subsystem is up and * running, and memory and process management works. * * Now we can finally start doing some real work.. */ static void __init do_basic_setup(void) { /* drivers will send hotplug events */ init_workqueues(); usermodehelper_init(); driver_init(); #ifdef CONFIG_SYSCTL sysctl_init(); #endif /* Networking initialization needs a process context */ sock_init(); do_initcalls(); }
void init() { Serial.begin(115200); debug("Starting..."); pinMode(FIRST_RUN_PIN, INPUT); web_run(); if(digitalRead(FIRST_RUN_PIN) && AppSettings.load()){ debugf("SSID:%s PASS:%s", AppSettings.ssid.c_str(), AppSettings.password.c_str()); WifiStation.config(AppSettings.ssid.c_str(), AppSettings.password.c_str()); WifiStation.waitConnection(on_wifi_connected); driver_init(); } else { first_run(); } }
void dde_linux26_init() { /* initialize DDE kit */ dde_kit_init(); /* initialize DDE Linux 2.6 subsystems */ dde_linux26_printk_init(); dde_linux26_kmalloc_init(); dde_linux26_process_init(); dde_linux26_timer_init(); dde_linux26_softirq_init(); /* add main thread as potential worker */ dde_linux26_process_add_worker("DDE main"); /* init Linux driver framework before trying to add PCI devs to the bus */ driver_init(); }
int main(void) { bsp_init(); debug_init(DBG_LEVEL_TRACE | DBG_LEVEL_INFO | DBG_LEVEL_WARNING | DBG_LEVEL_ERROR); esn_detect_init(); esn_active_init(); esn_gain_init(); driver_init(); stack_init(); vTaskStartScheduler(); return 0; }
/* * Ok, the machine is now initialized. None of the devices * have been touched yet, but the CPU subsystem is up and * running, and memory and process management works. * * Now we can finally start doing some real work.. */ static void __init do_basic_setup(void) { /* drivers will send hotplug events */ init_workqueues(); usermodehelper_init(); driver_init(); init_irq_proc(); do_initcalls(); #ifdef CONFIG_OPENRG /* Instruct mmap and do_mmap not to verify there are free pages before * doing the mapping. This is useful when trying to load an executable * that is larger than the current free memory. We let the swap * mechanism to handle such cases because very little of the executable * pages are really needed in ram at the same time. */ sysctl_overcommit_memory = OVERCOMMIT_ALWAYS; #endif }
void main(void) #endif { int ret, ret_code; driver_init(); ret = bt_enable(NULL); if (ret == EXPECTED_ERROR) { ret_code = TC_PASS; } else { ret_code = TC_FAIL; } TC_END(ret_code, "%s - %s.\n", ret_code == TC_PASS ? PASS : FAIL, __func__); TC_END_REPORT(ret_code); }
/* static */ SysStatus LinuxPTYServer::ClassInit(VPNum vp) { if (vp==0) { CharDevOpener::charDevs = new CharDevOpener::DeviceHash; MetaStreamServer::init(); MetaDevOpener::init(); } ConfigureLinuxEnv(vp, GOBJ(ThePageAllocatorRef)); ConfigureLinuxGeneric(vp); if (vp==0) { LinuxEnv le(SysCall); vfs_caches_init(0x1<<8); driver_init(); console_init(); ptyDir = k42devfs_mk_dir("pty"); ptsDir = k42devfs_mk_dir("pts"); RegisterInitCall(new InitCall(&__initcall_tty_init)); RegisterInitCall(new InitCall(&__initcall_pty_init)); RegisterInitCall(new InitCall(&__initcall_tty_class_init)); LinuxEnvSuspend(); VPNum vpCnt = _SGETUVAL(DREFGOBJ(TheProcessRef)->vpCount()); for (VPNum i = 1; i < vpCnt; i++) { LinuxStartVP(i, LinuxPTYServer::ClassInit); } LinuxEnvResume(); ConfigureLinuxFinal(0); } return 0; }
/** * @brief Initialization of PAL * * This function initializes the PAL. The RC oscillator is calibrated. * * @return MAC_SUCCESS if PAL initialization is successful, FAILURE otherwise */ retval_t pal_init(void) { /* Clear any pending watchdog reset flag */ uint8_t temp = MCUSR; temp++; /* keep compiler happy */ MCUSR = 0; #ifdef WATCHDOG /* Watchdog Initialization. Enables the watchdog and sets the timeout period */ wdt_init(); #else WDT_RESET(); WDT_DISABLE(); #endif mcu_init(); // see pal_mcu_generic.c timer_init(); // see pal_timer.c gpio_init(); // see pal_board.c driver_init(); return MAC_SUCCESS; }
static status_t vmi_init_private( vmi_instance_t *vmi, uint32_t flags, uint64_t id, const char *name, vmi_config_t config) { uint32_t access_mode = flags & 0x0000FFFF; uint32_t init_mode = flags & 0x00FF0000; uint32_t config_mode = flags & 0xFF000000; status_t status = VMI_FAILURE; /* allocate memory for instance structure */ *vmi = (vmi_instance_t) safe_malloc(sizeof(struct vmi_instance)); memset(*vmi, 0, sizeof(struct vmi_instance)); /* initialize instance struct to default values */ dbprint(VMI_DEBUG_CORE, "LibVMI Version 0.11.0\n"); //TODO change this with each release /* save the flags and init mode */ (*vmi)->flags = flags; (*vmi)->init_mode = init_mode; (*vmi)->config_mode = config_mode; /* the config hash table is set up later based on mode */ (*vmi)->config = NULL; /* set page mode to unknown */ (*vmi)->page_mode = VMI_PM_UNKNOWN; /* setup the caches */ pid_cache_init(*vmi); sym_cache_init(*vmi); rva_cache_init(*vmi); v2p_cache_init(*vmi); if ( init_mode & VMI_INIT_SHM_SNAPSHOT ) { #if ENABLE_SHM_SNAPSHOT == 1 v2m_cache_init(*vmi); #else errprint("LibVMI wasn't compiled with SHM support!\n"); status = VMI_FAILURE; goto error_exit; #endif } /* connecting to xen, kvm, file, etc */ if (VMI_FAILURE == set_driver_type(*vmi, access_mode, id, name)) { goto error_exit; } /* driver-specific initilization */ if (VMI_FAILURE == driver_init(*vmi)) { goto error_exit; } dbprint(VMI_DEBUG_CORE, "--completed driver init.\n"); /* resolve the id and name */ if (VMI_FAILURE == set_id_and_name(*vmi, access_mode, id, name)) { goto error_exit; } /* init vmi for specific file/domain through the driver */ if (VMI_FAILURE == driver_init_vmi(*vmi)) { goto error_exit; } /* setup the page offset size */ if (VMI_FAILURE == init_page_offset(*vmi)) { goto error_exit; } /* get the memory size */ if (driver_get_memsize(*vmi, &(*vmi)->allocated_ram_size, &(*vmi)->max_physical_address) == VMI_FAILURE) { errprint("Failed to get memory size.\n"); goto error_exit; } dbprint(VMI_DEBUG_CORE, "**set size = %"PRIu64" [0x%"PRIx64"]\n", (*vmi)->size, (*vmi)->size); // for file mode we need os-specific heuristics to deduce the architecture // for live mode, having arch_interface set even in VMI_PARTIAL mode // allows use of dtb-based translation methods. if (VMI_FILE != (*vmi)->mode) { if(VMI_FAILURE == arch_init(*vmi)) { if (init_mode & VMI_INIT_COMPLETE) { dbprint(VMI_DEBUG_CORE, "--failed to determine architecture of live vm and INIT_COMPLETE.\n"); goto error_exit; } else { dbprint(VMI_DEBUG_CORE, "--failed to determine architecture of live vm and INIT_PARTIAL, continuing.\n"); } } else { dbprint(VMI_DEBUG_CORE, "--succesfully completed architecture init.\n"); } } /* we check VMI_INIT_COMPLETE first as VMI_INIT_PARTIAL is not exclusive */ if (init_mode & VMI_INIT_COMPLETE) { switch((*vmi)->config_mode) { case VMI_CONFIG_STRING: /* read and parse the config string */ if(VMI_FAILURE == read_config_string(*vmi, (char*)config)) { goto error_exit; } break; case VMI_CONFIG_GLOBAL_FILE_ENTRY: /* read and parse the config file */ if(VMI_FAILURE == read_config_file_entry(*vmi)) { goto error_exit; } break; case VMI_CONFIG_GHASHTABLE: /* read and parse the ghashtable */ if (!config) { goto error_exit; } (*vmi)->config = (GHashTable*)config; break; case VMI_CONFIG_NONE: default: /* init_complete requires configuration falling back to VMI_CONFIG_GLOBAL_FILE_ENTRY is unsafe here as the config pointer is probably NULL */ goto error_exit; } if(VMI_FAILURE == set_os_type_from_config(*vmi)) { dbprint(VMI_DEBUG_CORE, "--failed to determine os type from config\n"); goto error_exit; } /* setup OS specific stuff */ switch ( (*vmi)->os_type ) { #ifdef ENABLE_LINUX case VMI_OS_LINUX: if(VMI_FAILURE == linux_init(*vmi)) { goto error_exit; } break; #endif #ifdef ENABLE_WINDOWS case VMI_OS_WINDOWS: if(VMI_FAILURE == windows_init(*vmi)) { goto error_exit; } break; #endif default: goto error_exit; } status = VMI_SUCCESS; } else if (init_mode & VMI_INIT_PARTIAL) { status = VMI_SUCCESS; } else { errprint("Need to specify either VMI_INIT_PARTIAL or VMI_INIT_COMPLETE.\n"); goto error_exit; } if(init_mode & VMI_INIT_EVENTS) { #if ENABLE_XEN_EVENTS == 1 /* Enable event handlers */ events_init(*vmi); #else errprint("LibVMI wasn't compiled with events support!\n"); status = VMI_FAILURE; #endif } error_exit: return status; }
void driver_device::empty_init() { driver_init(); }
static status_t vmi_init_private( vmi_instance_t *vmi, uint32_t flags, unsigned long id, char *name, vmi_config_t *config) { uint32_t access_mode = flags & 0x0000FFFF; uint32_t init_mode = flags & 0x00FF0000; uint32_t config_mode = flags & 0xFF000000; status_t status = VMI_FAILURE; /* allocate memory for instance structure */ *vmi = (vmi_instance_t) safe_malloc(sizeof(struct vmi_instance)); memset(*vmi, 0, sizeof(struct vmi_instance)); /* initialize instance struct to default values */ dbprint("LibVMI Version 0.9_alpha\n"); //TODO change this with each release /* save the flags and init mode */ (*vmi)->flags = flags; (*vmi)->init_mode = init_mode; (*vmi)->config = config; (*vmi)->config_mode = config_mode; /* setup the caches */ pid_cache_init(*vmi); sym_cache_init(*vmi); rva_cache_init(*vmi); v2p_cache_init(*vmi); /* connecting to xen, kvm, file, etc */ if (VMI_FAILURE == set_driver_type(*vmi, access_mode, id, name)) { goto error_exit; } /* resolve the id and name */ if (VMI_FAILURE == set_id_and_name(*vmi, access_mode, id, name)) { goto error_exit; } /* driver-specific initilization */ if (VMI_FAILURE == driver_init(*vmi)) { goto error_exit; } dbprint("--completed driver init.\n"); /* we check VMI_INIT_COMPLETE first as VMI_INIT_PARTIAL is not exclusive */ if (init_mode & VMI_INIT_COMPLETE) { /* init_complete requires configuration */ if(VMI_CONFIG_NONE & (*vmi)->config_mode) { /* falling back to VMI_CONFIG_GLOBAL_FILE_ENTRY is unsafe here as the config pointer is probably NULL */ goto error_exit; } /* read and parse the config file */ else if ( (VMI_CONFIG_STRING & (*vmi)->config_mode || VMI_CONFIG_GLOBAL_FILE_ENTRY & (*vmi)->config_mode) && VMI_FAILURE == read_config_file(*vmi)) { goto error_exit; } /* read and parse the ghashtable */ else if (VMI_CONFIG_GHASHTABLE & (*vmi)->config_mode && VMI_FAILURE == read_config_ghashtable(*vmi)) { dbprint("--failed to parse ghashtable\n"); goto error_exit; } /* setup the correct page offset size for the target OS */ if (VMI_FAILURE == init_page_offset(*vmi)) { goto error_exit; } /* get the memory size */ if (driver_get_memsize(*vmi, &(*vmi)->size) == VMI_FAILURE) { errprint("Failed to get memory size.\n"); goto error_exit; } dbprint("**set size = %"PRIu64" [0x%"PRIx64"]\n", (*vmi)->size, (*vmi)->size); /* determine the page sizes and layout for target OS */ // Find the memory layout. If this fails, then proceed with the // OS-specific heuristic techniques. (*vmi)->pae = (*vmi)->pse = (*vmi)->lme = (*vmi)->cr3 = 0; (*vmi)->page_mode = VMI_PM_UNKNOWN; status = get_memory_layout(*vmi, &((*vmi)->page_mode), &((*vmi)->cr3), &((*vmi)->pae), &((*vmi)->pse), &((*vmi)->lme)); if (VMI_FAILURE == status) { dbprint ("**Failed to get memory layout for VM. Trying heuristic method.\n"); // fall-through } // if // Heuristic method if (!(*vmi)->cr3) { (*vmi)->cr3 = find_cr3((*vmi)); dbprint("**set cr3 = 0x%.16"PRIx64"\n", (*vmi)->cr3); } // if /* setup OS specific stuff */ if (VMI_OS_LINUX == (*vmi)->os_type) { status = linux_init(*vmi); } else if (VMI_OS_WINDOWS == (*vmi)->os_type) { status = windows_init(*vmi); } /* Enable event handlers only if we're in a consistent state */ if((status == VMI_SUCCESS) && (init_mode & VMI_INIT_EVENTS)){ events_init(*vmi); } return status; } else if (init_mode & VMI_INIT_PARTIAL) { init_page_offset(*vmi); driver_get_memsize(*vmi, &(*vmi)->size); /* Enable event handlers */ if(init_mode & VMI_INIT_EVENTS){ events_init(*vmi); } return VMI_SUCCESS; } error_exit: return status; }
int main(int argc, char **argv) { struct stat s; char path[PATH_MAX]; char inipath[PATH_MAX]; const char *opt_directory_name = NULL; const char *opt_driver_name = NULL; int opt_driver_type = DRIVER_SERIAL; const char *opt_device_name = NULL; int opt_format_list[5] = { 0 /* FORMAT_UNKNOWN */ }; int opt_format_index = 0; BUF *files; int opt_time = 0; int opt_user = 0; int opt_listen = 0; int ch; int ok; char *ap; int format; int ret; int i; snprintf(inipath, PATH_MAX, "%s/.s725rc", getenv("HOME")); yyin = fopen(inipath, "r"); if (yyin != NULL) { conf_filename = inipath; ret = yyparse(); if (ret != 0) exit(1); if (conf_driver_type != DRIVER_UNKNOWN) opt_driver_type = conf_driver_type; if (conf_format_type != FORMAT_UNKNOWN) opt_format_list[opt_format_index] = conf_format_type; if (conf_device_name != NULL) opt_device_name = conf_device_name; if (conf_directory_name != NULL) opt_directory_name = conf_directory_name; } while ((ch = getopt(argc, argv, "d:D:f:hlo:rtuv")) != -1) { switch (ch) { case 'd': opt_driver_name = optarg; opt_driver_type = driver_name_to_type(opt_driver_name); if (opt_driver_type == DRIVER_UNKNOWN) fatalx("unknown driver type: %s", opt_driver_name); break; case 'D': opt_device_name = optarg; break; case 'f': opt_directory_name = optarg; break; case 'l': opt_listen = 1; break; case 'o': ap = optarg; if (opt_format_index < (sizeof(opt_format_list) / sizeof(opt_format_list[0]))) { if ((format = format_from_str(ap)) != FORMAT_UNKNOWN) opt_format_list[opt_format_index++] = format; else fatalx("unknown output format: %s", ap); } break; case 't': opt_time = 1; break; case 'u': opt_user = 1; break; case 'v': log_add_level(); break; case 'h': usage(); return 0; break; default: usage(); return 1; } } if (opt_driver_type == DRIVER_SERIAL) { if (!opt_device_name) fatalx("device name required for %s driver", driver_type_to_name(opt_driver_type)); } if (! (opt_time || opt_user)) { if (opt_format_list[0] == FORMAT_UNKNOWN) fatalx("no output format specified"); } for (i = 0; i < sizeof(opt_format_list) / sizeof(opt_format_list[0]); ++i) { log_info("format: %s", format_to_str(opt_format_list[i])); } log_info("driver name: %s", driver_type_to_name(opt_driver_type)); log_info("driver type: %d", opt_driver_type); log_info("device name: %s", opt_device_name ? opt_device_name : ""); log_info("directory name: %s", opt_directory_name ? opt_directory_name : ""); ok = driver_init(opt_driver_type, opt_device_name); if (ok != 1) fatalx("driver_init failed"); if (opt_directory_name) { opt_directory_name = realpath(opt_directory_name, path); } else { getcwd(path, sizeof(path)); opt_directory_name = path; } if (!opt_directory_name) fatalx("could not resolve path. check -f"); if (access(opt_directory_name, R_OK | W_OK | X_OK) != 0) fatalx("unable to access directory: %s", opt_directory_name); if (stat(opt_directory_name, &s) != 0) fatalx("unable to stat directory: %s", opt_directory_name); if (! S_ISDIR(s.st_mode)) fatalx("not a directory directory: %s", opt_directory_name); if (driver_open() < 0) fatalx("unable to open port: %s", strerror(errno)); if (opt_time) { time_get(); driver_close(); return 0; } if (opt_user) { user_get(); driver_close(); return 0; } files = buf_alloc(0); if (opt_listen) { ret = files_listen(files); } else { ret = files_get(files); } if (ret) { for (i = 0; i < sizeof(opt_format_list) / sizeof(opt_format_list[0]); ++i) { if (opt_format_list[i] != FORMAT_UNKNOWN) { write_hrm_data(files, opt_directory_name, opt_format_list[i]); } } } buf_free(files); driver_close(); return 0; }