static struct dvb_frontend * init_fe_device (struct dvb_adapter *adapter, struct plat_tuner_config *tuner_cfg, int i) { struct fe_core_state *state; struct dvb_frontend *frontend; struct core_config *cfg; printk ("> (bus = %d) %s\n", tuner_cfg->i2c_bus,__FUNCTION__); cfg = kmalloc (sizeof (struct core_config), GFP_KERNEL); if (cfg == NULL) { printk ("fe-core: kmalloc failed\n"); return NULL; } /* initialize the config data */ cfg->i2c_adap = i2c_get_adapter (tuner_cfg->i2c_bus); printk("%s i2c adapter = 0x%0x\n",__FUNCTION__, cfg->i2c_adap); cfg->i2c_addr = tuner_cfg->i2c_addr; if (cfg->i2c_adap == NULL) { printk ("fe-core: failed to allocate resources (%s)\n", (cfg->i2c_adap == NULL)?"i2c":"STPIO error"); kfree (cfg); return NULL; } frontend = frontend_init(cfg, i); printk ("%s: frontend_init (frontend = 0x%x)\n", __FUNCTION__, (unsigned int) frontend); if (frontend == NULL) { printk("No frontend found !\n"); return NULL; } printk ("%s: Call dvb_register_frontend (adapter = 0x%x)\n", __FUNCTION__, (unsigned int) adapter); if (dvb_register_frontend (adapter, frontend)) { printk ("%s: Frontend registration failed !\n", __FUNCTION__); if (frontend->ops.release) frontend->ops.release (frontend); return NULL; } state = frontend->demodulator_priv; return frontend; }
int main(int argc, char **argv) { frontend_init(); test_visitors(); test_semantic(); frontend_term(); return 0; }
int main (int argc, char **argv) { char options[1000]; int i; char gamename[255]; //create options string for later passing to runtime options[0] = '\0'; if(argc > 1) { for(i=1;i<argc;i++) { strcat(options, argv[i]); strcat(options, " "); } } frontend_init(); /* Initialize list of available games */ game_list_init_nocache(); while(1) { fe_S9xInitInputDevices(); //Initialise SDL input after each game run initSDL(); if (game_num_avail==0) { /* Draw background image */ draw_background(); fe_gamelist_text_out(35, 110, "ERROR: NO AVAILABLE GAMES FOUND",color16(255,255,255)); frontend_display(); sleep(5); fe_exit(); } /* Select Game */ select_game(playgame); //Quit SDL input before starting Game SDL_Quit(); //Run the actual game //Using system seems to work better with snes9x sprintf(gamename, "./snes9x %s \"roms/%s\"", options, playgame); system(gamename); usleep(500000); } }
int main(int argc, char **argv) { frontend_init(); test_visitors(); test_semantic(); test_expression(); test_target(); test_emplace(); frontend_term(); return 0; }
static struct dvb_frontend *init_stv090x_device(struct dvb_adapter *adapter, struct plat_tuner_config *tuner_cfg, int i) { struct dvb_frontend *frontend; struct core_config *cfg; unsigned int reg = 0; printk("> (bus = %d) %s\n", tuner_cfg->i2c_bus, __FUNCTION__); cfg = kmalloc(sizeof(struct core_config), GFP_KERNEL); if (cfg == NULL) { printk("stv090x: kmalloc failed\n"); return NULL; } /* initialize the config data */ cfg->tuner_enable_pin = NULL; cfg->i2c_adap = i2c_get_adapter(tuner_cfg->i2c_bus); printk("i2c adapter = 0x%0x\n", cfg->i2c_adap); cfg->i2c_addr = tuner_cfg->i2c_addr; printk("i2c addr = %02x\n", cfg->i2c_addr); if (cfg->i2c_adap == NULL) { printk("[stv090x] failed to allocate resources (i2c adapter)\n"); goto error; } /* SYS_CFG25[0] - FE900_SOFT_RESET */ ctrl_outl(1, 0xfe001164); /* reset ON */ msleep(250); ctrl_outl(0, 0xfe001164); /* reset OFF */ msleep(250); frontend = frontend_init(cfg, i); if (frontend == NULL) { printk("[stv090x] frontend init failed!\n"); goto error; } printk(KERN_INFO "%s: Call dvb_register_frontend (adapter = 0x%x)\n", __FUNCTION__, (unsigned int) adapter); if (dvb_register_frontend(adapter, frontend)) { printk("[stv090x] frontend registration failed !\n"); if (frontend->ops.release) frontend->ops.release(frontend); goto error; } return frontend; error: kfree(cfg); return NULL; }
int main(int argc, const char *argv[]) { const char *mips_elf_filename; const char *new_argv[argc]; int i, new_argc = 0; debug_init("/tmp/hoodwink.log"); debug("Hoodwink starting\n"); /* skip hoodwink program name */ argv++; argc--; if (argc && !strcmp(argv[0], "-U")) { argv += 2; argc -= 2; } if (argc && !strcmp(argv[0], "-0")) { argv += 2; argc -= 2; } if (argc < 1) { debug("No MIPS ELF specified\n"); sys_exit(1); } else { mips_elf_filename = argv[0]; argv++; argc--; } debug("MIPS ELF: \"%s\"\n", mips_elf_filename); new_argv[new_argc++] = mips_elf_filename; for (i = 0; i < argc; i++) new_argv[new_argc++] = argv[i]; debug("Arguments:\n"); for (i = 0; i < new_argc; i++) debug(" [%d] = \"%s\"\n", i, new_argv[i]); frontend_init(mips_elf_filename, new_argc, new_argv); return 0; }
static struct dvb_frontend * init_stv090x_device (struct dvb_adapter *adapter, struct plat_tuner_config *tuner_cfg, int i) { struct dvb_frontend *frontend; struct core_config *cfg; printk ("> (bus = %d) %s\n", tuner_cfg->i2c_bus,__FUNCTION__); cfg = kmalloc (sizeof (struct core_config), GFP_KERNEL); if (cfg == NULL) { printk ("stv090x: kmalloc failed\n"); return NULL; } /* initialize the config data */ cfg->tuner_enable_pin = NULL; cfg->i2c_adap = i2c_get_adapter (tuner_cfg->i2c_bus); printk("i2c adapter = 0x%0x\n", cfg->i2c_adap); cfg->i2c_addr = tuner_cfg->i2c_addr; printk("i2c addr = %02x\n", cfg->i2c_addr); #if !defined(SPARK) printk("tuner enable = %d.%d\n", tuner_cfg->tuner_enable[0], tuner_cfg->tuner_enable[1]); cfg->tuner_enable_pin = stpio_request_pin (tuner_cfg->tuner_enable[0], tuner_cfg->tuner_enable[1], "tuner enabl", STPIO_OUT); if (cfg->tuner_enable_pin == NULL) { printk ("[stv090x] failed to allocate resources (tuner enable pin)\n"); goto error; } #endif if (cfg->i2c_adap == NULL) { printk ("[stv090x] failed to allocate resources (i2c adapter)\n"); goto error; } cfg->tuner_enable_act = tuner_cfg->tuner_enable[2]; if (cfg->tuner_enable_pin != NULL) { stpio_set_pin (cfg->tuner_enable_pin, !cfg->tuner_enable_act); stpio_set_pin (cfg->tuner_enable_pin, cfg->tuner_enable_act); #if defined(UFS912) || defined(HS7810A) || defined(HS7110) || defined(WHITEBOX) /* give the tuner some time to power up. trial fix for tuner * not available after boot on some boxes. * */ msleep(250); #endif } frontend = frontend_init(cfg, i); if (frontend == NULL) { printk ("[stv090x] frontend init failed!\n"); goto error; } printk (KERN_INFO "%s: Call dvb_register_frontend (adapter = 0x%x)\n", __FUNCTION__, (unsigned int) adapter); if (dvb_register_frontend (adapter, frontend)) { printk ("[stv090x] frontend registration failed !\n"); if (frontend->ops.release) frontend->ops.release (frontend); goto error; } return frontend; error: if(cfg->tuner_enable_pin != NULL) { printk("[stv090x] freeing tuner enable pin\n"); stpio_free_pin (cfg->tuner_enable_pin); } kfree(cfg); return NULL; }
int slap_init( int mode, const char *name ) { int rc; assert( mode ); if ( slapMode != SLAP_UNDEFINED_MODE ) { /* Make sure we write something to stderr */ slap_debug |= LDAP_DEBUG_NONE; Debug( LDAP_DEBUG_ANY, "%s init: init called twice (old=%d, new=%d)\n", name, slapMode, mode ); return 1; } slapMode = mode; slap_op_init(); #ifdef SLAPD_MODULES if ( module_init() != 0 ) { slap_debug |= LDAP_DEBUG_NONE; Debug( LDAP_DEBUG_ANY, "%s: module_init failed\n", name, 0, 0 ); return 1; } #endif if ( slap_schema_init( ) != 0 ) { slap_debug |= LDAP_DEBUG_NONE; Debug( LDAP_DEBUG_ANY, "%s: slap_schema_init failed\n", name, 0, 0 ); return 1; } if ( filter_init() != 0 ) { slap_debug |= LDAP_DEBUG_NONE; Debug( LDAP_DEBUG_ANY, "%s: filter_init failed\n", name, 0, 0 ); return 1; } if ( entry_init() != 0 ) { slap_debug |= LDAP_DEBUG_NONE; Debug( LDAP_DEBUG_ANY, "%s: entry_init failed\n", name, 0, 0 ); return 1; } switch ( slapMode & SLAP_MODE ) { case SLAP_SERVER_MODE: root_dse_init(); /* FALLTHRU */ case SLAP_TOOL_MODE: Debug( LDAP_DEBUG_TRACE, "%s init: initiated %s.\n", name, (mode & SLAP_MODE) == SLAP_TOOL_MODE ? "tool" : "server", 0 ); slap_name = name; ldap_pvt_thread_pool_init( &connection_pool, connection_pool_max, 0); slap_counters_init( &slap_counters ); ldap_pvt_thread_mutex_init( &slapd_rq.rq_mutex ); LDAP_STAILQ_INIT( &slapd_rq.task_list ); LDAP_STAILQ_INIT( &slapd_rq.run_list ); slap_passwd_init(); rc = slap_sasl_init(); if( rc == 0 ) { rc = backend_init( ); } if ( rc ) return rc; break; default: slap_debug |= LDAP_DEBUG_NONE; Debug( LDAP_DEBUG_ANY, "%s init: undefined mode (%d).\n", name, mode, 0 ); rc = 1; break; } if ( slap_controls_init( ) != 0 ) { slap_debug |= LDAP_DEBUG_NONE; Debug( LDAP_DEBUG_ANY, "%s: slap_controls_init failed\n", name, 0, 0 ); return 1; } if ( frontend_init() ) { slap_debug |= LDAP_DEBUG_NONE; Debug( LDAP_DEBUG_ANY, "%s: frontend_init failed\n", name, 0, 0 ); return 1; } if ( overlay_init() ) { slap_debug |= LDAP_DEBUG_NONE; Debug( LDAP_DEBUG_ANY, "%s: overlay_init failed\n", name, 0, 0 ); return 1; } if ( glue_sub_init() ) { slap_debug |= LDAP_DEBUG_NONE; Debug( LDAP_DEBUG_ANY, "%s: glue/subordinate init failed\n", name, 0, 0 ); return 1; } if ( acl_init() ) { slap_debug |= LDAP_DEBUG_NONE; Debug( LDAP_DEBUG_ANY, "%s: acl_init failed\n", name, 0, 0 ); return 1; } return rc; }
static struct dvb_frontend * init_fe_device (struct dvb_adapter *adapter, struct plat_tuner_config *tuner_cfg, int i) { struct dvb_frontend *frontend; struct core_config *cfg; printk ("> (bus = %d) %s\n", tuner_cfg->i2c_bus,__FUNCTION__); cfg = kmalloc (sizeof (struct core_config), GFP_KERNEL); if (cfg == NULL) { printk ("stv090x: kmalloc failed\n"); return NULL; } /* initialize the config data */ cfg->tuner_enable_pin = NULL; cfg->i2c_adap = i2c_get_adapter (tuner_cfg->i2c_bus); printk("i2c adapter = 0x%0x\n", cfg->i2c_adap); cfg->i2c_addr = tuner_cfg->i2c_addr; printk("i2c addr = %02x\n", cfg->i2c_addr); if (cfg->i2c_adap == NULL) { printk ("[stv090x] failed to allocate resources (i2c adapter)\n"); goto error; } frontend = frontend_init(cfg, i); if (frontend == NULL) { printk ("[stv090x] frontend init failed!\n"); goto error; } printk (KERN_INFO "%s: Call dvb_register_frontend (adapter = 0x%x)\n", __FUNCTION__, (unsigned int) adapter); if (dvb_register_frontend (adapter, frontend)) { printk ("[stv090x] frontend registration failed !\n"); if (frontend->ops.release) frontend->ops.release (frontend); goto error; } return frontend; error: if(cfg->tuner_enable_pin != NULL) { printk("[stv090x] freeing tuner enable pin\n"); stpio_free_pin (cfg->tuner_enable_pin); } kfree(cfg); return NULL; }
/* both demods are on the same I2C-bus by default accessible through address 18 */ int main (void) { // default I2C implementation is based on parallel port but user can connect its // own I2C driver using host_i2c_interface_attach(); // implementation is done in sample/interface/host.c //struct dibDataBusHost *i2c = host_i2c_interface_attach(NULL), *b; struct dibDataBusHost *i2c = open_spp_i2c(), *b; struct dibFrontend frontend[2]; struct dibChannel ch; struct dibDemodMonitor mon[2]; struct dibPMU *pmu; if (i2c == NULL) return 1; DibZeroMemory(&mon, sizeof(mon)); frontend_init(&frontend[0]); /* initializing the frontend-structure */ frontend_init(&frontend[1]); /* initializing the frontend-structure */ frontend_set_id(&frontend[0], 0); /* assign an absolute ID to the frontend */ frontend_set_id(&frontend[1], 1); /* assign an absolute ID to the frontend */ if (dib9090_firmware_sip_register(&frontend[0], 0x80, i2c, &nim9090md_config[0]) == NULL) { /* using a frontend on I2C address 0x80 */ dbgp(" DiB9090: attaching demod and tuners failed.\n"); return DIB_RETURN_ERROR; } i2c = dib7000m_get_i2c_master(&frontend[0], DIBX000_I2C_INTERFACE_GPIO_3_4, 0); if (dib9090_firmware_sip_register(&frontend[1], 0x82, i2c, &nim9090md_config[1]) == NULL) { /* using a frontend on I2C address 0x82 */ dbgp(" DiB9090: attaching demod and tuners failed.\n"); return DIB_RETURN_ERROR; } /* do the i2c-enumeration for 2 demod and use 0x80 as the I2C address for first device */ i2c = data_bus_client_get_data_bus(demod_get_data_bus_client(&frontend[0])); dib7000m_i2c_enumeration(i2c, 1, 0x20, 0x80); /* non-standard i2c-enumeration, because of INT_SELECT-fixation */ i2c = data_bus_client_get_data_bus(demod_get_data_bus_client(&frontend[1])); dib7000m_i2c_enumeration(i2c, 1, DEFAULT_DIB9000_I2C_ADDRESS, 0x82); b = dib7000m_get_i2c_master(&frontend[0], DIBX000_I2C_INTERFACE_GPIO_1_2, 0); if ((pmu = osiris_create(b, &nim9090md_osiris_config)) == NULL) return DIB_RETURN_ERROR; dib9090_set_pmu(&frontend[0], pmu); /* workaround because we cannot access the PMU from the host after downloading the firmware - for now */ frontend_reset(&frontend[0]); frontend_reset(&frontend[1]); INIT_CHANNEL(&ch, STANDARD_DVBT); ch.RF_kHz = 474000; ch.bandwidth_kHz = 8000; /* just to set them in a known state - not important */ tune_diversity(frontend, 2, &ch); DibDbgPrint("-I- Tuning done <enter>\n"); getchar(); while (1) { /* after enumerating on the same i2c-bus, the i2c-addresses of the bus will be 0x80 for the diversity master and 0x82 for the slave */ demod_get_monitoring(&frontend[0], &mon[0]); demod_get_monitoring(&frontend[1], &mon[1]); dib7000_print_monitor(mon, NULL, 0 ,2); usleep(100000); } DibDbgPrint("-I- Cleaning up\n"); frontend_unregister_components(&frontend[1]); frontend_unregister_components(&frontend[0]); pmu_release(pmu); //host_i2c_release(i2c); close_spp_i2c(); return 0; }
static void register_frontends(void) { frontend_init(); frontend_dot_register(); frontend_json_register(); }