Exemple #1
0
static
int pri_list_track_cb (pri_img_t *img, pri_trk_t *trk, unsigned long c, unsigned long h, void *opaque)
{
	unsigned   i;
	double     rpm;
	pri_evt_t  *evt;
	const char *str;

	if ((trk->clock > 0) && (trk->size > 0)) {
		rpm = (60.0 * trk->clock) / trk->size;
	}
	else {
		rpm = 0.0;
	}

	printf ("%2lu/%lu: CLK: %lu  BITS: %lu  RPM: %.4f\n",
		c, h,
		pri_trk_get_clock (trk),
		pri_trk_get_size (trk),
		rpm
	);

	if (par_list_long) {
		evt = trk->evt;

		i = 0;

		while (evt != NULL) {
			switch (evt->type) {
			case PRI_EVENT_FUZZY:
				str = "FUZZY";
				break;

			case PRI_EVENT_CLOCK:
				str = "CLOCK";
				break;

			default:
				str = "UNK";
				break;
			}

			printf ("\t%u: EVT(%lu): %-6s %6lu  0x%08lx\n",
				i, evt->type, str, evt->pos, evt->val
			);

			i += 1;
			evt = evt->next;
		}
	}

	return (0);
}
Exemple #2
0
static
int pri_list_track_cb (pri_img_t *img, pri_trk_t *trk, unsigned long c, unsigned long h, void *opaque)
{
	double rpm;

	if ((trk->clock > 0) && (trk->size > 0)) {
		rpm = (60.0 * trk->clock) / trk->size;
	}
	else {
		rpm = 0.0;
	}

	printf ("%2lu/%lu: CLK: %lu  BITS: %lu  RPM: %.4f\n",
		c, h,
		pri_trk_get_clock (trk),
		pri_trk_get_size (trk),
		rpm
	);

	return (0);
}
Exemple #3
0
static
int pri_print_info (pri_img_t *img)
{
	unsigned long c, h, cn, hn, tn;
	unsigned long h1, h2;
	unsigned long len;
	unsigned long clk, clk1, clk2;
	double        rpm, rpm1, rpm2;
	pri_cyl_t     *cyl;
	pri_trk_t     *trk;

	cn = pri_img_get_cyl_cnt (img);
	tn = 0;

	h1 = 0;
	h2 = 0;

	clk1 = 0;
	clk2 = 0;

	rpm1 = 0.0;
	rpm2 = 0.0;

	for (c = 0; c < cn; c++) {
		cyl = pri_img_get_cylinder (img, c, 0);

		if (cyl == NULL) {
			hn = 0;
		}
		else {
			hn = pri_cyl_get_trk_cnt (cyl);
		}

		h1 = ((c == 0) || (hn < h1)) ? hn : h1;
		h2 = ((c == 0) || (hn > h2)) ? hn : h2;

		if (cyl == NULL) {
			continue;
		}

		for (h = 0; h < hn; h++) {
			trk = pri_cyl_get_track (cyl, h, 0);

			if (trk == NULL) {
				clk = 0;
				len = 0;
			}
			else {
				clk = pri_trk_get_clock (trk);
				len = pri_trk_get_size (trk);
			}

			if (len > 0) {
				rpm = (60.0 * clk) / len;
			}
			else {
				rpm = 0.0;
			}

			clk1 = ((tn == 0) || (clk < clk1)) ? clk : clk1;
			clk2 = ((tn == 0) || (clk > clk2)) ? clk : clk2;

			rpm1 = ((tn == 0) || (rpm < rpm1)) ? rpm : rpm1;
			rpm2 = ((tn == 0) || (rpm > rpm2)) ? rpm : rpm2;

			tn += 1;
		}
	}

	printf ("cylinders: %lu\n", cn);
	pri_print_range ("heads:     ", h1, h2, "\n");
	printf ("tracks:    %lu\n", tn);
	pri_print_range ("clock:     ", clk1, clk2, "\n");
	pri_print_range_float ("rpm:       ", rpm1, rpm2, "\n");

	if (img->comment_size > 0) {
		fputs ("\n", stdout);
		pri_comment_show (img);
	}

	return (0);
}