Commit 2653d891 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

Moved timer functions to timer.h (always included from dryos.h)

Renamed get_ms_clock_value / get_us_clock_value to get_ms_clock / get_us_clock
Replaced all hardcoded references to 0xC0242014 with GET_DIGIC_TIMER()
```
find . -not -path '*/\.*' -type f -name '*.c' -o -name '*.h' -exec sed -i 's/get_ms_clock_value/get_ms_clock/g' {} +
find . -not -path '*/\.*' -type f -name '*.c' -o -name '*.h' -exec sed -i 's/get_us_clock_value/get_us_clock/g' {} +
sed -i 's/\*(volatile uint32_t \*)0xC0242014/GET_DIGIC_TIMER()/' */*.c
...
```

--HG--
branch : lua_fix
parent 7cdf3152f685
......@@ -197,7 +197,7 @@ void clrscr()
/* dummy stubs to include raw.c */
int get_ms_clock_value()
int get_ms_clock()
{
static int ms = 0;
ms += 10;
......
......@@ -19,7 +19,7 @@ static void card_benchmark_wr(int bufsize, int K, int N)
FILE* f = FIO_CreateFile(CARD_BENCHMARK_FILE);
if (f)
{
int t0 = get_ms_clock_value();
int t0 = get_ms_clock();
int i;
for (i = 0; i < n; i++)
{
......@@ -28,7 +28,7 @@ static void card_benchmark_wr(int bufsize, int K, int N)
FIO_WriteFile( f, (const void *) start, bufsize );
}
FIO_CloseFile(f);
int t1 = get_ms_clock_value();
int t1 = get_ms_clock();
int speed = filesize * 1000 * 10 / (t1 - t0);
bmp_printf(FONT_MONO_20, x, y += 20, "Write speed (buffer=%dk):\t %d.%d MB/s\n", bufsize/1024, speed/10, speed % 10);
}
......@@ -40,7 +40,7 @@ static void card_benchmark_wr(int bufsize, int K, int N)
if (buf)
{
FILE* f = FIO_OpenFile(CARD_BENCHMARK_FILE, O_RDONLY | O_SYNC);
int t0 = get_ms_clock_value();
int t0 = get_ms_clock();
int i;
for (i = 0; i < n; i++)
{
......@@ -49,7 +49,7 @@ static void card_benchmark_wr(int bufsize, int K, int N)
}
FIO_CloseFile(f);
fio_free(buf);
int t1 = get_ms_clock_value();
int t1 = get_ms_clock();
int speed = filesize * 1000 * 10 / (t1 - t0);
bmp_printf(FONT_MONO_20, x, y += 20, "Read speed (buffer=%dk):\t %d.%d MB/s\n", bufsize/1024, speed/10, speed % 10);
}
......@@ -138,7 +138,7 @@ static volatile int twocard_done = 0;
static void twocard_write_task(char* filename)
{
int bufsize = twocard_bufsize;
int t0 = get_ms_clock_value();
int t0 = get_ms_clock();
int cf = filename[0] == 'A';
int msg;
int filesize = 0;
......@@ -155,7 +155,7 @@ static void twocard_write_task(char* filename)
}
FIO_CloseFile(f);
FIO_RemoveFile(filename);
int t1 = get_ms_clock_value() - 1000;
int t1 = get_ms_clock() - 1000;
int speed = filesize * 1000 * 10 / (t1 - t0);
bmp_printf(FONT_MONO_20, 0, 120+cf*20, "[%s] Write speed (buffer=%dk):\t %d.%d MB/s\n", cf ? "CF" : "SD", bufsize/1024, speed/10, speed % 10);
}
......@@ -243,7 +243,7 @@ static void card_bufsize_benchmark_task()
FILE* f = FIO_CreateFile(CARD_BENCHMARK_FILE);
if (!f) goto cleanup;
int t0 = get_ms_clock_value();
int t0 = get_ms_clock();
int total = 0;
for (uint32_t i = 0; i < n; i++)
{
......@@ -255,7 +255,7 @@ static void card_bufsize_benchmark_task()
}
FIO_CloseFile(f);
int t1 = get_ms_clock_value();
int t1 = get_ms_clock();
int speed = total / 1024 * 1000 / 1024 * 10 / (t1 - t0);
bmp_printf(FONT_MONO_20, x, y += 20, "Write speed (buffer=%dk):\t %d.%d MB/s\n", bufsize/1024, speed/10, speed % 10);
if (y > 450) y = 100;
......
......@@ -77,8 +77,8 @@ static void mem_benchmark_run(char* msg, int* y, int bufsize, mem_bench_fun benc
msleep(200);
int times = 0;
int t0m = get_ms_clock_value();
int64_t t0 = get_us_clock_value();
int t0m = get_ms_clock();
int64_t t0 = get_us_clock();
for (int i = 0; i < INT_MAX; i++)
{
if (i%2) info_led_off(); else info_led_on();
......@@ -86,13 +86,13 @@ static void mem_benchmark_run(char* msg, int* y, int bufsize, mem_bench_fun benc
bench_fun(arg0, arg1, arg2, arg3);
/* run the benchmark for roughly 1 second */
if (get_ms_clock_value() - t0m > 1000)
if (get_ms_clock() - t0m > 1000)
{
times = i + 1;
break;
}
}
int64_t t1 = get_us_clock_value();
int64_t t1 = get_us_clock();
int64_t dt = t1 - t0;
info_led_off();
......
......@@ -46,7 +46,7 @@ static float mem_perf_run(uint32_t block_size, uint32_t address)
{
uint64_t runtime = 0;
uint32_t wall_time = 0;
uint32_t wall_start = get_ms_clock_value();
uint32_t wall_start = get_ms_clock();
uint32_t loops = 1024;
uint32_t outer_loops = 0;
......@@ -61,15 +61,15 @@ static float mem_perf_run(uint32_t block_size, uint32_t address)
mem_perf_asm_128(address, block_size, 16);
/* run measurement */
uint64_t runtime_start = get_us_clock_value();
uint64_t runtime_start = get_us_clock();
mem_perf_asm_128(address, block_size, loops);
uint64_t runtime_stop = get_us_clock_value();
uint64_t runtime_stop = get_us_clock();
sei(old_int);
outer_loops++;
runtime += (runtime_stop - runtime_start);
wall_time = get_ms_clock_value() - wall_start;
wall_time = get_ms_clock() - wall_start;
}
float megabytes = (float)outer_loops * (float)block_size / 1000000.0f;
......
......@@ -141,7 +141,7 @@ static unsigned int bulb_nd_shoot_cbr()
bmp_printf(FONT_LARGE, 50, 50, "Attach ND filter and hold SET/Joystick");
}
if (set_pressed && job_state_ready_to_take_pic() && get_ms_clock_value() - set_pressed > 1000)
if (set_pressed && job_state_ready_to_take_pic() && get_ms_clock() - set_pressed > 1000)
{
beep();
info_led_blink(1,50,50); // short blink so you know bulb timer was triggered
......@@ -191,7 +191,7 @@ static unsigned int bulb_nd_keypress_cbr(unsigned int key)
if((key == MODULE_KEY_PRESS_SET) ||
(key == MODULE_KEY_JOY_CENTER) )
{
set_pressed = get_ms_clock_value();
set_pressed = get_ms_clock();
return 0;
}
else if((key == MODULE_KEY_UNPRESS_SET) ||
......
......@@ -564,7 +564,7 @@ static int edmac_extra_index = 0;
static void FAST edmac_spy_poll(int last_expiry, void* unused)
{
uint32_t start_clock = MEM(0xC0242014);
uint32_t start_clock = GET_DIGIC_TIMER();
if (edmac_index >= COUNT(edmac_states))
{
......@@ -626,7 +626,7 @@ static void FAST edmac_spy_poll(int last_expiry, void* unused)
*/
edmac_states[edmac_index][CLK_IDX] = start_clock;
edmac_states[edmac_index][TSK_IDX] = (uint32_t) current_task->name;
edmac_states[edmac_index][OVH_IDX] = MEM(0xC0242014) - start_clock;
edmac_states[edmac_index][OVH_IDX] = GET_DIGIC_TIMER() - start_clock;
edmac_states[edmac_index][XTR_IDX] = edmac_extra_index;
edmac_index++;
}
......
......@@ -69,14 +69,14 @@ static void edmac_test_copy(
/* start transfer. no flags for write, 2 for read channels */
info_led_on();
int64_t t0 = get_us_clock_value();
int64_t t0 = get_us_clock();
StartEDmac(edmac_write_chan, dst_start_flags);
StartEDmac(edmac_read_chan, src_start_flags);
while(!read_done || !write_done)
{
if (get_us_clock_value() - t0 > 200000)
if (get_us_clock() - t0 > 200000)
{
if(!read_done)
{
......@@ -96,7 +96,7 @@ static void edmac_test_copy(
AbortEDmac(edmac_read_chan);
AbortEDmac(edmac_write_chan);
int64_t t1 = get_us_clock_value();
int64_t t1 = get_us_clock();
info_led_off();
if (show_elapsed)
......
......@@ -242,7 +242,7 @@ static bool ordered_file_entries(struct file_entry *a, struct file_entry *b)
static void build_file_menu()
{
int start_time = get_ms_clock_value();
int start_time = get_ms_clock();
// Mergesort on a linked list
// e.g., http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
......@@ -314,7 +314,7 @@ static void build_file_menu()
length *= 2;
} while ((nmerges > 1) && (get_ms_clock_value() - start_time < 3000)); // Allows 3 seconds for the Mergesort
} while ((nmerges > 1) && (get_ms_clock() - start_time < 3000)); // Allows 3 seconds for the Mergesort
file_entries = list;
......@@ -783,7 +783,7 @@ MFILE_SEM (
if (!delete_confirm_flag)
{
delete_confirm_flag = get_ms_clock_value();
delete_confirm_flag = get_ms_clock();
beep();
}
else
......@@ -812,7 +812,7 @@ static MENU_UPDATE_FUNC(delete_confirm)
update_action(entry, info);
/* delete confirmation timeout after 2 seconds */
if (get_ms_clock_value() > delete_confirm_flag + 2000)
if (get_ms_clock() > delete_confirm_flag + 2000)
delete_confirm_flag = 0;
/* no question mark in in our font, fsck! */
......@@ -1177,7 +1177,7 @@ static MENU_UPDATE_FUNC(update_file)
if (entry->selected && view_file)
{
static int last_updated = 0;
int t = get_ms_clock_value();
int t = get_ms_clock();
if (t - last_updated > 1000) dirty = 1;
static char prev_filename[MAX_PATH_LEN];
......@@ -1212,7 +1212,7 @@ static MENU_UPDATE_FUNC(update_file)
/* nothing changed, keep previous screen */
info->custom_drawing = CUSTOM_DRAW_DO_NOT_DRAW;
}
last_updated = get_ms_clock_value();
last_updated = get_ms_clock();
}
}
......
......@@ -718,29 +718,29 @@ static void iocrypt_speed_test()
uint32_t delta = 0;
uint32_t speed = 0;
start = get_ms_clock_value();
start = get_ms_clock();
iocrypt_speed_test_write("IO_CRYPT.CR2", blocksize, blocks);
delta = get_ms_clock_value() - start;
delta = get_ms_clock() - start;
speed = (blocksize / 1024) * blocks * 1000 * 10 / delta;
trace_write(iocrypt_trace_ctx, "iocrypt_speed_test: [crypted] write %d ms, %d.%02d MB/s", delta, speed/10, speed % 10);
bmp_printf(FONT_MED, 10, 60 + (4 * loop + 0) * font_med.height, "[crypted] write %d.%02d MB/s ", speed/10, speed % 10);
start = get_ms_clock_value();
start = get_ms_clock();
iocrypt_speed_test_read("IO_CRYPT.CR2", blocksize);
delta = get_ms_clock_value() - start;
delta = get_ms_clock() - start;
speed = (blocksize / 1024) * blocks * 1000 * 10 / delta;
trace_write(iocrypt_trace_ctx, "iocrypt_speed_test: [crypted] read %d ms, %d.%02d MB/s", delta, speed/10, speed % 10);
bmp_printf(FONT_MED, 10, 60 + (4 * loop + 1) * font_med.height, "[crypted] read %d.%02d MB/s ", speed/10, speed % 10);
start = get_ms_clock_value();
start = get_ms_clock();
iocrypt_speed_test_write("IO_CRYPT.DAT", blocksize, blocks);
delta = get_ms_clock_value() - start;
delta = get_ms_clock() - start;
speed = (blocksize / 1024) * blocks * 1000 * 10 / delta;
trace_write(iocrypt_trace_ctx, "iocrypt_speed_test: [plain] write %d ms, %d.%02d MB/s", delta, speed/10, speed % 10);
bmp_printf(FONT_MED, 10, 60 + (4 * loop + 2) * font_med.height, "[plain] write %d.%02d MB/s ", speed/10, speed % 10);
start = get_ms_clock_value();
start = get_ms_clock();
iocrypt_speed_test_read("IO_CRYPT.DAT", blocksize);
delta = get_ms_clock_value() - start;
delta = get_ms_clock() - start;
speed = (blocksize / 1024) * blocks * 1000 * 10 / delta;
trace_write(iocrypt_trace_ctx, "iocrypt_speed_test: [plain] read %d ms, %d.%02d MB/s", delta, speed/10, speed % 10);
bmp_printf(FONT_MED, 10, 60 + (4 * loop + 3) * font_med.height, "[plain] read %d.%02d MB/s ", speed/10, speed % 10);
......
......@@ -198,7 +198,7 @@ static int luaCB_dryos_index(lua_State * L)
if(!strcmp(key, "clock")) lua_pushinteger(L, get_seconds_clock());
/// Get the number of milliseconds since camera startup.
// @tfield int ms_clock
else if(!strcmp(key, "ms_clock")) lua_pushinteger(L, get_ms_clock_value());
else if(!strcmp(key, "ms_clock")) lua_pushinteger(L, get_ms_clock());
/// Get/Set the image filename prefix (e.g.&nbsp;"IMG_").
///
/// Set to empty string to restore default value.
......
......@@ -127,9 +127,9 @@ static int luaCB_lens_focus(lua_State * L)
static int wait_focus_status(int timeout, int value1, int value2)
{
int t0 = get_ms_clock_value();
int t0 = get_ms_clock();
while (get_ms_clock_value() - t0 < timeout)
while (get_ms_clock() - t0 < timeout)
{
msleep(10);
......
......@@ -636,7 +636,7 @@ void lv_rec_start()
bmp_printf( FONT(FONT_MED, COLOR_WHITE, COLOR_BLACK), 30, 20 * yPos++, "Ready, waiting for first frame");
int wait_loops = 0;
int t0 = get_ms_clock_value();
int t0 = get_ms_clock();
while(!data.finished || (lv_rec_ring_mode && (data.capturedFrames > data.savedFrames)))
{
if(lv_rec_ring_mode)
......@@ -729,7 +729,7 @@ void lv_rec_start()
{
msleep(200);
}
int t1 = get_ms_clock_value();
int t1 = get_ms_clock();
int speed = (save_data.handleWritten / 1024) * 10 / (t1 - t0) * 1000 / 1024; // MB/s x10
bmp_printf( FONT(FONT_MED, COLOR_WHITE, COLOR_BLACK), 30, 20 * yPos,
"%s, %d buffered, %d saved, %d.%d MB/s ",
......
......@@ -1704,11 +1704,11 @@ static int write_frames(FILE** pf, void* ptr, int size_used, int num_frames)
}
}
int t0 = get_ms_clock_value();
int t0 = get_ms_clock();
if (!last_write_timestamp) last_write_timestamp = t0;
idle_time += t0 - last_write_timestamp;
int r = FIO_WriteFile(f, ptr, size_used);
last_write_timestamp = get_ms_clock_value();
last_write_timestamp = get_ms_clock();
if (r != size_used) /* 4GB limit or card full? */
{
......@@ -2385,7 +2385,7 @@ static int raw_rec_should_preview(void)
{
autofocusing = 0;
long_halfshutter_press = 0;
last_hs_unpress = get_ms_clock_value();
last_hs_unpress = get_ms_clock();
}
else
{
......@@ -2393,7 +2393,7 @@ static int raw_rec_should_preview(void)
{
autofocusing = 1;
}
if (get_ms_clock_value() - last_hs_unpress > 500)
if (get_ms_clock() - last_hs_unpress > 500)
{
long_halfshutter_press = 1;
}
......
......@@ -567,7 +567,7 @@ static void mlv_play_osd_delete(char *msg, uint32_t msg_len, uint32_t selected)
if(!mlv_play_osd_delete_selected || selected == 2)
{
mlv_play_osd_force_redraw = 1;
mlv_play_osd_delete_selected = get_ms_clock_value();
mlv_play_osd_delete_selected = get_ms_clock();
}
else
{
......@@ -579,7 +579,7 @@ static void mlv_play_osd_delete(char *msg, uint32_t msg_len, uint32_t selected)
if(msg)
{
uint32_t time_passed = get_ms_clock_value() - mlv_play_osd_delete_selected;
uint32_t time_passed = get_ms_clock() - mlv_play_osd_delete_selected;
uint32_t seconds = (max_time - time_passed) / 1000;
if(mlv_play_osd_delete_selected && seconds > 0)
......@@ -739,24 +739,24 @@ static void mlv_play_osd_act(void *handler)
static void mlv_play_osd_task(void *priv)
{
uint32_t next_render_time = get_ms_clock_value() + mlv_play_render_timestep;
uint32_t next_render_time = get_ms_clock() + mlv_play_render_timestep;
mlv_play_osd_state = MLV_PLAY_MENU_IDLE;
mlv_play_osd_item = 1;
mlv_play_paused = 0;
uint32_t last_keypress_time = get_ms_clock_value();
uint32_t last_keypress_time = get_ms_clock();
TASK_LOOP
{
uint32_t key;
uint32_t timeout = next_render_time - get_ms_clock_value();
uint32_t timeout = next_render_time - get_ms_clock();
timeout = MIN(timeout, mlv_play_idle_timestep);
if(!msg_queue_receive(mlv_play_queue_osd, &key, timeout))
{
/* there was a keypress */
last_keypress_time = get_ms_clock_value();
last_keypress_time = get_ms_clock();
/* no matter which state - these are handled */
switch(key)
......@@ -863,7 +863,7 @@ static void mlv_play_osd_task(void *priv)
}
}
}
uint32_t idle_time = get_ms_clock_value() - last_keypress_time;
uint32_t idle_time = get_ms_clock() - last_keypress_time;
if(mlv_play_render_abort)
{
......@@ -872,11 +872,11 @@ static void mlv_play_osd_task(void *priv)
if(mlv_play_osd_draw())
{
next_render_time = get_ms_clock_value() + mlv_play_render_timestep;
next_render_time = get_ms_clock() + mlv_play_render_timestep;
}
else
{
next_render_time = get_ms_clock_value() + mlv_play_idle_timestep;
next_render_time = get_ms_clock() + mlv_play_idle_timestep;
/* when redrawing is forced, keep OSD shown */
if(mlv_play_osd_force_redraw)
......
......@@ -33,7 +33,7 @@
extern uint32_t raw_rec_trace_ctx;
extern uint64_t get_us_clock_value();
extern uint64_t get_us_clock();
extern char *strcpy(char *dest, const char *src);
extern char *strncpy(char *dest, const char *src, int n);
extern const char* get_picstyle_name(int raw_picstyle);
......@@ -191,7 +191,7 @@ uint64_t mlv_prng_lfsr(uint64_t value)
uint64_t mlv_generate_guid()
{
struct tm now;
uint64_t guid = get_us_clock_value();
uint64_t guid = get_us_clock();
LoadCalendarFromRTC(&now);
/* now run through prng once to shuffle bits */
......@@ -203,7 +203,7 @@ uint64_t mlv_generate_guid()
guid ^= now.tm_hour << 12;
guid ^= now.tm_yday << 17;
guid ^= now.tm_year << 26;
guid ^= get_us_clock_value() << 37;
guid ^= get_us_clock() << 37;
/* now run through final prng pass */
return mlv_prng_lfsr(guid);
......@@ -223,7 +223,7 @@ void mlv_set_type(mlv_hdr_t *hdr, char *type)
uint64_t mlv_set_timestamp(mlv_hdr_t *hdr, uint64_t start)
{
uint64_t timestamp = get_us_clock_value();
uint64_t timestamp = get_us_clock();
if(hdr)
{
......
......@@ -2141,7 +2141,7 @@ static void mlv_rec_dma_cbr_r(void *ctx)
slots[capture_slot].status = SLOT_FULL;
mlv_rec_dma_active = 0;
mlv_rec_dma_end = get_us_clock_value();
mlv_rec_dma_end = get_us_clock();
mlv_rec_dma_duration = (uint32_t)(mlv_rec_dma_end - mlv_rec_dma_start);
edmac_copy_rectangle_adv_cleanup();
......@@ -2198,7 +2198,7 @@ static int32_t FAST process_frame()
mlv_rec_dma_active = 1;
edmac_copy_rectangle_cbr_start(ptr, raw_info.buffer, raw_info.pitch, (skip_x+7)/8*14, skip_y/2*2, res_x*14/8, 0, 0, res_x*14/8, res_y, &mlv_rec_dma_cbr_r, &mlv_rec_dma_cbr_w, NULL);
mlv_rec_dma_start = get_us_clock_value();
mlv_rec_dma_start = get_us_clock();
/* copy current frame to our buffer and crop it to its final size */
slots[capture_slot].frame_number = frame_count;
......@@ -2806,10 +2806,10 @@ static void raw_writer_task(uint32_t writer)
/* start write and measure times */
job->last_time_after = last_time_after;
job->time_before = get_us_clock_value();
job->time_before = get_us_clock();
job->file_offset = FIO_SeekSkipFile(f, 0, SEEK_CUR);
int32_t written = FIO_WriteFile(f, job->block_ptr, job->block_size);
job->time_after = get_us_clock_value();
job->time_after = get_us_clock();
last_time_after = job->time_after;
......
......@@ -53,7 +53,7 @@ extern WEAK_FUNC(ret_0) int SetAudioVolumeOut(uint32_t);
extern WEAK_FUNC(ret_0) int SoundDevActiveIn(uint32_t);
extern WEAK_FUNC(ret_0) int SoundDevShutDownIn();
extern void SetSamplingRate(int sample_rate, int channels);
extern uint64_t get_us_clock_value();
extern uint64_t get_us_clock();
extern void mlv_rec_get_slot_info(int32_t slot, uint32_t *size, void **address);
extern int32_t mlv_rec_get_free_slot();
......@@ -119,7 +119,7 @@ static void mlv_snd_asif_in_cbr()
/* the next buffer is now being filled, so update timestamp. do this first to be closer to real start. */
if(mlv_snd_next_buffer)
{
mlv_snd_next_buffer->timestamp = get_us_clock_value();
mlv_snd_next_buffer->timestamp = get_us_clock();
}
/* and pass the filled buffer into done queue */
......@@ -448,7 +448,7 @@ static void mlv_snd_queue_wavi()
mlv_set_type((mlv_hdr_t*)hdr, "WAVI");
hdr->blockSize = sizeof(mlv_wavi_hdr_t);
mlv_rec_set_rel_timestamp((mlv_hdr_t*)hdr, get_us_clock_value());
mlv_rec_set_rel_timestamp((mlv_hdr_t*)hdr, get_us_clock());
/* this part is compatible to RIFF WAVE/fmt header */
hdr->format = 1;
......@@ -564,7 +564,7 @@ static unsigned int mlv_snd_vsync(unsigned int unused)
StartASIFDMAADC(mlv_snd_current_buffer->data, mlv_snd_current_buffer->length, mlv_snd_next_buffer->data, mlv_snd_next_buffer->length, mlv_snd_asif_in_cbr, 0);
/* the current one will get filled right now */
mlv_snd_current_buffer->timestamp = get_us_clock_value();
mlv_snd_current_buffer->timestamp = get_us_clock();
trace_write(trace_ctx, "mlv_snd_vsync: starting audio DONE");
}
else
......
......@@ -91,21 +91,21 @@ static void timer_cbr(int arg1, void* arg2)
{
timer_func = 1;
timer_arg = arg1;
timer_time = get_us_clock_value();
timer_time = get_us_clock();
}
static void overrun_cbr(int arg1, void* arg2)
{
timer_func = 2;
timer_arg = arg1;
timer_time = get_us_clock_value();
timer_time = get_us_clock();
}
static void next_tick_cbr(int arg1, void* arg2)
{
timer_func = 3;
timer_arg = arg1;
timer_time = get_us_clock_value();
timer_time = get_us_clock();
SetHPTimerNextTick(arg1, 100000, timer_cbr, overrun_cbr, 0);
}
......@@ -166,10 +166,10 @@ static void stub_test_edmac()
/* caveat: busy waiting; do not use in practice */
/* here, waiting for ~10ms may be too much, as EDMAC is very fast */
uint32_t mid = (uint32_t)CACHEABLE(dst) + size / 2;
uint64_t t0 = get_us_clock_value();
uint64_t t0 = get_us_clock();
while (edmac_get_pointer(edmac_write_chan) < mid)
;
uint64_t t1 = get_us_clock_value();
uint64_t t1 = get_us_clock();
/* stop here */
AbortEDmac(edmac_write_chan);
......@@ -201,8 +201,8 @@ static void stub_test_edmac()
/* delay with interrupts disabled */
static void busy_wait_ms(int ms)
{
int t0 = get_ms_clock_value();
while (get_ms_clock_value() - t0 < ms)
int t0 = get_ms_clock();
while (get_ms_clock() - t0 < ms)
;
}
......@@ -434,9 +434,9 @@ static void stub_test_cache_fio()
int handle_cache = rand() & 3;
/* run one iteration and time it */
int t0 = get_ms_clock_value();
int t0 = get_ms_clock();
int fail = stub_test_cache_fio_do(handle_cache);
int t1 = get_ms_clock_value();
int t1 = get_ms_clock();
ASSERT(fail == (fail & 3));
/* count the stats */
......@@ -493,9 +493,9 @@ static void stub_test_cache()
static int wait_focus_status(int timeout, int value)
{
int t0 = get_ms_clock_value();
int t0 = get_ms_clock();
while (get_ms_clock_value() - t0 < timeout)
while (get_ms_clock() - t0 < timeout)
{
msleep(10);
......@@ -672,7 +672,7 @@ static void stub_test_gui_timers()
/* SetTimerAfter, CancelTimer */
{
int t0 = get_us_clock_value()/1000;
int t0 = get_us_clock()/1000;
int ta0 = 0;
/* this one should overrun */
......@@ -714,7 +714,7 @@ static void stub_test_gui_timers()