[SeaBIOS] [PATCH 07/10] Rename check_timer() function (and similar) to irqtimer_check().

Kevin O'Connor kevin at koconnor.net
Sun Jul 21 01:50:09 CEST 2013


Rename functions to be more consistent and so they are not confused
with the normal timer functions.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/boot.c   |  4 ++--
 src/serial.c | 12 ++++++------
 src/timer.c  |  8 ++++----
 src/util.c   |  4 ++--
 src/util.h   |  6 +++---
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/boot.c b/src/boot.c
index 2fce315..d421a65 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -635,9 +635,9 @@ boot_fail(void)
         printf("No bootable device.  Retrying in %d seconds.\n"
                , BootRetryTime/1000);
     // Wait for 'BootRetryTime' milliseconds and then reboot.
-    u32 end = calc_future_timer(BootRetryTime);
+    u32 end = irqtimer_calc(BootRetryTime);
     for (;;) {
-        if (BootRetryTime != (u32)-1 && check_timer(end))
+        if (BootRetryTime != (u32)-1 && irqtimer_check(end))
             break;
         yield_toirq();
     }
diff --git a/src/serial.c b/src/serial.c
index 153f82a..b4a0a53 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -91,7 +91,7 @@ handle_1401(struct bregs *regs)
     u16 addr = getComAddr(regs);
     if (!addr)
         return;
-    u32 end = calc_future_timer_ticks(GET_BDA(com_timeout[regs->dx]));
+    u32 end = irqtimer_calc_ticks(GET_BDA(com_timeout[regs->dx]));
     for (;;) {
         u8 lsr = inb(addr+SEROFF_LSR);
         if ((lsr & 0x60) == 0x60) {
@@ -101,7 +101,7 @@ handle_1401(struct bregs *regs)
             regs->ah = lsr;
             break;
         }
-        if (check_timer(end)) {
+        if (irqtimer_check(end)) {
             // Timed out - can't write data.
             regs->ah = lsr | 0x80;
             break;
@@ -118,7 +118,7 @@ handle_1402(struct bregs *regs)
     u16 addr = getComAddr(regs);
     if (!addr)
         return;
-    u32 end = calc_future_timer_ticks(GET_BDA(com_timeout[regs->dx]));
+    u32 end = irqtimer_calc_ticks(GET_BDA(com_timeout[regs->dx]));
     for (;;) {
         u8 lsr = inb(addr+SEROFF_LSR);
         if (lsr & 0x01) {
@@ -127,7 +127,7 @@ handle_1402(struct bregs *regs)
             regs->ah = lsr;
             break;
         }
-        if (check_timer(end)) {
+        if (irqtimer_check(end)) {
             // Timed out - can't read data.
             regs->ah = lsr | 0x80;
             break;
@@ -234,7 +234,7 @@ handle_1700(struct bregs *regs)
     if (!addr)
         return;
 
-    u32 end = calc_future_timer_ticks(GET_BDA(lpt_timeout[regs->dx]));
+    u32 end = irqtimer_calc_ticks(GET_BDA(lpt_timeout[regs->dx]));
 
     outb(regs->al, addr);
     u8 val8 = inb(addr+2);
@@ -249,7 +249,7 @@ handle_1700(struct bregs *regs)
             regs->ah = v ^ 0x48;
             break;
         }
-        if (check_timer(end)) {
+        if (irqtimer_check(end)) {
             // Timeout
             regs->ah = (v ^ 0x48) | 0x01;
             break;
diff --git a/src/timer.c b/src/timer.c
index 7fa0610..4548abb 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -226,23 +226,23 @@ ticks_from_ms(u32 ms)
 // Calculate the timer value at 'count' number of full timer ticks in
 // the future.
 u32
-calc_future_timer_ticks(u32 count)
+irqtimer_calc_ticks(u32 count)
 {
     return (GET_BDA(timer_counter) + count + 1) % TICKS_PER_DAY;
 }
 
 // Return the timer value that is 'msecs' time in the future.
 u32
-calc_future_timer(u32 msecs)
+irqtimer_calc(u32 msecs)
 {
     if (!msecs)
         return GET_BDA(timer_counter);
-    return calc_future_timer_ticks(ticks_from_ms(msecs));
+    return irqtimer_calc_ticks(ticks_from_ms(msecs));
 }
 
 // Check if the given timer value has passed.
 int
-check_timer(u32 end)
+irqtimer_check(u32 end)
 {
     return (((GET_BDA(timer_counter) + TICKS_PER_DAY - end) % TICKS_PER_DAY)
             < (TICKS_PER_DAY/2));
diff --git a/src/util.c b/src/util.c
index ccf84b0..ffabd1c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -281,11 +281,11 @@ get_raw_keystroke(void)
 int
 get_keystroke(int msec)
 {
-    u32 end = calc_future_timer(msec);
+    u32 end = irqtimer_calc(msec);
     for (;;) {
         if (check_for_keystroke())
             return get_raw_keystroke();
-        if (check_timer(end))
+        if (irqtimer_check(end))
             return -1;
         yield_toirq();
     }
diff --git a/src/util.h b/src/util.h
index bc2fd00..10c2364 100644
--- a/src/util.h
+++ b/src/util.h
@@ -295,9 +295,9 @@ void usleep(u32 count);
 void msleep(u32 count);
 u32 calc_future_tsc(u32 msecs);
 u32 calc_future_tsc_usec(u32 usecs);
-u32 calc_future_timer_ticks(u32 count);
-u32 calc_future_timer(u32 msecs);
-int check_timer(u32 end);
+u32 irqtimer_calc_ticks(u32 count);
+u32 irqtimer_calc(u32 msecs);
+int irqtimer_check(u32 end);
 
 // apm.c
 void apm_shutdown(void);
-- 
1.7.11.7




More information about the SeaBIOS mailing list