Ejemplo n.º 1
0
static int __devinit
sfaxpci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	int err = -ENOMEM;
	struct sfax_hw *card = kzalloc(sizeof(struct sfax_hw), GFP_KERNEL);

	if (!card) {
		pr_info("No memory for Speedfax+ PCI\n");
		return err;
	}
	card->pdev = pdev;
	err = pci_enable_device(pdev);
	if (err) {
		kfree(card);
		return err;
	}

	pr_notice("mISDN: Speedfax found adapter %s at %s\n",
		  (char *)ent->driver_data, pci_name(pdev));

	card->cfg = pci_resource_start(pdev, 0);
	card->irq = pdev->irq;
	pci_set_drvdata(pdev, card);
	err = setup_instance(card);
	if (err)
		pci_set_drvdata(pdev, NULL);
	return err;
}
Ejemplo n.º 2
0
static int __devinit
w6692_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	int		err = -ENOMEM;
	struct w6692_hw	*card;
	struct w6692map	*m = (struct w6692map *)ent->driver_data;

	card = kzalloc(sizeof(struct w6692_hw), GFP_KERNEL);
	if (!card) {
		pr_info("No kmem for w6692 card\n");
		return err;
	}
	card->pdev = pdev;
	card->subtype = m->subtype;
	err = pci_enable_device(pdev);
	if (err) {
		kfree(card);
		return err;
	}

	printk(KERN_INFO "mISDN_w6692: found adapter %s at %s\n",
	       m->name, pci_name(pdev));

	card->addr = pci_resource_start(pdev, 1);
	card->irq = pdev->irq;
	pci_set_drvdata(pdev, card);
	err = setup_instance(card);
	if (err)
		pci_set_drvdata(pdev, NULL);
	return err;
}
Ejemplo n.º 3
0
int run_sequential( char *dataset_file, pltb_config_t *config, model_space_t *model_space )
{
	FILE *out = DEBUG_PROCESS_STATISTICS_OPEN_OUTPUT;
	pltb_model_stat_t stats[model_space->matrix_count];

	TIME_STRUCT_INIT(timer);

	fprint_eval_header(out);

	pllAlignmentData *data = read_alignment_data(dataset_file);

	pltb_result_t result;

	for(unsigned i = 0; i < IC_MAX; i++) {
		result.ic[i] = FLT_MAX;
	}

	while (next_model(model_space)) {
		partitionList *parts = init_partitions(data, config->base_freq_kind);
		pllInstance *inst = setup_instance(model_space->matrix_repr, &config->attr_model_eval, data, parts);

		pltb_model_stat_t *stat = &stats[model_space->matrix_index];
		stat->matrix_index = model_space->matrix_index;
		TIME_START(timer);

		optimize_model_parameters(inst, parts);

		TIME_END(timer);
		stat->time_cpu  = TIME_CPU(timer);
		stat->time_real = TIME_REAL(timer);

		stat->likelihood = inst->likelihood;
		calculate_model_ICs(stat, data, inst, model_space->free_parameter_count, config);
		merge_into_result(&result, stat, model_space->matrix_index);

		fprint_eval_row(out, model_space, stat);

		pllPartitionsDestroy(inst, &parts);
		pllDestroyInstance(inst);
	}
	fprint_eval_summary(out, model_space, &stats, &result);
	DEBUG_PROCESS_STATISTICS_CLOSE_OUTPUT(out);

	evaluate_result(model_space, &result, data, config);

	pllAlignmentDataDestroy(data);
	return 0;
}
Ejemplo n.º 4
0
void evaluate_result(model_space_t *relative_model_space, pltb_result_t *result, pllAlignmentData *data, pltb_config_t *config)
{
	pllInstance *tree;

	/* TODO: inplace modifications. ugly! */
	make_indices_absolute(relative_model_space, &result->matrix_index);

	unsigned *models  = malloc(sizeof(unsigned) * (IC_MAX + config->n_extra_models));
	unsigned n_models = prepare_unique_model_tasks(models, &result->matrix_index, config->extra_models, config->n_extra_models);

	model_space_t model_space;
	init_selection_model_space(&model_space, models, n_models);

	PRINT_TREE_SEARCH_HEADER();
	while (next_model(&model_space)) {
		PRINT_TREE_SEARCH_PRETEXT_BEGIN(model_space.matrix_repr_short);
		bool first = true;
		for (unsigned i = 0; i < IC_MAX; i++) {
			if (result->matrix_index[i] == models[model_space.matrix_index]) {
				if (first) {
					PRINT_TREE_SEARCH_PRETEXT_IC(get_IC_name_short(i));
					first = false;
				} else {
					PRINT_TREE_SEARCH_PRETEXT_IC_SEP(get_IC_name_short(i));
				}
			}
		}
		if (first) {
			PRINT_TREE_SEARCH_PRETEXT_IC("extra");
		}
		PRINT_TREE_SEARCH_PRETEXT_END();

		partitionList *parts = init_partitions(data, config->base_freq_kind);
		/* do the actual work */
		tree = setup_instance(model_space.matrix_repr, &config->attr_tree_search, data, parts);
		tree_search(tree, parts);
		prepare_tree_string(tree, parts);
		PRINT_TREE(tree->tree_string);
		pllPartitionsDestroy(tree, &parts);
		pllDestroyInstance(tree);
	}

	destroy_model_space(&model_space);
}