From 14405b30df776ba4e1b5e7363b1157370b5f0904 Mon Sep 17 00:00:00 2001 From: batt Date: Fri, 29 Aug 2008 22:15:21 +0000 Subject: [PATCH] Reformat: use tabs. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1765 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/algo/ramp_test.c | 74 ++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/bertos/algo/ramp_test.c b/bertos/algo/ramp_test.c index cecea430..918257f3 100644 --- a/bertos/algo/ramp_test.c +++ b/bertos/algo/ramp_test.c @@ -109,55 +109,55 @@ static bool ramp_test_single(uint32_t minFreq, uint32_t maxFreq, uint32_t length) { - struct Ramp r; - uint16_t cur, old; - uint32_t clock; - uint32_t oldclock; + struct Ramp r; + uint16_t cur, old; + uint32_t clock; + uint32_t oldclock; - ramp_setup(&r, length, minFreq, maxFreq); + ramp_setup(&r, length, minFreq, maxFreq); - cur = old = r.clocksMaxWL; - clock = 0; - oldclock = 0; + cur = old = r.clocksMaxWL; + clock = 0; + oldclock = 0; - kprintf("testing ramp: (length=%lu, min=%lu, max=%lu)\n", (unsigned long)length, (unsigned long)minFreq, (unsigned long)maxFreq); - kprintf(" [length=%lu, max=%04x, min=%04x]\n", (unsigned long)r.clocksRamp, r.clocksMaxWL, r.clocksMinWL); + kprintf("testing ramp: (length=%lu, min=%lu, max=%lu)\n", (unsigned long)length, (unsigned long)minFreq, (unsigned long)maxFreq); + kprintf(" [length=%lu, max=%04x, min=%04x]\n", (unsigned long)r.clocksRamp, r.clocksMaxWL, r.clocksMinWL); int i = 0; - int nonbyte = 0; - - while (clock + cur < r.clocksRamp) - { - oldclock = clock; - old = cur; - - clock += cur; - cur = ramp_evaluate(&r, clock); - - if (old < cur) - { - uint16_t t1 = FIX_MULT32(oldclock >> RAMP_CLOCK_SHIFT_PRECISION, r.precalc.inv_total_time); - uint16_t t2 = FIX_MULT32(clock >> RAMP_CLOCK_SHIFT_PRECISION, r.precalc.inv_total_time); - uint16_t denom1 = FIX_MULT32((uint16_t)((~t1) + 1), r.precalc.max_div_min) + t1; - uint16_t denom2 = FIX_MULT32((uint16_t)((~t2) + 1), r.precalc.max_div_min) + t2; - - kprintf(" Failed: %04x @ %lu --> %04x @ %lu\n", old, (unsigned long)oldclock, cur, (unsigned long)clock); - kprintf(" T: %04x -> %04x\n", t1, t2); - kprintf(" DENOM: %04x -> %04x\n", denom1, denom2); - - cur = ramp_evaluate(&r, clock); - return false; - } + int nonbyte = 0; + + while (clock + cur < r.clocksRamp) + { + oldclock = clock; + old = cur; + + clock += cur; + cur = ramp_evaluate(&r, clock); + + if (old < cur) + { + uint16_t t1 = FIX_MULT32(oldclock >> RAMP_CLOCK_SHIFT_PRECISION, r.precalc.inv_total_time); + uint16_t t2 = FIX_MULT32(clock >> RAMP_CLOCK_SHIFT_PRECISION, r.precalc.inv_total_time); + uint16_t denom1 = FIX_MULT32((uint16_t)((~t1) + 1), r.precalc.max_div_min) + t1; + uint16_t denom2 = FIX_MULT32((uint16_t)((~t2) + 1), r.precalc.max_div_min) + t2; + + kprintf(" Failed: %04x @ %lu --> %04x @ %lu\n", old, (unsigned long)oldclock, cur, (unsigned long)clock); + kprintf(" T: %04x -> %04x\n", t1, t2); + kprintf(" DENOM: %04x -> %04x\n", denom1, denom2); + + cur = ramp_evaluate(&r, clock); + return false; + } i++; if ((old-cur) >= 256) nonbyte++; - } + } - kprintf("Test finished: %04x @ %lu [min=%04x, totlen=%lu, numsteps:%d, nonbyte:%d]\n", cur, (unsigned long)clock, r.clocksMinWL, (unsigned long)r.clocksRamp, i, nonbyte); + kprintf("Test finished: %04x @ %lu [min=%04x, totlen=%lu, numsteps:%d, nonbyte:%d]\n", cur, (unsigned long)clock, r.clocksMinWL, (unsigned long)r.clocksRamp, i, nonbyte); - return true; + return true; } int ramp_testSetup(void) -- 2.25.1