* Two more uses for the pause instruction I apparently forgot to commit

* Minor style cleanup in the conversion factor calculation

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23217 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2008-01-02 02:10:55 +00:00
parent e812c77e4a
commit 1df628fe2f
2 changed files with 7 additions and 7 deletions

View File

@ -59,7 +59,7 @@ quick_sample:
out8(0x00, 0x43); /* latch counter value */ out8(0x00, 0x43); /* latch counter value */
s_low = in8(0x40); s_low = in8(0x40);
s_high = in8(0x40); s_high = in8(0x40);
} while(s_high != 255); } while (s_high != 255);
t1 = rdtsc(); t1 = rdtsc();
do { do {
out8(0x00, 0x43); /* latch counter value */ out8(0x00, 0x43); /* latch counter value */
@ -77,13 +77,13 @@ not_so_quick_sample:
out8(0x00, 0x43); /* latch counter value */ out8(0x00, 0x43); /* latch counter value */
s_low = in8(0x40); s_low = in8(0x40);
s_high = in8(0x40); s_high = in8(0x40);
} while (s_high!= 255); } while (s_high != 255);
t1 = rdtsc(); t1 = rdtsc();
do { do {
out8(0x00, 0x43); /* latch counter value */ out8(0x00, 0x43); /* latch counter value */
low = in8(0x40); low = in8(0x40);
high = in8(0x40); high = in8(0x40);
} while (high> 192); } while (high > 192);
t2 = rdtsc(); t2 = rdtsc();
p2 = t2-t1; p2 = t2-t1;
r2 = (double)(p2) / (double)(((s_high << 8) | s_low) - ((high << 8) | low)); r2 = (double)(p2) / (double)(((s_high << 8) | s_low) - ((high << 8) | low));
@ -101,7 +101,7 @@ not_so_quick_sample:
out8(0x00, 0x43); /* latch counter value */ out8(0x00, 0x43); /* latch counter value */
s_low = in8(0x40); s_low = in8(0x40);
s_high = in8(0x40); s_high = in8(0x40);
} while (s_high!= 255); } while (s_high != 255);
t1 = rdtsc(); t1 = rdtsc();
do { do {
out8(0x00, 0x43); /* latch counter value */ out8(0x00, 0x43); /* latch counter value */
@ -246,8 +246,8 @@ spin(bigtime_t microseconds)
{ {
bigtime_t time = system_time(); bigtime_t time = system_time();
while((system_time() - time) < microseconds) while ((system_time() - time) < microseconds)
; asm volatile ("pause;");
} }

View File

@ -43,7 +43,7 @@ serial_putc(char c)
{ {
// wait until the transmitter empty bit is set // wait until the transmitter empty bit is set
while ((in8(sSerialBasePort + SERIAL_LINE_STATUS) & 0x20) == 0) while ((in8(sSerialBasePort + SERIAL_LINE_STATUS) & 0x20) == 0)
; asm volatile ("pause;");
out8(c, sSerialBasePort + SERIAL_TRANSMIT_BUFFER); out8(c, sSerialBasePort + SERIAL_TRANSMIT_BUFFER);
} }