int main(void) {
	parse_config_file(".config");
	setup_pci(card_id);

	pci.sendVetoClear();

	close_pci();
	return 0;
}
int main(void) {
	unsigned long int total_number_of_quarter_events_to_read_per_fiber_channel = 0;

	parse_config_file(".config");
	setup_pci(card_id);
	readout_all_pending_data();
	close_pci();

	return 0;
}
int main(void) {
	unsigned long int total_number_of_quarter_events_to_read_per_fiber_channel = 0;

	parse_config_file(".config");
	setup_pci(card_id);
	usleep(10000);
	send_soft_trigger_request_command_packet();
	usleep(10000);
	close_pci();

	return 0;
}
Example #4
0
int main(void) {
	parse_config_file(".config");
	setup_pci(card_id);
	should_soft_trigger = true;
	readout_all_pending_data();

	set_some_DACs_to(0, 0xe);
	//set_all_DACs_to(0);
	//set_all_DACs_to_built_in_nominal_values();

	close_pci();
	return 0;
}
Example #5
0
int main(void) {
	// setup:
	parse_config_file(".config");
	open_status_file_for_reading_and_writing();
	read_status_file();
	create_directory_if_necessary(location_of_raw_datafiles);
	generate_new_base_filename();
	setup_pci(card_id);
	readout_all_pending_data();
	setup_filenames_for_fiber();
	if (init_camac("CAMAC_config.txt")) {
		cerr << "ERROR:  could not connect to CAMAC crate" << endl;
//		exit(7);
	}
//	if (CAMAC_initialized) {
//		CAMAC_initialize_3377s();
		open_CAMAC_file();
//	}
	setup_to_catch_ctrl_c(close_all_files);
	open_logfile();
	open_files_for_all_enabled_fiber_channels();
	unsigned short int beginning_window = 0;
	unsigned short int ending_window = 63;
	set_start_and_end_windows(beginning_window, ending_window);
	usleep(50000);

	// testing:
	should_soft_trigger = true;

	// actual running:
	while (1) {
		wait_for_start_of_spill();
		while (spill_is_active()) {
			readout_an_event(true);
			read_data_from_CAMAC_and_write_to_CAMAC_file();
//			CAMAC_read_3377s();
			printf("\n");
		}
//		increment_spill_number();
//		write_status_file();
//		generate_new_base_filename();
//		split_fiber_file_to_prepare_for_next_spill();
//		split_CAMAC_file_to_prepare_for_next_spill();
//		usleep(250000);
//		sync();
	}

	// cleanup:
	close_all_files();
	return 0;
}
Example #6
0
int main(void) {
	unsigned long int total_number_of_quarter_events_to_read_per_fiber_channel = 0;

	parse_config_file(".config");
	setup_pci(card_id);
	should_soft_trigger = true;
	readout_all_pending_data();

	setup_feedback_enables_and_goals(1);
	
	close_pci();

	return 0;
}
int main(void) {
	unsigned long int total_number_of_quarter_events_to_read_per_fiber_channel = 0;

	parse_config_file(".config");
	setup_pci(card_id);
	should_soft_trigger = true;
	readout_all_pending_data();
	//set_all_DACs_to(0);
	set_all_DACs_to_built_in_nominal_values();
	//setup_filenames_for_fiber();
	//open_files_for_output_and_read_N_events(total_number_of_quarter_events_to_read_per_fiber_channel);
	close_pci();

	return 0;
}
Example #8
0
int main(void) {
	unsigned long int total_number_of_quarter_events_to_read_per_fiber_channel = 0;

	parse_config_file(".config");
	setup_pci(card_id);
	should_soft_trigger = true;
	readout_all_pending_data();
	setup_filenames_for_fiber();
//	setup_to_catch_ctrl_c(close_all_files);
//	open_logfile();
//	open_files_for_all_enabled_fiber_channels();

	send_command_packet_to_all_enabled_channels(0xeeeee01a, 0x0000077b); // set trigger thresholds for all channels

//	close_all_fiber_files();
	close_pci();

	return 0;
}
Example #9
0
static void extract_e820(void)
{
	int id = fw_cfg_file_id("etc/e820");
	uint32_t size;
	int nr_map;
	int i;

	if (id == -1)
		panic();

	size = fw_cfg_file_size(id);
	nr_map = size / sizeof(e820->map[0]) + 4;
	fw_cfg_file_select(id);

	e820 = malloc(offsetof(struct e820map, map[nr_map]));
	e820->nr_map = nr_map;
	e820->map[0] = (struct e820entry)
		{ .addr = 0, .size = 639 * 1024, .type = E820_RAM }; /* low RAM */
	e820->map[1] = (struct e820entry)
		{ .addr = 639 * 1024, .size = 1024, .type = E820_RESERVED }; /* EBDA */
	e820->map[2] = (struct e820entry)
		{ .addr = 0xd0000, .size = 128 * 1024, .type = E820_NVS }; /* ACPI tables */
	e820->map[3] = (struct e820entry)
		{ .addr = 0xf0000, .size = 64 * 1024, .type = E820_RESERVED }; /* firmware */
	fw_cfg_read(&e820->map[4], size);
	for (i = 4; i < e820->nr_map; i++)
		if (e820->map[i].addr == 0) {
			lowmem = e820->map[i].size;
			e820->map[i].addr = 1024 * 1024;
			e820->map[i].size -= 1024 * 1024;
			break;
		}

	e820_seg = ((uintptr_t) e820) >> 4;
}

static bool detect_cbfs_and_boot(void)
{
	size_t sz;
	void *base = pflash_base(1, &sz);

	if (!base)
		return false;

	return boot_from_cbfs(base, sz);
}

int main(void)
{
	setup_hw();

	// Now go to the F-segment: we need to move away from flash area
	// in order to probe CBFS!
	asm("ljmp $0x8, $1f; 1:");

	setup_pci();
	setup_idt();
	fw_cfg_setup();
	extract_acpi();
	extract_e820();
	// extract_smbios();
	if (!detect_cbfs_and_boot())
		boot_from_fwcfg();
	panic();
}
Example #10
0
void main(void)
{
	setup_serial();
	setup_acpi();
	setup_pci();
}