*/
#include <common.h>
+#include <div64.h>
DECLARE_GLOBAL_DATA_PTR;
total_count += lastdec - now;
}
lastdec = now;
- timestamp = (ulong)(total_count/div_timer);
+
+ /* Reuse "now" */
+ now = total_count;
+ do_div(now, div_timer);
+ timestamp = now;
return timestamp;
}
#include <common.h>
#include <s3c2400.h>
+#include <div64.h>
#include "tsc2000.h"
#include "Pt1000_temp_data.h"
int tsc2000_interpolate(long value, long data[][2], long *result)
{
int i;
+ unsigned long long val;
/* the data is sorted and the first element is upper
* limit so we can easily check for out-of-band values
result in 'long long'.
*/
- *result = data[i-1][1] +
- ((unsigned long long)(data[i][1] - data[i-1][1])
- * (unsigned long long)(value - data[i-1][0]))
- / (data[i][0] - data[i-1][0]);
+ val = ((unsigned long long)(data[i][1] - data[i-1][1])
+ * (unsigned long long)(value - data[i-1][0]));
+ do_div(val, (data[i][0] - data[i-1][0]));
+ *result = data[i-1][1] + val;
return 0;
}
#include <common.h>
#include <asm/proc-armv/ptrace.h>
#include <s3c6400.h>
+#include <div64.h>
static ulong timer_load_val;
ulong get_timer_masked(void)
{
- return get_ticks() / (timer_load_val / (100 * CFG_HZ));
+ unsigned long long res = get_ticks();
+ do_div (res, (timer_load_val / (100 * CFG_HZ)));
+ return res;
}
ulong get_timer(ulong base)