示例#1
0
文件: adb.c 项目: 12019/hg556a_source
void
adbcmds(void)
{
    char cmd;
    unsigned rtcu, rtcl, dec, pdec, x;
    int i, j;
    unsigned char d[64];

    cmd = skipbl();
    switch (cmd) {
    case 't':
	for (;;) {
	    rtcl = get_rtcl();
	    rtcu = get_rtcu();
	    dec = get_dec();
	    printf("rtc u=%u l=%u dec=%x (%d = %d.%.7d)\n",
		   rtcu, rtcl, dec, pdec - dec, (pdec - dec) / 1000000000,
		   ((pdec - dec) % 1000000000) / 100);
	    pdec = dec;
	    if (cmd == 'x')
		break;
	    while (xmon_read(stdin, &cmd, 1) != 1)
		;
	}
	break;
    case 'r':
	init_adb_log();
	while (adb_bitwait(8, 0, 0, 0) == 0)
	    adb_readin();
	break;
    case 'w':
	i = 0;
	while (scanhex(&x))
	    d[i++] = x;
	init_adb_log();
	j = adb_write(d, i);
	printf("sent %d bytes\n", j);
	while (adb_bitwait(8, 0, 0, 0) == 0)
	    adb_readin();
	break;
    case 'l':
	dump_adb_log();
	break;
    }
}
示例#2
0
	 * some might have been forgotten in the test however.
	 */
	err = inscale*(mlt+1);
	if (err <= inscale/2) mlt++;
	return mlt;
}

unsigned long long sched_clock(void)
{
	unsigned long lo, hi, hi2;
	unsigned long long tb;

	if (!__USE_RTC()) {
		do {
			hi = get_tbu();
			lo = get_tbl();
			hi2 = get_tbu();
		} while (hi2 != hi);
		tb = ((unsigned long long) hi << 32) | lo;
		tb = (tb * tb_to_ns_scale) >> 10;
	} else {
		do {
			hi = get_rtcu();
			lo = get_rtcl();
			hi2 = get_rtcu();
		} while (hi2 != hi);
		tb = ((unsigned long long) hi) * 1000000000 + lo;
	}
	return tb;
}