Beispiel #1
0
int checkcpu(void)
{
	int cnt;
	char str[4];

	/* check LEON version here */
	cnt = ambapp_ahbmst_count(&ambapp_plb, VENDOR_GAISLER, GAISLER_LEON3);
	if (cnt <= 0) {
		cnt = ambapp_ahbmst_count(&ambapp_plb, VENDOR_GAISLER,
			GAISLER_LEON4);
		if (cnt > 0)
			leon_ver = 4;
	}

	cpu_freq();

	str[0] = '\0';
	if (cnt > 1) {
		leon_cpu_cnt = cnt;
		str[0] = '0' + cnt;
		str[1] = 'x';
		str[2] = '\0';
	}
	printf("CPU: %sLEON%d @ %dMHz\n", str, leon_ver,
		leon_cpu_freq / 1000000);

	return 0;
}
Beispiel #2
0
uint64_t OS::nanos_asleep() noexcept {
  return (PER_CPU(os_per_cpu).cycles_hlt * 1e6) / cpu_freq().count();
}