From: Jeff E. <gi...@gi...> - 2015-07-01 08:01:30
|
hm2: dpll: rename variable to reflect units If period is in ns, then (period / 1000) is in us, not ms. Signed-off-by: Jeff Epler <je...@un...> http://git.linuxcnc.org/?p=linuxcnc.git;a=commitdiff;h=6eacec8 --- src/hal/drivers/mesa-hostmot2/dpll.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hal/drivers/mesa-hostmot2/dpll.c b/src/hal/drivers/mesa-hostmot2/dpll.c index 9811bc3..dc6904c 100644 --- a/src/hal/drivers/mesa-hostmot2/dpll.c +++ b/src/hal/drivers/mesa-hostmot2/dpll.c @@ -139,7 +139,7 @@ void hm2_dpll_process_tram_read(hostmot2_t *hm2, long period){ void hm2_dpll_write(hostmot2_t *hm2, long period) { hm2_dpll_pins_t *pins; - double period_ms = period / 1000; + double period_us = period / 1000; rtapi_u32 buff; static int init_counter = 0; @@ -158,7 +158,7 @@ void hm2_dpll_write(hostmot2_t *hm2, long period) { pins = hm2->dpll.pins; if (*pins->base_freq < 0 ) { - *pins->base_freq = 1000.0/period_ms; + *pins->base_freq = 1000.0/period_us; } *pins->prescale = (0x40000000LL * hm2->dpll.clock_frequency) @@ -195,8 +195,8 @@ void hm2_dpll_write(hostmot2_t *hm2, long period) { sizeof(rtapi_u32)); hm2->dpll.control_reg1_written= buff; } - buff = (rtapi_u32)((-*hm2->dpll.pins->time2_us / period_ms) * 0x10000) << 16 - | (rtapi_u32)((-*hm2->dpll.pins->time1_us / period_ms) * 0x10000); + buff = (rtapi_u32)((-*hm2->dpll.pins->time2_us / period_us) * 0x10000) << 16 + | (rtapi_u32)((-*hm2->dpll.pins->time1_us / period_us) * 0x10000); if (buff != hm2->dpll.timer_12_written){ hm2->llio->write(hm2->llio, hm2->dpll.timer_12_addr, @@ -204,8 +204,8 @@ void hm2_dpll_write(hostmot2_t *hm2, long period) { sizeof(rtapi_u32)); hm2->dpll.timer_12_written = buff; } - buff = (rtapi_u32)((-*hm2->dpll.pins->time4_us / period_ms) * 0x10000) << 16 - | (rtapi_u32)((-*hm2->dpll.pins->time3_us / period_ms) * 0x10000); + buff = (rtapi_u32)((-*hm2->dpll.pins->time4_us / period_us) * 0x10000) << 16 + | (rtapi_u32)((-*hm2->dpll.pins->time3_us / period_us) * 0x10000); if (buff != hm2->dpll.timer_34_written){ hm2->llio->write(hm2->llio, hm2->dpll.timer_34_addr, |