Unify checksum functions.
[seabios.git] / src / util.c
index b9d641fc3c2607c9ee733502bff323756c8e037a..98bafa9ad2efae62ffc9804ea02f250bca93f7a3 100644 (file)
@@ -1,5 +1,16 @@
 #include "util.h" // usleep
 
+// Sum the bytes in the specified area.
+u8
+checksum(u8 *far_data, u32 len)
+{
+    u32 i;
+    u8 sum = 0;
+    for (i=0; i<len; i++)
+        sum += GET_FARPTR(far_data[i]);
+    return sum;
+}
+
 // Sleep for n microseconds. currently using the
 // refresh request port 0x61 bit4, toggling every 15usec
 void