diff --git a/src/hal/drivers/mesa-hostmot2/dpll.c b/src/hal/drivers/mesa-hostmot2/dpll.c index 004939ac71c..4f64775efef 100644 --- a/src/hal/drivers/mesa-hostmot2/dpll.c +++ b/src/hal/drivers/mesa-hostmot2/dpll.c @@ -88,13 +88,13 @@ int hm2_dpll_parse_md(hostmot2_t *hm2, int md_index) { * +-500ppm from its nominal value, usually by timekeeping software like ntp * and ntpdate. */ - r += hal_pin_new_ui32(hm2->llio->comp_id, HAL_IN, &(hm2->dpll.pins->time_const), + r += hal_pin_new_uint(hm2->llio->comp_id, HAL_IN, &(hm2->dpll.pins->time_const), 2000, "%s.dpll.time-const", hm2->llio->name); - r += hal_pin_new_ui32(hm2->llio->comp_id, HAL_IN, &(hm2->dpll.pins->plimit), + r += hal_pin_new_uint(hm2->llio->comp_id, HAL_IN, &(hm2->dpll.pins->plimit), 0x400000, "%s.dpll.plimit", hm2->llio->name); - r += hal_pin_new_ui32(hm2->llio->comp_id, HAL_OUT, &(hm2->dpll.pins->ddssize), + r += hal_pin_new_uint(hm2->llio->comp_id, HAL_OUT, &(hm2->dpll.pins->ddssize), 0, "%s.dpll.ddsize", hm2->llio->name); - r += hal_pin_new_ui32(hm2->llio->comp_id, HAL_OUT, &(hm2->dpll.pins->prescale), + r += hal_pin_new_uint(hm2->llio->comp_id, HAL_OUT, &(hm2->dpll.pins->prescale), 1, "%s.dpll.prescale", hm2->llio->name); if (r < 0) { HM2_ERR("error adding hm2_dpll timer pins, Aborting\n"); @@ -130,7 +130,7 @@ void hm2_dpll_process_tram_read(hostmot2_t *hm2, long period){ hal_set_real(pins->phase_error, (rtapi_s32)*hm2->dpll.hm2_dpll_sync_reg * (period / 4294967296000.00)); - hal_set_ui32(pins->ddssize, *hm2->dpll.control_reg1_read & 0xFF); + hal_set_uint(pins->ddssize, *hm2->dpll.control_reg1_read & 0xFF); } void hm2_dpll_write(hostmot2_t *hm2, long period) { @@ -158,12 +158,15 @@ void hm2_dpll_write(hostmot2_t *hm2, long period) { base_freq = hal_set_real(pins->base_freq, 1000.0/period_us); } - rtapi_u32 ddssize = hal_get_ui32(pins->ddssize); + // FIXME: The ddssize is an 8-bit value, but the use below using + // '1LL << ddssize' can create a zero value when 'ddssize >= 64'. + // That will subsequently result in a divide by zero. + rtapi_u32 ddssize = hal_get_uint(pins->ddssize); rtapi_u32 prescale = (0x40000000LL * hm2->dpll.clock_frequency) / ((1LL << ddssize) * base_freq * 1000.0); if (prescale < 1) prescale = 1; - hal_set_ui32(pins->prescale, prescale); + hal_set_uint(pins->prescale, prescale); buff = (rtapi_u32)((base_freq * 1000.0 * (1LL << ddssize) @@ -177,8 +180,9 @@ void hm2_dpll_write(hostmot2_t *hm2, long period) { sizeof(rtapi_u32)); hm2->dpll.base_rate_written= buff; } + // ControlReg0: 31..24: prescale, 23..0: PLimit(W)/PError(R) buff = (rtapi_u32)(prescale << 24 - | hal_get_ui32(pins->plimit)); + | (hal_get_uint(pins->plimit) & 0xffffff)); if (buff != hm2->dpll.control_reg0_written){ hm2->llio->write(hm2->llio, hm2->dpll.control_reg0_addr, @@ -186,7 +190,8 @@ void hm2_dpll_write(hostmot2_t *hm2, long period) { sizeof(rtapi_u32)); hm2->dpll.control_reg0_written= buff; } - buff = (rtapi_u32)(hal_get_ui32(pins->time_const) << 16); + // ControlReg1: 31..16: time_const, 15..8: unused, 7..0: ddssize (R/O) + buff = (rtapi_u32)(hal_get_uint(pins->time_const) << 16); if (buff != hm2->dpll.control_reg1_written){ hm2->llio->write(hm2->llio, hm2->dpll.control_reg1_addr, diff --git a/src/hal/drivers/mesa-hostmot2/hostmot2.c b/src/hal/drivers/mesa-hostmot2/hostmot2.c index f83e48fad84..6fc79b744a9 100644 --- a/src/hal/drivers/mesa-hostmot2/hostmot2.c +++ b/src/hal/drivers/mesa-hostmot2/hostmot2.c @@ -1770,7 +1770,7 @@ void hm2_unregister(hm2_lowlevel_io_t *llio) { // if there's a watchdog, set it to safe the board right away if (hm2->watchdog.num_instances > 0) { hm2->watchdog.instance[0].enable = 1; - hal_set_ui32(hm2->watchdog.instance[0].hal.param.timeout_ns, 1); + hal_set_uint(hm2->watchdog.instance[0].hal.param.timeout_ns, 1); hm2_watchdog_force_write(hm2); } diff --git a/src/hal/drivers/mesa-hostmot2/hostmot2.h b/src/hal/drivers/mesa-hostmot2/hostmot2.h index 89850f312b9..a1cf321fad2 100644 --- a/src/hal/drivers/mesa-hostmot2/hostmot2.h +++ b/src/hal/drivers/mesa-hostmot2/hostmot2.h @@ -536,7 +536,7 @@ typedef struct { // this keeps track of the output_type that we've told the FPGA, so we // know if we need to update it - rtapi_s32 written_output_type; + rtapi_sint written_output_type; // this keeps track of the offset_mode that we've set , so we // know if we need to update it @@ -575,8 +575,8 @@ typedef struct { // these keep track of the most recent hal->param.p{d,w}m_frequency // that we've told the FPGA about, so we know if we need to update it - rtapi_u32 written_pwm_frequency; - rtapi_u32 written_pdm_frequency; + rtapi_uint written_pwm_frequency; + rtapi_uint written_pdm_frequency; // number of bits of resolution of the PWM signal (PDM is fixed at 12 bits) int pwm_bits; @@ -1040,8 +1040,8 @@ typedef struct { // module-global HAL objects... hm2_xy2mod_module_global_t *hal; - rtapi_s32 written_dpll_rtimer_num; - rtapi_s32 written_dpll_wtimer_num; + rtapi_sint written_dpll_rtimer_num; + rtapi_sint written_dpll_wtimer_num; rtapi_u32 accx_addr; @@ -1134,7 +1134,7 @@ typedef struct { // these keep track of the most recent hal->param.p{d,w}m_frequency // that we've told the FPGA about, so we know if we need to update it - rtapi_u32 written_pwm_frequency; + rtapi_uint written_pwm_frequency; rtapi_u32 pwm_value_addr; // All three phases share a register (10 bits each) rtapi_u32 *pwm_value_reg; // Pointer to a memory block that holds the set. @@ -1483,7 +1483,7 @@ typedef struct { } hal; - rtapi_u32 written_timeout_ns; + rtapi_uint written_timeout_ns; int enable; // gets set to 0 at load time, gets set to 1 at first pet_watchdog int written_enable; diff --git a/src/hal/drivers/mesa-hostmot2/inm.c b/src/hal/drivers/mesa-hostmot2/inm.c index 596b9e2ba02..7239d95b780 100644 --- a/src/hal/drivers/mesa-hostmot2/inm.c +++ b/src/hal/drivers/mesa-hostmot2/inm.c @@ -186,21 +186,21 @@ int hm2_inm_parse_md(hostmot2_t *hm2, int md_index) { temp = (temp & 0x0000001f) +1; inst->scanwidth = temp; // init 20000: 20 KHz = 50 usec/scan - r = hal_param_new_ui32(hm2->llio->comp_id, HAL_RW, &(inst->hal.param.scan_rate), + r = hal_param_new_uint(hm2->llio->comp_id, HAL_RW, &(inst->hal.param.scan_rate), 20000, "%s.inm.%02d.scan_rate", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding param '%s.inm.%02d.scan_rate', aborting\n", r, hm2->llio->name, i); goto fail1; } // init 500: 500*50 usec = 25 ms - r = hal_param_new_ui32(hm2->llio->comp_id, HAL_RW, &(inst->hal.param.slow_scans), + r = hal_param_new_uint(hm2->llio->comp_id, HAL_RW, &(inst->hal.param.slow_scans), 500, "%s.inm.%02d.slow_scans", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding param '%s.inm.%02d.slow_scans', aborting\n", r, hm2->llio->name, i); goto fail1; } // init 5: 5*50 usec = 250 usec - r = hal_param_new_ui32(hm2->llio->comp_id, HAL_RW, &(inst->hal.param.fast_scans), + r = hal_param_new_uint(hm2->llio->comp_id, HAL_RW, &(inst->hal.param.fast_scans), 5, "%s.inm.%02d.fast_scans", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding param '%s.inm.%02d.fast_scans', aborting\n", r, hm2->llio->name, i); @@ -267,7 +267,8 @@ int hm2_inm_parse_md(hostmot2_t *hm2, int md_index) { } } - r = hal_param_new_ui32(hm2->llio->comp_id, HAL_RO, &(inst->hal.param.scan_width), + // FIXME: The scan_width is not used anywhere + r = hal_param_new_uint(hm2->llio->comp_id, HAL_RO, &(inst->hal.param.scan_width), temp, "%s.inm.%02d.scan_width", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding param '%s.inm.%02d.scan_width', aborting\n", r, hm2->llio->name, i); @@ -320,7 +321,7 @@ int hm2_inm_parse_md(hostmot2_t *hm2, int md_index) { } } if (inst->enc0_present) { - r = hal_pin_new_si32(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc0_count), + r = hal_pin_new_sint(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc0_count), 0, "%s.inm.%02d.enc0-count", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.inm.%02d.enc0-count', aborting\n", r, hm2->llio->name, i); @@ -335,7 +336,7 @@ int hm2_inm_parse_md(hostmot2_t *hm2, int md_index) { } if (inst->enc1_present) { - r = hal_pin_new_si32(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc1_count), + r = hal_pin_new_sint(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc1_count), 0, "%s.inm.%02d.enc1-count", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.inm.%02d.enc1-count', aborting\n", r, hm2->llio->name, i); @@ -350,7 +351,7 @@ int hm2_inm_parse_md(hostmot2_t *hm2, int md_index) { } if (inst->enc2_present) { - r = hal_pin_new_si32(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc2_count), + r = hal_pin_new_sint(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc2_count), 0, "%s.inm.%02d.enc2-count", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.inm.%02d.enc2-count', aborting\n", r, hm2->llio->name, i); @@ -364,7 +365,7 @@ int hm2_inm_parse_md(hostmot2_t *hm2, int md_index) { } } if (inst->enc3_present) { - r = hal_pin_new_si32(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc3_count), + r = hal_pin_new_sint(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc3_count), 0, "%s.inm.%02d.enc3-count", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.inm.%02d.enc3-count', aborting\n", r, hm2->llio->name, i); @@ -418,19 +419,19 @@ void hm2_inm_force_write(hostmot2_t *hm2) { // setup control register and mpg_write for (i = 0; i < hm2->inm.num_instances; i ++) { hm2_inm_instance_t *inst = &hm2->inm.instance[i]; - scanrate = inst->scanwidth * hal_get_ui32(inst->hal.param.scan_rate); + scanrate = inst->scanwidth * hal_get_uint(inst->hal.param.scan_rate); if (scanrate > 10000000) { scanrate = 10000000; - hal_set_ui32(inst->hal.param.scan_rate, scanrate/inst->scanwidth); + hal_set_uint(inst->hal.param.scan_rate, scanrate/inst->scanwidth); } divisor = (hm2->inm.clock_frequency / (4 * scanrate)) - 1; - rtapi_u32 fast_scans = hal_get_ui32(inst->hal.param.fast_scans); + rtapi_uint fast_scans = hal_get_uint(inst->hal.param.fast_scans); if (fast_scans > 63) { - fast_scans = hal_set_ui32(inst->hal.param.fast_scans, 63); + fast_scans = hal_set_uint(inst->hal.param.fast_scans, 63); } - rtapi_u32 slow_scans = hal_get_ui32(inst->hal.param.slow_scans); + rtapi_uint slow_scans = hal_get_uint(inst->hal.param.slow_scans); if (slow_scans > 1023) { - slow_scans = hal_set_ui32(inst->hal.param.slow_scans, 1023); + slow_scans = hal_set_uint(inst->hal.param.slow_scans, 1023); } // global invert bit(5) fixed to true for now as this matches all existing hardware @@ -465,37 +466,37 @@ void hm2_inm_write(hostmot2_t *hm2) { for (i = 0; i < hm2->inm.num_instances; i ++) { hm2_inm_instance_t *inst = &hm2->inm.instance[i]; - scanrate = inst->scanwidth * hal_get_ui32(inst->hal.param.scan_rate); + scanrate = inst->scanwidth * hal_get_uint(inst->hal.param.scan_rate); // bound scanrate maximum frequency if (scanrate > 10000000) { scanrate = 10000000; - hal_set_ui32(inst->hal.param.scan_rate, scanrate/inst->scanwidth); - HM2_ERR("inm %d scanrate too high, resetting to %d \n", i, hal_get_ui32(inst->hal.param.scan_rate)); + hal_set_uint(inst->hal.param.scan_rate, scanrate/inst->scanwidth); + HM2_ERR("inm %d scanrate too high, resetting to %lu \n", i, (unsigned long)hal_get_uint(inst->hal.param.scan_rate)); } divisor = (hm2->inm.clock_frequency / (4 * scanrate)) - 1; // bound divisor so we dont splatter into other fields if ((divisor > 1023 ) | (scanrate == 0 )) { divisor = 1023; - hal_set_ui32(inst->hal.param.scan_rate, (hm2->inm.clock_frequency/4)/(divisor +1) + hal_set_uint(inst->hal.param.scan_rate, (hm2->inm.clock_frequency/4)/(divisor +1) /inst->scanwidth); - HM2_ERR("inm %d scanrate too low, resetting to %d \n", i, hal_get_ui32(inst->hal.param.scan_rate)); + HM2_ERR("inm %d scanrate too low, resetting to %lu \n", i, (unsigned long)hal_get_uint(inst->hal.param.scan_rate)); } - rtapi_u32 fast_scans = hal_get_ui32(inst->hal.param.fast_scans); + rtapi_uint fast_scans = hal_get_uint(inst->hal.param.fast_scans); if (fast_scans > 63) { - fast_scans = hal_set_ui32(inst->hal.param.fast_scans, 63); + fast_scans = hal_set_uint(inst->hal.param.fast_scans, 63); HM2_ERR("inm %d fastscans must be less than 63, resetting to %d \n", i,63); } - rtapi_u32 slow_scans = hal_get_ui32(inst->hal.param.slow_scans); + rtapi_uint slow_scans = hal_get_uint(inst->hal.param.slow_scans); if (slow_scans > 1023) { - slow_scans = hal_set_ui32(inst->hal.param.slow_scans, 1023); + slow_scans = hal_set_uint(inst->hal.param.slow_scans, 1023); HM2_ERR("inm %d slowscans must be less than 1023, resetting to %d \n", i,1023); } if (fast_scans < 1 ) { - fast_scans = hal_set_ui32(inst->hal.param.fast_scans, 1); + fast_scans = hal_set_uint(inst->hal.param.fast_scans, 1); HM2_ERR("inm %d fastscans must be greater than 0, resetting to %d \n", i,1); } if (slow_scans < 1) { - slow_scans = hal_set_ui32(inst->hal.param.slow_scans, 1); + slow_scans = hal_set_uint(inst->hal.param.slow_scans, 1); HM2_ERR("inm %d slowscans must be greater than 0, resetting to %d \n", i,1); } @@ -579,9 +580,9 @@ void hm2_inm_process_tram_read(hostmot2_t *hm2) { if (count_diff > 128) count_diff -= 256; if (count_diff < -128) count_diff += 256; if (!hal_get_bool(inst->hal.pin.enc0_reset)) { - hal_set_si32(inst->hal.pin.enc0_count, hal_get_si32(inst->hal.pin.enc0_count) + count_diff); + hal_set_sint(inst->hal.pin.enc0_count, hal_get_sint(inst->hal.pin.enc0_count) + count_diff); } else { - hal_set_si32(inst->hal.pin.enc0_count, 0); + hal_set_sint(inst->hal.pin.enc0_count, 0); } } @@ -592,9 +593,9 @@ void hm2_inm_process_tram_read(hostmot2_t *hm2) { if (count_diff > 128) count_diff -= 256; if (count_diff < -128) count_diff += 256; if (!hal_get_bool(inst->hal.pin.enc1_reset)) { - hal_set_si32(inst->hal.pin.enc1_count, hal_get_si32(inst->hal.pin.enc1_count) + count_diff); + hal_set_sint(inst->hal.pin.enc1_count, hal_get_sint(inst->hal.pin.enc1_count) + count_diff); } else { - hal_set_si32(inst->hal.pin.enc1_count, 0); + hal_set_sint(inst->hal.pin.enc1_count, 0); } } @@ -605,9 +606,9 @@ void hm2_inm_process_tram_read(hostmot2_t *hm2) { if (count_diff > 128) count_diff -= 256; if (count_diff < -128) count_diff += 256; if (!hal_get_bool(inst->hal.pin.enc2_reset)) { - hal_set_si32(inst->hal.pin.enc2_count, hal_get_si32(inst->hal.pin.enc2_count) + count_diff); + hal_set_sint(inst->hal.pin.enc2_count, hal_get_sint(inst->hal.pin.enc2_count) + count_diff); } else { - hal_set_si32(inst->hal.pin.enc2_count, 0); + hal_set_sint(inst->hal.pin.enc2_count, 0); } } @@ -618,9 +619,9 @@ void hm2_inm_process_tram_read(hostmot2_t *hm2) { if (count_diff > 128) count_diff -= 256; if (count_diff < -128) count_diff += 256; if (!hal_get_bool(inst->hal.pin.enc3_reset)) { - hal_set_si32(inst->hal.pin.enc3_count, hal_get_si32(inst->hal.pin.enc3_count) + count_diff); + hal_set_sint(inst->hal.pin.enc3_count, hal_get_sint(inst->hal.pin.enc3_count) + count_diff); } else { - hal_set_si32(inst->hal.pin.enc3_count, 0); + hal_set_sint(inst->hal.pin.enc3_count, 0); } } } diff --git a/src/hal/drivers/mesa-hostmot2/inmux.c b/src/hal/drivers/mesa-hostmot2/inmux.c index eee23922016..67eb19a0720 100644 --- a/src/hal/drivers/mesa-hostmot2/inmux.c +++ b/src/hal/drivers/mesa-hostmot2/inmux.c @@ -163,21 +163,21 @@ int hm2_inmux_parse_md(hostmot2_t *hm2, int md_index) { inst->scanwidth = temp; // init=20000: 20 KHz = 50 usec/scan - r = hal_param_new_ui32(hm2->llio->comp_id, HAL_RW, &(inst->hal.param.scan_rate), + r = hal_param_new_uint(hm2->llio->comp_id, HAL_RW, &(inst->hal.param.scan_rate), 20000, "%s.inmux.%02d.scan_rate", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding param '%s.inmux.%02d.scan_rate', aborting\n", r, hm2->llio->name, i); goto fail1; } // init=500: 500*50 usec = 25 ms - r = hal_param_new_ui32(hm2->llio->comp_id, HAL_RW, &(inst->hal.param.slow_scans), + r = hal_param_new_uint(hm2->llio->comp_id, HAL_RW, &(inst->hal.param.slow_scans), 500, "%s.inmux.%02d.slow_scans", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding param '%s.inmux.%02d.slow_scans', aborting\n", r, hm2->llio->name, i); goto fail1; } // init=5: 5*50 usec = 250 usec - r = hal_param_new_ui32(hm2->llio->comp_id, HAL_RW, &(inst->hal.param.fast_scans), + r = hal_param_new_uint(hm2->llio->comp_id, HAL_RW, &(inst->hal.param.fast_scans), 5, "%s.inmux.%02d.fast_scans", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding param '%s.inmux.%02d.fast_scans', aborting\n", r, hm2->llio->name, i); @@ -207,7 +207,8 @@ int hm2_inmux_parse_md(hostmot2_t *hm2, int md_index) { HM2_ERR("error %d adding param '%s.inmux.%02d.enc3_4xmode', aborting\n", r, hm2->llio->name, i); goto fail1; } - r = hal_param_new_ui32(hm2->llio->comp_id, HAL_RO, &(inst->hal.param.scan_width), + // FIXME: The scan_width is not used anywhere + r = hal_param_new_uint(hm2->llio->comp_id, HAL_RO, &(inst->hal.param.scan_width), temp, "%s.inmux.%02d.scan_width", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding param '%s.inmux.%02d.scan_width', aborting\n", r, hm2->llio->name, i); @@ -247,28 +248,28 @@ int hm2_inmux_parse_md(hostmot2_t *hm2, int md_index) { } } - r = hal_pin_new_si32(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc0_count), + r = hal_pin_new_sint(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc0_count), 0, "%s.inmux.%02d.enc0-count", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.inmux.%02d.enc0-count', aborting\n", r, hm2->llio->name, i); goto fail1; } - r = hal_pin_new_si32(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc1_count), + r = hal_pin_new_sint(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc1_count), 0, "%s.inmux.%02d.enc1-count", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.inmux.%02d.enc1-count', aborting\n", r, hm2->llio->name, i); goto fail1; } - r = hal_pin_new_si32(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc2_count), + r = hal_pin_new_sint(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc2_count), 0, "%s.inmux.%02d.enc2-count", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.inmux.%02d.enc2-count', aborting\n", r, hm2->llio->name, i); goto fail1; } - r = hal_pin_new_si32(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc3_count), + r = hal_pin_new_sint(hm2->llio->comp_id, HAL_OUT, &(inst->hal.pin.enc3_count), 0, "%s.inmux.%02d.enc3-count", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.inmux.%02d.enc3-count', aborting\n", r, hm2->llio->name, i); @@ -343,19 +344,19 @@ void hm2_inmux_force_write(hostmot2_t *hm2) { // setup control register and mpg_write for (i = 0; i < hm2->inmux.num_instances; i ++) { hm2_inmux_instance_t *inst = &hm2->inmux.instance[i]; - muxrate = inst->scanwidth * hal_get_ui32(inst->hal.param.scan_rate); + muxrate = inst->scanwidth * hal_get_uint(inst->hal.param.scan_rate); if (muxrate > 5000000) { muxrate = 5000000; - hal_set_ui32(inst->hal.param.scan_rate, muxrate/inst->scanwidth); + hal_set_uint(inst->hal.param.scan_rate, muxrate/inst->scanwidth); } divisor = (hm2->inmux.clock_frequency / (4 * muxrate)) - 1; - rtapi_u32 fast_scans = hal_get_ui32(inst->hal.param.fast_scans); + rtapi_uint fast_scans = hal_get_uint(inst->hal.param.fast_scans); if (fast_scans > 63) { - fast_scans = hal_set_ui32(inst->hal.param.fast_scans, 63); + fast_scans = hal_set_uint(inst->hal.param.fast_scans, 63); } - rtapi_u32 slow_scans = hal_get_ui32(inst->hal.param.slow_scans); + rtapi_uint slow_scans = hal_get_uint(inst->hal.param.slow_scans); if (slow_scans > 1023) { - slow_scans = hal_set_ui32(inst->hal.param.slow_scans, 1023); + slow_scans = hal_set_uint(inst->hal.param.slow_scans, 1023); } // global invert bit(5) fixed to true for now as this matches all existing hardware @@ -387,37 +388,37 @@ void hm2_inmux_write(hostmot2_t *hm2) { for (i = 0; i < hm2->inmux.num_instances; i ++) { hm2_inmux_instance_t *inst = &hm2->inmux.instance[i]; - muxrate = inst->scanwidth * hal_get_ui32(inst->hal.param.scan_rate); + muxrate = inst->scanwidth * hal_get_uint(inst->hal.param.scan_rate); // bound muxrate maximum frequency if (muxrate > 5000000) { muxrate = 5000000; - hal_set_ui32(inst->hal.param.scan_rate, muxrate/inst->scanwidth); - HM2_ERR("InMux %d scanrate too high, resetting to %d \n", i, hal_get_ui32(inst->hal.param.scan_rate)); + hal_set_uint(inst->hal.param.scan_rate, muxrate/inst->scanwidth); + HM2_ERR("InMux %d scanrate too high, resetting to %lu \n", i, (unsigned long)hal_get_uint(inst->hal.param.scan_rate)); } divisor = (hm2->inmux.clock_frequency / (4 * muxrate)) - 1; // bound divisor so we dont splatter into other fields if ((divisor > 1023 ) | (muxrate == 0 )) { divisor = 1023; - hal_set_ui32(inst->hal.param.scan_rate, + hal_set_uint(inst->hal.param.scan_rate, (hm2->inmux.clock_frequency/4) / (divisor +1) / inst->scanwidth); - HM2_ERR("InMux %d scanrate too low, resetting to %d \n", i, hal_get_ui32(inst->hal.param.scan_rate)); + HM2_ERR("InMux %d scanrate too low, resetting to %lu \n", i, (unsigned long)hal_get_uint(inst->hal.param.scan_rate)); } - rtapi_u32 fast_scans = hal_get_ui32(inst->hal.param.fast_scans); + rtapi_uint fast_scans = hal_get_uint(inst->hal.param.fast_scans); if (fast_scans > 63) { - fast_scans = hal_set_ui32(inst->hal.param.fast_scans, 63); + fast_scans = hal_set_uint(inst->hal.param.fast_scans, 63); HM2_ERR("InMux %d fastscans must be less than 63, resetting to %d \n", i,63); } - rtapi_u32 slow_scans = hal_get_ui32(inst->hal.param.slow_scans); + rtapi_uint slow_scans = hal_get_uint(inst->hal.param.slow_scans); if (slow_scans > 1023) { - slow_scans = hal_set_ui32(inst->hal.param.slow_scans, 1023); + slow_scans = hal_set_uint(inst->hal.param.slow_scans, 1023); HM2_ERR("InMux %d slowscans must be less than 1023, resetting to %d \n", i,1023); } if (fast_scans < 1 ) { - fast_scans = hal_set_ui32(inst->hal.param.fast_scans, 1); + fast_scans = hal_set_uint(inst->hal.param.fast_scans, 1); HM2_ERR("InMux %d fastscans must be greater than 0, resetting to %d \n", i,1); } if (slow_scans < 1) { - slow_scans = hal_set_ui32(inst->hal.param.slow_scans, 1); + slow_scans = hal_set_uint(inst->hal.param.slow_scans, 1); HM2_ERR("InMux %d slowscans must be greater than 0, resetting to %d \n", i,1); } @@ -487,9 +488,9 @@ void hm2_inmux_process_tram_read(hostmot2_t *hm2) { if (count_diff > 128) count_diff -= 256; if (count_diff < -128) count_diff += 256; if (!hal_get_bool(inst->hal.pin.enc0_reset)) { - hal_set_si32(inst->hal.pin.enc0_count, hal_get_si32(inst->hal.pin.enc0_count) + count_diff); + hal_set_sint(inst->hal.pin.enc0_count, hal_get_sint(inst->hal.pin.enc0_count) + count_diff); } else { - hal_set_si32(inst->hal.pin.enc0_count, 0); + hal_set_sint(inst->hal.pin.enc0_count, 0); } raw_count = (hm2->inmux.mpg_read_reg[i] >> 8) & 0x000000FF; count_diff = (rtapi_s32)raw_count - inst->prev_enc1_count; @@ -497,9 +498,9 @@ void hm2_inmux_process_tram_read(hostmot2_t *hm2) { if (count_diff > 128) count_diff -= 256; if (count_diff < -128) count_diff += 256; if (!hal_get_bool(inst->hal.pin.enc1_reset)) { - hal_set_si32(inst->hal.pin.enc1_count, hal_get_si32(inst->hal.pin.enc1_count) + count_diff); + hal_set_sint(inst->hal.pin.enc1_count, hal_get_sint(inst->hal.pin.enc1_count) + count_diff); } else { - hal_set_si32(inst->hal.pin.enc1_count, 0); + hal_set_sint(inst->hal.pin.enc1_count, 0); } raw_count = (hm2->inmux.mpg_read_reg[i] >> 16) & 0x000000FF; count_diff = (rtapi_s32)raw_count - inst->prev_enc2_count; @@ -507,9 +508,9 @@ void hm2_inmux_process_tram_read(hostmot2_t *hm2) { if (count_diff > 128) count_diff -= 256; if (count_diff < -128) count_diff += 256; if (!hal_get_bool(inst->hal.pin.enc2_reset)) { - hal_set_si32(inst->hal.pin.enc2_count, hal_get_si32(inst->hal.pin.enc2_count) + count_diff); + hal_set_sint(inst->hal.pin.enc2_count, hal_get_sint(inst->hal.pin.enc2_count) + count_diff); } else { - hal_set_si32(inst->hal.pin.enc2_count, 0); + hal_set_sint(inst->hal.pin.enc2_count, 0); } raw_count = (hm2->inmux.mpg_read_reg[i] >> 24) & 0x000000FF; count_diff = (rtapi_s32)raw_count - inst->prev_enc3_count; @@ -517,9 +518,9 @@ void hm2_inmux_process_tram_read(hostmot2_t *hm2) { if (count_diff > 128) count_diff -= 256; if (count_diff < -128) count_diff += 256; if (!hal_get_bool(inst->hal.pin.enc3_reset)) { - hal_set_si32(inst->hal.pin.enc3_count, hal_get_si32(inst->hal.pin.enc3_count) + count_diff); + hal_set_sint(inst->hal.pin.enc3_count, hal_get_sint(inst->hal.pin.enc3_count) + count_diff); } else { - hal_set_si32(inst->hal.pin.enc3_count, 0); + hal_set_sint(inst->hal.pin.enc3_count, 0); } } } diff --git a/src/hal/drivers/mesa-hostmot2/oneshot.c b/src/hal/drivers/mesa-hostmot2/oneshot.c index 4101a8f89af..46a80c2186e 100644 --- a/src/hal/drivers/mesa-hostmot2/oneshot.c +++ b/src/hal/drivers/mesa-hostmot2/oneshot.c @@ -75,24 +75,24 @@ void hm2_oneshot_update_rate(hostmot2_t *hm2, int i) { void hm2_oneshot_update_control(hostmot2_t *hm2, int i) { rtapi_u32 controlbuff; - if(hal_get_ui32(hm2->oneshot.instance[i].hal.pin.trigselect1) > 7) { + if(hal_get_uint(hm2->oneshot.instance[i].hal.pin.trigselect1) > 7) { HM2_ERR("oneshot %d has invalid trigger 1 select value , resetting to 0\n", i); - hal_set_ui32(hm2->oneshot.instance[i].hal.pin.trigselect1, 0); + hal_set_uint(hm2->oneshot.instance[i].hal.pin.trigselect1, 0); } - if(hal_get_ui32(hm2->oneshot.instance[i].hal.pin.trigselect2) > 7) { - HM2_ERR("oneshot %d has invalid trigger 2 select value , resetting to 0\n", i); - hal_set_ui32(hm2->oneshot.instance[i].hal.pin.trigselect2, 0); + if(hal_get_uint(hm2->oneshot.instance[i].hal.pin.trigselect2) > 7) { + HM2_ERR("oneshot %d has invalid trigger 2 select value , resetting to 0\n", i); + hal_set_uint(hm2->oneshot.instance[i].hal.pin.trigselect2, 0); } controlbuff = 0; - controlbuff |= (hal_get_ui32(hm2->oneshot.instance[i].hal.pin.trigselect1) << 0); + controlbuff |= (hal_get_uint(hm2->oneshot.instance[i].hal.pin.trigselect1) << 0); controlbuff |= (hal_get_bool(hm2->oneshot.instance[i].hal.pin.trigrise1) << 3); controlbuff |= (hal_get_bool(hm2->oneshot.instance[i].hal.pin.trigfall1) << 4); controlbuff |= (hal_get_bool(hm2->oneshot.instance[i].hal.pin.retrig1) << 5); controlbuff |= (hal_get_bool(hm2->oneshot.instance[i].hal.pin.enable1) << 6); controlbuff |= (hal_get_bool(hm2->oneshot.instance[i].hal.pin.reset1) << 7); controlbuff |= (hal_get_bool(hm2->oneshot.instance[i].hal.pin.swtrig1) << 10); - controlbuff |= ((hal_get_si32(hm2->oneshot.instance[i].hal.pin.dpll_timer_num) & 7) << 12); - controlbuff |= (hal_get_ui32(hm2->oneshot.instance[i].hal.pin.trigselect2) << 16); + controlbuff |= ((hal_get_sint(hm2->oneshot.instance[i].hal.pin.dpll_timer_num) & 7) << 12); + controlbuff |= (hal_get_uint(hm2->oneshot.instance[i].hal.pin.trigselect2) << 16); controlbuff |= (hal_get_bool(hm2->oneshot.instance[i].hal.pin.trigrise2) << 19); controlbuff |= (hal_get_bool(hm2->oneshot.instance[i].hal.pin.trigfall2) << 20); controlbuff |= (hal_get_bool(hm2->oneshot.instance[i].hal.pin.retrig2) << 21); @@ -300,21 +300,21 @@ int hm2_oneshot_parse_md(hostmot2_t *hm2, int md_index) { goto fail1; } - r = hal_pin_new_ui32(hm2->llio->comp_id, HAL_IN, &(hm2->oneshot.instance[i].hal.pin.trigselect1), + r = hal_pin_new_uint(hm2->llio->comp_id, HAL_IN, &(hm2->oneshot.instance[i].hal.pin.trigselect1), 0, "%s.oneshot.%02d.trigger_select1", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.oneshot.%02d.trigger_select1', aborting\n", r, hm2->llio->name, i); goto fail1; } - r = hal_pin_new_ui32(hm2->llio->comp_id, HAL_IN, &(hm2->oneshot.instance[i].hal.pin.trigselect2), + r = hal_pin_new_uint(hm2->llio->comp_id, HAL_IN, &(hm2->oneshot.instance[i].hal.pin.trigselect2), 0, "%s.oneshot.%02d.trigger_select2", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.oneshot.%02d.trigger_select2', aborting\n", r, hm2->llio->name, i); goto fail1; } - r = hal_pin_new_si32(hm2->llio->comp_id, HAL_IN, &(hm2->oneshot.instance[i].hal.pin.dpll_timer_num), + r = hal_pin_new_sint(hm2->llio->comp_id, HAL_IN, &(hm2->oneshot.instance[i].hal.pin.dpll_timer_num), 0, "%s.oneshot.%02d.dpll_timer_number", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.oneshot.%02d.dpll_timer_number', aborting\n", r, hm2->llio->name, i); diff --git a/src/hal/drivers/mesa-hostmot2/periodm.c b/src/hal/drivers/mesa-hostmot2/periodm.c index afb1e1f3e8b..9a3a004a5e0 100644 --- a/src/hal/drivers/mesa-hostmot2/periodm.c +++ b/src/hal/drivers/mesa-hostmot2/periodm.c @@ -32,7 +32,7 @@ void hm2_periodm_update_limit(hostmot2_t *hm2, int i) { - rtapi_u32 averages = hal_get_ui32(hm2->periodm.instance[i].hal.pin.averages); + rtapi_uint averages = hal_get_uint(hm2->periodm.instance[i].hal.pin.averages); rtapi_real minfreq = hal_get_real(hm2->periodm.instance[i].hal.pin.minfreq); hm2->periodm.limit_reg[i] = ((double)hm2->periodm.clock_frequency / minfreq) * averages; if ((((double)hm2->periodm.clock_frequency / minfreq) * averages ) > 0xFFFFFFFF) { @@ -45,7 +45,7 @@ void hm2_periodm_update_limit(hostmot2_t *hm2, int i) { void hm2_periodm_update_mode(hostmot2_t *hm2, int i) { rtapi_u32 modebuff; rtapi_u32 filterclocks; - rtapi_u32 averages = hal_get_ui32(hm2->periodm.instance[i].hal.pin.averages); + rtapi_uint averages = hal_get_uint(hm2->periodm.instance[i].hal.pin.averages); filterclocks = (double)hal_get_real(hm2->periodm.instance[i].hal.pin.filtertc) * ((double)hm2->periodm.clock_frequency / (double)1e6); if (filterclocks > 0xFFFF) { HM2_ERR("periodm %d has invalid filter time constant, resetting to max\n", i); @@ -54,18 +54,18 @@ void hm2_periodm_update_mode(hostmot2_t *hm2, int i) { } if (averages > 0xFFF) { HM2_ERR("periodm %d has invalid averages number, resetting to max\n", i); - averages = hal_set_ui32(hm2->periodm.instance[i].hal.pin.averages, 0xFFF); + averages = hal_set_uint(hm2->periodm.instance[i].hal.pin.averages, 0xFFF); } if (averages < 1) { HM2_ERR("periodm %d has invalid averages number, resetting to min\n", i); - averages = hal_set_ui32(hm2->periodm.instance[i].hal.pin.averages, 1); + averages = hal_set_uint(hm2->periodm.instance[i].hal.pin.averages, 1); } modebuff = 0; modebuff |= (hal_get_bool(hm2->periodm.instance[i].hal.pin.polarity) << 0); - modebuff |= ((averages-1) << 4); + modebuff |= (rtapi_u32)((averages-1) << 4); modebuff |= (filterclocks << 16); - hm2->periodm.mode_write_reg[i] = modebuff; + hm2->periodm.mode_write_reg[i] = modebuff; } void hm2_periodm_update_regs(hostmot2_t *hm2) { @@ -259,7 +259,7 @@ int hm2_periodm_parse_md(hostmot2_t *hm2, int md_index) { goto fail1; } - r = hal_pin_new_ui32(hm2->llio->comp_id, HAL_IO, &(hm2->periodm.instance[i].hal.pin.averages), + r = hal_pin_new_uint(hm2->llio->comp_id, HAL_IO, &(hm2->periodm.instance[i].hal.pin.averages), 1, "%s.periodm.%02d.averages", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.periodm.%02d.averages', aborting\n", r, hm2->llio->name, i); @@ -346,7 +346,7 @@ void hm2_periodm_process_tram_read(hostmot2_t *hm2) { int i; rtapi_u32 mode = 0; for (i = 0; i < hm2->periodm.num_instances; i ++) { - rtapi_u32 averages = hal_get_ui32(hm2->periodm.instance[i].hal.pin.averages); + rtapi_uint averages = hal_get_uint(hm2->periodm.instance[i].hal.pin.averages); mode = hm2->periodm.mode_read_reg[i]; // hal_set_bool(hm2->periodm.instance[i].hal.pin.polarity, (mode & (1 << 0)) != 0); hal_set_bool(hm2->periodm.instance[i].hal.pin.valid, (mode & (1 << 1)) != 0); diff --git a/src/hal/drivers/mesa-hostmot2/pwmgen.c b/src/hal/drivers/mesa-hostmot2/pwmgen.c index 1ea78d90bb6..8e399434fbe 100644 --- a/src/hal/drivers/mesa-hostmot2/pwmgen.c +++ b/src/hal/drivers/mesa-hostmot2/pwmgen.c @@ -34,9 +34,9 @@ void hm2_pwmgen_handle_pwm_frequency(hostmot2_t *hm2) { rtapi_u32 dds; - if (hal_get_ui32(hm2->pwmgen.hal->param.pwm_frequency) < 1) { - HM2_ERR("pwmgen.pwm_frequency %d is too low, setting to 1\n", hal_get_ui32(hm2->pwmgen.hal->param.pwm_frequency)); - hal_set_ui32(hm2->pwmgen.hal->param.pwm_frequency, 1); + if (hal_get_uint(hm2->pwmgen.hal->param.pwm_frequency) < 1) { + HM2_ERR("pwmgen.pwm_frequency %lu is too low, setting to 1\n", (unsigned long)hal_get_uint(hm2->pwmgen.hal->param.pwm_frequency)); + hal_set_uint(hm2->pwmgen.hal->param.pwm_frequency, 1); } @@ -65,7 +65,7 @@ void hm2_pwmgen_handle_pwm_frequency(hostmot2_t *hm2) { // // can we do it with 12 bits? - dds = ((double)hal_get_ui32(hm2->pwmgen.hal->param.pwm_frequency) * 65536.0 * 4096.0) / (double)hm2->pwmgen.clock_frequency; + dds = ((double)hal_get_uint(hm2->pwmgen.hal->param.pwm_frequency) * 65536.0 * 4096.0) / (double)hm2->pwmgen.clock_frequency; if (dds < 65536) { hm2->pwmgen.pwmgen_master_rate_dds_reg = dds; hm2->pwmgen.pwm_bits = 12; @@ -73,7 +73,7 @@ void hm2_pwmgen_handle_pwm_frequency(hostmot2_t *hm2) { } // try 11 bits - dds = ((double)hal_get_ui32(hm2->pwmgen.hal->param.pwm_frequency) * 65536.0 * 2048.0) / (double)hm2->pwmgen.clock_frequency; + dds = ((double)hal_get_uint(hm2->pwmgen.hal->param.pwm_frequency) * 65536.0 * 2048.0) / (double)hm2->pwmgen.clock_frequency; if (dds < 65536) { hm2->pwmgen.pwmgen_master_rate_dds_reg = dds; hm2->pwmgen.pwm_bits = 11; @@ -81,7 +81,7 @@ void hm2_pwmgen_handle_pwm_frequency(hostmot2_t *hm2) { } // try 10 bits - dds = ((double)hal_get_ui32(hm2->pwmgen.hal->param.pwm_frequency) * 65536.0 * 1024.0) / (double)hm2->pwmgen.clock_frequency; + dds = ((double)hal_get_uint(hm2->pwmgen.hal->param.pwm_frequency) * 65536.0 * 1024.0) / (double)hm2->pwmgen.clock_frequency; if (dds < 65536) { hm2->pwmgen.pwmgen_master_rate_dds_reg = dds; hm2->pwmgen.pwm_bits = 10; @@ -89,7 +89,7 @@ void hm2_pwmgen_handle_pwm_frequency(hostmot2_t *hm2) { } // try 9 bits - dds = ((double)hal_get_ui32(hm2->pwmgen.hal->param.pwm_frequency) * 65536.0 * 512.0) / (double)hm2->pwmgen.clock_frequency; + dds = ((double)hal_get_uint(hm2->pwmgen.hal->param.pwm_frequency) * 65536.0 * 512.0) / (double)hm2->pwmgen.clock_frequency; if (dds < 65536) { hm2->pwmgen.pwmgen_master_rate_dds_reg = dds; hm2->pwmgen.pwm_bits = 9; @@ -99,8 +99,8 @@ void hm2_pwmgen_handle_pwm_frequency(hostmot2_t *hm2) { // no joy, lower frequency until it'll work with 9 bits // From above: // PWMFreq = (ClockHigh * DDS) / (65536 * 2^PWMBits) - hal_set_ui32(hm2->pwmgen.hal->param.pwm_frequency, ((double)hm2->pwmgen.clock_frequency * 65535.0) / (65536.0 * 512.0)); - HM2_ERR("max PWM frequency is %d Hz\n", hal_get_ui32(hm2->pwmgen.hal->param.pwm_frequency)); + hal_set_uint(hm2->pwmgen.hal->param.pwm_frequency, ((double)hm2->pwmgen.clock_frequency * 65535.0) / (65536.0 * 512.0)); + HM2_ERR("max PWM frequency is %lu Hz\n", (unsigned long)hal_get_uint(hm2->pwmgen.hal->param.pwm_frequency)); hm2->pwmgen.pwmgen_master_rate_dds_reg = 65535; hm2->pwmgen.pwm_bits = 9; } @@ -110,9 +110,9 @@ void hm2_pwmgen_handle_pdm_frequency(hostmot2_t *hm2) { rtapi_u32 dds; - if (hal_get_ui32(hm2->pwmgen.hal->param.pdm_frequency) < 1) { - HM2_ERR("pwmgen.pdm_frequency %d is too low, setting to 1\n", hal_get_ui32(hm2->pwmgen.hal->param.pdm_frequency)); - hal_set_ui32(hm2->pwmgen.hal->param.pdm_frequency, 1); + if (hal_get_uint(hm2->pwmgen.hal->param.pdm_frequency) < 1) { + HM2_ERR("pwmgen.pdm_frequency %lu is too low, setting to 1\n", (unsigned long)hal_get_uint(hm2->pwmgen.hal->param.pdm_frequency)); + hal_set_uint(hm2->pwmgen.hal->param.pdm_frequency, 1); } @@ -151,14 +151,14 @@ void hm2_pwmgen_handle_pdm_frequency(hostmot2_t *hm2) { // // can we do it with 12 bits? - dds = ((double)hal_get_ui32(hm2->pwmgen.hal->param.pdm_frequency) * 65536.0) / (double)hm2->pwmgen.clock_frequency; + dds = ((double)hal_get_uint(hm2->pwmgen.hal->param.pdm_frequency) * 65536.0) / (double)hm2->pwmgen.clock_frequency; if (dds == 0) { // too slow, set frequency to minimum // From above: // PulseFreq = (ClockHigh * DDS) / 65536 dds = 1; - hal_set_ui32(hm2->pwmgen.hal->param.pdm_frequency, ((double)hm2->pwmgen.clock_frequency * (double)dds) / 65536.0); - HM2_ERR("min PDM frequency is %d Hz\n", hal_get_ui32(hm2->pwmgen.hal->param.pdm_frequency)); + hal_set_uint(hm2->pwmgen.hal->param.pdm_frequency, ((double)hm2->pwmgen.clock_frequency * (double)dds) / 65536.0); + HM2_ERR("min PDM frequency is %lu Hz\n", (unsigned long)hal_get_uint(hm2->pwmgen.hal->param.pdm_frequency)); hm2->pwmgen.pdmgen_master_rate_dds_reg = 1; return; } @@ -172,8 +172,8 @@ void hm2_pwmgen_handle_pdm_frequency(hostmot2_t *hm2) { // user wants too much, lower frequency until it'll work with 12 bits // From above: // PulseFreq = (ClockHigh * DDS) / 65536 - hal_set_ui32(hm2->pwmgen.hal->param.pdm_frequency, ((double)hm2->pwmgen.clock_frequency * 65535.0) / 65536.0); - HM2_ERR("max PDM frequency is %d Hz\n", hal_get_ui32(hm2->pwmgen.hal->param.pdm_frequency)); + hal_set_uint(hm2->pwmgen.hal->param.pdm_frequency, ((double)hm2->pwmgen.clock_frequency * 65535.0) / 65536.0); + HM2_ERR("max PDM frequency is %lu Hz\n", (unsigned long)hal_get_uint(hm2->pwmgen.hal->param.pdm_frequency)); hm2->pwmgen.pdmgen_master_rate_dds_reg = 65535; } @@ -219,7 +219,7 @@ void hm2_pwmgen_force_write(hostmot2_t *hm2) { hm2->pwmgen.pwm_mode_reg[i] = pwm_width; - switch (hal_get_si32(hm2->pwmgen.instance[i].hal.param.output_type)) { + switch (hal_get_sint(hm2->pwmgen.instance[i].hal.param.output_type)) { case HM2_PWMGEN_OUTPUT_TYPE_PWM: { // leave the Output Mode bits 0 double_buffered = 1; @@ -246,8 +246,8 @@ void hm2_pwmgen_force_write(hostmot2_t *hm2) { default: { // unknown pwm mode! complain and switch to pwm/dir HM2_ERR( - "invalid pwmgen output_type %d requested\n", - hal_get_si32(hm2->pwmgen.instance[i].hal.param.output_type) + "invalid pwmgen output_type %ld requested\n", + (long)hal_get_sint(hm2->pwmgen.instance[i].hal.param.output_type) ); HM2_ERR( "supported .output-type values are: %d (PWM & Dir), %d (Up & Down), %d (PDM & Dir), and %d (Dir & PWM)\n", @@ -257,7 +257,7 @@ void hm2_pwmgen_force_write(hostmot2_t *hm2) { HM2_PWMGEN_OUTPUT_TYPE_PWM_SWAPPED ); HM2_ERR("switching to 1 (PWM & Dir)\n"); - hal_set_si32(hm2->pwmgen.instance[i].hal.param.output_type, HM2_PWMGEN_OUTPUT_TYPE_PWM); + hal_set_sint(hm2->pwmgen.instance[i].hal.param.output_type, HM2_PWMGEN_OUTPUT_TYPE_PWM); double_buffered = 1; // leave the Output Mode bits 0 break; @@ -290,14 +290,14 @@ void hm2_pwmgen_force_write(hostmot2_t *hm2) { if (hal_get_bool(*hm2->llio->io_error)) return; for (i = 0; i < hm2->pwmgen.num_instances; i ++) { - hm2->pwmgen.instance[i].written_output_type = hal_get_si32(hm2->pwmgen.instance[i].hal.param.output_type); + hm2->pwmgen.instance[i].written_output_type = hal_get_sint(hm2->pwmgen.instance[i].hal.param.output_type); hm2->pwmgen.instance[i].written_offset_mode = hal_get_bool(hm2->pwmgen.instance[i].hal.param.offset_mode); hm2->pwmgen.instance[i].written_dither = hal_get_bool(hm2->pwmgen.instance[i].hal.param.dither); hm2->pwmgen.instance[i].written_enable = hal_get_bool(hm2->pwmgen.instance[i].hal.pin.enable); } - hm2->pwmgen.written_pwm_frequency = hal_get_ui32(hm2->pwmgen.hal->param.pwm_frequency); - hm2->pwmgen.written_pdm_frequency = hal_get_ui32(hm2->pwmgen.hal->param.pdm_frequency); + hm2->pwmgen.written_pwm_frequency = hal_get_uint(hm2->pwmgen.hal->param.pwm_frequency); + hm2->pwmgen.written_pdm_frequency = hal_get_uint(hm2->pwmgen.hal->param.pdm_frequency); } @@ -314,7 +314,7 @@ void hm2_pwmgen_write(hostmot2_t *hm2) { // check output type for (i = 0; i < hm2->pwmgen.num_instances; i ++) { - if (hal_get_si32(hm2->pwmgen.instance[i].hal.param.output_type) != hm2->pwmgen.instance[i].written_output_type) { + if (hal_get_sint(hm2->pwmgen.instance[i].hal.param.output_type) != hm2->pwmgen.instance[i].written_output_type) { goto force_write; } } @@ -333,8 +333,8 @@ void hm2_pwmgen_write(hostmot2_t *hm2) { } // check pwm & pdm frequency - if (hal_get_ui32(hm2->pwmgen.hal->param.pwm_frequency) != hm2->pwmgen.written_pwm_frequency) goto force_write; - if (hal_get_ui32(hm2->pwmgen.hal->param.pdm_frequency) != hm2->pwmgen.written_pdm_frequency) goto force_write; + if (hal_get_uint(hm2->pwmgen.hal->param.pwm_frequency) != hm2->pwmgen.written_pwm_frequency) goto force_write; + if (hal_get_uint(hm2->pwmgen.hal->param.pdm_frequency) != hm2->pwmgen.written_pdm_frequency) goto force_write; // update enable register? for (i = 0; i < hm2->pwmgen.num_instances; i ++) { @@ -450,7 +450,7 @@ int hm2_pwmgen_parse_md(hostmot2_t *hm2, int md_index) { // export to HAL { // these hal parameters affect all pwmgen instances - r = hal_param_new_ui32(hm2->llio->comp_id, HAL_RW, &(hm2->pwmgen.hal->param.pwm_frequency), + r = hal_param_new_uint(hm2->llio->comp_id, HAL_RW, &(hm2->pwmgen.hal->param.pwm_frequency), 20000, "%s.pwmgen.pwm_frequency", hm2->llio->name); if (r < 0) { HM2_ERR("error %d adding '%s.pwmgen.pwm_frequency' param, aborting\n", r, hm2->llio->name); @@ -458,7 +458,7 @@ int hm2_pwmgen_parse_md(hostmot2_t *hm2, int md_index) { } hm2->pwmgen.written_pwm_frequency = 0; - r = hal_param_new_ui32(hm2->llio->comp_id, HAL_RW, &(hm2->pwmgen.hal->param.pdm_frequency), + r = hal_param_new_uint(hm2->llio->comp_id, HAL_RW, &(hm2->pwmgen.hal->param.pdm_frequency), 20000, "%s.pwmgen.pdm_frequency", hm2->llio->name); if (r < 0) { HM2_ERR("error %d adding '%s.pwmgen.pdm_frequency' param, aborting\n", r, hm2->llio->name); @@ -512,7 +512,7 @@ int hm2_pwmgen_parse_md(hostmot2_t *hm2, int md_index) { goto fail1; } - r = hal_param_new_si32(hm2->llio->comp_id, HAL_RW, &(hm2->pwmgen.instance[i].hal.param.output_type), + r = hal_param_new_sint(hm2->llio->comp_id, HAL_RW, &(hm2->pwmgen.instance[i].hal.param.output_type), HM2_PWMGEN_OUTPUT_TYPE_PWM, "%s.pwmgen.%02d.output-type", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding param '%s.pwmgen.%02d.output-type', aborting\n", r, hm2->llio->name, i); @@ -614,7 +614,7 @@ void hm2_pwmgen_prepare_tram_write(hostmot2_t *hm2) { // duty_cycle goes from 0.0 to 1.0, and needs to be puffed out to pwm_bits (if it's pwm) or 12 (if it's pdm) if (!hal_get_bool(hm2->pwmgen.instance[i].hal.param.offset_mode)) { //normal PWM/PDM modes - if (hal_get_si32(hm2->pwmgen.instance[i].hal.param.output_type) == HM2_PWMGEN_OUTPUT_TYPE_PDM) { + if (hal_get_sint(hm2->pwmgen.instance[i].hal.param.output_type) == HM2_PWMGEN_OUTPUT_TYPE_PDM) { bits = 12; } else { bits = hm2->pwmgen.pwm_bits; @@ -631,7 +631,7 @@ void hm2_pwmgen_prepare_tram_write(hostmot2_t *hm2) { } else { // offset PWM/PDM modes where 0 PWM value = 50% duty cycle also choose active low - if (hal_get_si32(hm2->pwmgen.instance[i].hal.param.output_type) == HM2_PWMGEN_OUTPUT_TYPE_PDM) { + if (hal_get_sint(hm2->pwmgen.instance[i].hal.param.output_type) == HM2_PWMGEN_OUTPUT_TYPE_PDM) { bits = 11; } else { bits = hm2->pwmgen.pwm_bits -1; diff --git a/src/hal/drivers/mesa-hostmot2/ssr.c b/src/hal/drivers/mesa-hostmot2/ssr.c index 095b927ad82..e6a15e9d1cc 100644 --- a/src/hal/drivers/mesa-hostmot2/ssr.c +++ b/src/hal/drivers/mesa-hostmot2/ssr.c @@ -127,7 +127,7 @@ int hm2_ssr_parse_md(hostmot2_t *hm2, int md_index) { { for (int i = 0; i < hm2->ssr.num_instances; i ++) { - r = hal_pin_new_ui32(hm2->llio->comp_id, HAL_IN, &(hm2->ssr.instance[i].hal.pin.rate), + r = hal_pin_new_uint(hm2->llio->comp_id, HAL_IN, &(hm2->ssr.instance[i].hal.pin.rate), 1000*1000, "%s.ssr.%02d.rate", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.ssr.%02d.rate', aborting\n", r, hm2->llio->name, i); @@ -218,7 +218,7 @@ static void hm2_ssr_compute_rate_regs(hostmot2_t *hm2) { for (i = 0; i < hm2->ssr.num_instances; i ++) { rtapi_u32 reg; - rtapi_u32 urate = hal_get_ui32(hm2->ssr.instance[i].hal.pin.rate); + rtapi_uint urate = hal_get_uint(hm2->ssr.instance[i].hal.pin.rate); if (urate <= 0) { // Writing all bits zero to the Rate register clears bit 12, // the enable bit. diff --git a/src/hal/drivers/mesa-hostmot2/tp_pwmgen.c b/src/hal/drivers/mesa-hostmot2/tp_pwmgen.c index fd5fa57530d..18ff25a00c4 100644 --- a/src/hal/drivers/mesa-hostmot2/tp_pwmgen.c +++ b/src/hal/drivers/mesa-hostmot2/tp_pwmgen.c @@ -32,10 +32,10 @@ void hm2_tp_pwmgen_handle_pwm_frequency(hostmot2_t *hm2) { int deadtime; int i; - rtapi_u32 pwm_frequency = hal_get_ui32(hm2->tp_pwmgen.hal->param.pwm_frequency); + rtapi_uint pwm_frequency = hal_get_uint(hm2->tp_pwmgen.hal->param.pwm_frequency); if (pwm_frequency < 1) { - HM2_ERR("3pwmgen.pwm_frequency %d is too low, setting to 1\n", pwm_frequency); - pwm_frequency = hal_set_ui32(hm2->tp_pwmgen.hal->param.pwm_frequency, 1); + HM2_ERR("3pwmgen.pwm_frequency %lu is too low, setting to 1\n", (unsigned long)pwm_frequency); + pwm_frequency = hal_set_uint(hm2->tp_pwmgen.hal->param.pwm_frequency, 1); } @@ -64,10 +64,10 @@ void hm2_tp_pwmgen_handle_pwm_frequency(hostmot2_t *hm2) { // not possible so try the fastest we can // PWMFreq = (ClockHigh * DDS) / (65536 * 2048) dds = 65535; - pwm_frequency = hal_set_ui32(hm2->tp_pwmgen.hal->param.pwm_frequency, + pwm_frequency = hal_set_uint(hm2->tp_pwmgen.hal->param.pwm_frequency, ((double)hm2->tp_pwmgen.clock_frequency * 65535.0) / (65536.0 * 2048.0)); - HM2_ERR("max PWM frequency is %d Hz\n", pwm_frequency); + HM2_ERR("max PWM frequency is %lu Hz\n", (unsigned long)pwm_frequency); hm2->tp_pwmgen.pwmgen_master_rate_dds_reg = dds; } @@ -143,7 +143,7 @@ void hm2_tp_pwmgen_force_write(hostmot2_t *hm2) { hm2->tp_pwmgen.instance[i].written_sampletime = hal_get_real(hm2->tp_pwmgen.instance[i].hal.param.sampletime); } - hm2->tp_pwmgen.written_pwm_frequency = hal_get_ui32(hm2->tp_pwmgen.hal->param.pwm_frequency); + hm2->tp_pwmgen.written_pwm_frequency = hal_get_uint(hm2->tp_pwmgen.hal->param.pwm_frequency); } @@ -157,7 +157,7 @@ void hm2_tp_pwmgen_write(hostmot2_t *hm2) { if (hm2->tp_pwmgen.num_instances == 0) return; // check pwm frequency - if (hal_get_ui32(hm2->tp_pwmgen.hal->param.pwm_frequency) != hm2->tp_pwmgen.written_pwm_frequency) goto force_write; + if (hal_get_uint(hm2->tp_pwmgen.hal->param.pwm_frequency) != hm2->tp_pwmgen.written_pwm_frequency) goto force_write; // update enable register? for (i = 0; i < hm2->tp_pwmgen.num_instances; i ++) { @@ -295,7 +295,7 @@ int hm2_tp_pwmgen_parse_md(hostmot2_t *hm2, int md_index) { // export to HAL { // this hal parameter affects all the 3-Phase pwmgen instances - r = hal_param_new_ui32( + r = hal_param_new_uint( hm2->llio->comp_id, HAL_RW, &(hm2->tp_pwmgen.hal->param.pwm_frequency), diff --git a/src/hal/drivers/mesa-hostmot2/watchdog.c b/src/hal/drivers/mesa-hostmot2/watchdog.c index e65129d4635..b99328e25fb 100644 --- a/src/hal/drivers/mesa-hostmot2/watchdog.c +++ b/src/hal/drivers/mesa-hostmot2/watchdog.c @@ -151,7 +151,7 @@ int hm2_watchdog_parse_md(hostmot2_t *hm2, int md_index) { // params // default timeout is 5 milliseconds (5*1000*1000 nanoseconds) - r = hal_param_new_ui32( + r = hal_param_new_uint( hm2->llio->comp_id, HAL_RW, &(hm2->watchdog.instance[0].hal.param.timeout_ns), @@ -194,7 +194,7 @@ void hm2_watchdog_print_module(hostmot2_t *hm2) { HM2_PRINT(" reset_addr: 0x%04X\n", hm2->watchdog.reset_addr); for (i = 0; i < hm2->watchdog.num_instances; i ++) { HM2_PRINT(" instance %d:\n", i); - HM2_PRINT(" param timeout_ns = %u\n", hal_get_ui32(hm2->watchdog.instance[i].hal.param.timeout_ns)); + HM2_PRINT(" param timeout_ns = %lu\n", (unsigned long)hal_get_uint(hm2->watchdog.instance[i].hal.param.timeout_ns)); HM2_PRINT(" pin has_bit = %d\n", (int)hal_get_bool(hm2->watchdog.instance[i].hal.pin.has_bit)); HM2_PRINT(" reg timer = 0x%08X\n", hm2->watchdog.timer_reg[i]); } @@ -221,7 +221,7 @@ void hm2_watchdog_force_write(hostmot2_t *hm2) { if (hm2->watchdog.num_instances != 1) return; - rtapi_u32 timeout_ns = hal_get_ui32(hm2->watchdog.instance[0].hal.param.timeout_ns); + rtapi_uint timeout_ns = hal_get_uint(hm2->watchdog.instance[0].hal.param.timeout_ns); if (hm2->watchdog.instance[0].enable == 0) { // watchdog is disabled, MSb=1 is secret handshake with FPGA hm2->watchdog.timer_reg[0] = 0x80000000; @@ -233,9 +233,9 @@ void hm2_watchdog_force_write(hostmot2_t *hm2) { // truncate watchdog timeout tmp = 0x7FFFFFFF; hm2->watchdog.timer_reg[0] = tmp; - timeout_ns = hal_set_ui32(hm2->watchdog.instance[0].hal.param.timeout_ns, + timeout_ns = hal_set_uint(hm2->watchdog.instance[0].hal.param.timeout_ns, (tmp + 1) / ((double)hm2->watchdog.clock_frequency / (double)(1000 * 1000 * 1000))); - HM2_ERR("requested watchdog timeout is out of range, setting it to max: %u ns\n", timeout_ns); + HM2_ERR("requested watchdog timeout is out of range, setting it to max: %lu ns\n", (unsigned long)timeout_ns); } } @@ -282,7 +282,7 @@ void hm2_watchdog_write(hostmot2_t *hm2, long period_ns) { hm2->llio->needs_reset = hm2->llio->needs_soft_reset = 0; } - rtapi_u32 timeout_ns = hal_get_ui32(hm2->watchdog.instance[0].hal.param.timeout_ns); + rtapi_uint timeout_ns = hal_get_uint(hm2->watchdog.instance[0].hal.param.timeout_ns); if ( (timeout_ns == hm2->watchdog.instance[0].written_timeout_ns) && @@ -292,10 +292,10 @@ void hm2_watchdog_write(hostmot2_t *hm2, long period_ns) { } // if the requested timeout is dangerously short compared to the petting-period, warn the user once - if (timeout_ns < (1.5 * period_ns)) { + if ((long)timeout_ns < (3 * period_ns / 2)) { HM2_PRINT( - "Watchdog timeout (%u ns) is dangerously short compared to hm2_write() period (%ld ns)\n", - timeout_ns, + "Watchdog timeout (%lu ns) is dangerously short compared to hm2_write() period (%ld ns)\n", + (unsigned long)timeout_ns, period_ns ); } diff --git a/src/hal/drivers/mesa-hostmot2/xy2mod.c b/src/hal/drivers/mesa-hostmot2/xy2mod.c index 35f10a03fd5..0d1c55d6f65 100644 --- a/src/hal/drivers/mesa-hostmot2/xy2mod.c +++ b/src/hal/drivers/mesa-hostmot2/xy2mod.c @@ -89,7 +89,7 @@ void hm2_xy2mod_process_tram_read(hostmot2_t *hm2) { hal_set_bool(s->hal.pin.posy_overflow, mode & (1 << 7)); hal_set_bool(s->hal.pin.velx_overflow, mode & (1 << 8)); hal_set_bool(s->hal.pin.vely_overflow, mode & (1 << 9)); - hal_set_ui32(s->hal.pin.status, status & 0x000FFFFF); + hal_set_uint(s->hal.pin.status, status & 0x000FFFFF); } } @@ -194,12 +194,12 @@ static void hm2_xy2mod_instance_write(hostmot2_t *hm2, int i) { hm2->llio->write(hm2->llio, hm2->xy2mod.accy_addr + istride, &hm2->xy2mod.accy_reg[i], sizeof(rtapi_u32)); s->prev_accy_cmd = accy_cmd; } - hal_set_ui32(s->hal.pin.controlx, hal_get_ui32(s->hal.pin.controlx) & 7); - hal_set_ui32(s->hal.pin.controly, hal_get_ui32(s->hal.pin.controly) & 7); + hal_set_uint(s->hal.pin.controlx, hal_get_uint(s->hal.pin.controlx) & 7); + hal_set_uint(s->hal.pin.controly, hal_get_uint(s->hal.pin.controly) & 7); hm2->xy2mod.mode_reg[i] = - (hal_get_ui32(s->hal.pin.controlx) << 0) | - (hal_get_ui32(s->hal.pin.controly) << 3) | + (hal_get_uint(s->hal.pin.controlx) << 0) | + (hal_get_uint(s->hal.pin.controly) << 3) | (hal_get_bool(s->hal.pin.mode18bitx)<< 10) | (hal_get_bool(s->hal.pin.mode18bity)<< 11) | (hal_get_bool(s->hal.pin.commandmodex)<< 12) | @@ -207,12 +207,12 @@ static void hm2_xy2mod_instance_write(hostmot2_t *hm2, int i) { hm2->llio->write(hm2->llio,hm2->xy2mod.mode_addr + istride, &hm2->xy2mod.mode_reg[i], sizeof(rtapi_u32)); - hal_set_ui32(s->hal.pin.commandx, hal_get_ui32(s->hal.pin.commandx) & 0xFFFF); - hal_set_ui32(s->hal.pin.commandy, hal_get_ui32(s->hal.pin.commandy) & 0xFFFF); + hal_set_uint(s->hal.pin.commandx, hal_get_uint(s->hal.pin.commandx) & 0xFFFF); + hal_set_uint(s->hal.pin.commandy, hal_get_uint(s->hal.pin.commandy) & 0xFFFF); hm2->xy2mod.command_reg[i] = - (hal_get_ui32(s->hal.pin.commandx) << 0) | - (hal_get_ui32(s->hal.pin.commandy) << 16); + (hal_get_uint(s->hal.pin.commandx) << 0) | + (hal_get_uint(s->hal.pin.commandy) << 16); hm2->llio->write(hm2->llio,hm2->xy2mod.command_addr + istride, &hm2->xy2mod.command_reg[i], sizeof(rtapi_u32)); @@ -256,8 +256,8 @@ static void hm2_xy2mod_instance_write(hostmot2_t *hm2, int i) { //reset control bits and overflow flags - hal_set_ui32(s->hal.pin.controlx, 1); // default to 16 bit mode - hal_set_ui32(s->hal.pin.controly, 1); + hal_set_uint(s->hal.pin.controlx, 1); // default to 16 bit mode + hal_set_uint(s->hal.pin.controly, 1); hm2->xy2mod.mode_reg[i] = 0x000003C9; // reset X and Y overflow bits when disabled hm2->llio->write(hm2->llio, hm2->xy2mod.mode_addr + istride, &hm2->xy2mod.mode_reg[i], sizeof(rtapi_u32)); } @@ -266,10 +266,10 @@ static void hm2_xy2mod_instance_write(hostmot2_t *hm2, int i) { static void hm2_xy2mod_set_dpll_rtimer(hostmot2_t *hm2) { rtapi_u32 data = 0; - rtapi_s32 dpll_rtimer_num = hal_get_si32(hm2->xy2mod.hal->pin.dpll_rtimer_num); + rtapi_sint dpll_rtimer_num = hal_get_sint(hm2->xy2mod.hal->pin.dpll_rtimer_num); if ((dpll_rtimer_num < -1) || (dpll_rtimer_num > 4)) { - dpll_rtimer_num = hal_set_si32(hm2->xy2mod.hal->pin.dpll_rtimer_num, 0); + dpll_rtimer_num = hal_set_sint(hm2->xy2mod.hal->pin.dpll_rtimer_num, 0); } if (dpll_rtimer_num > -1) { data = (dpll_rtimer_num << 12) | (1 << 15); @@ -280,10 +280,10 @@ static void hm2_xy2mod_set_dpll_rtimer(hostmot2_t *hm2) { static void hm2_xy2mod_set_dpll_wtimer(hostmot2_t *hm2) { rtapi_u32 data = 0; - rtapi_s32 dpll_wtimer_num = hal_get_si32(hm2->xy2mod.hal->pin.dpll_wtimer_num); + rtapi_sint dpll_wtimer_num = hal_get_sint(hm2->xy2mod.hal->pin.dpll_wtimer_num); if ((dpll_wtimer_num < -1) || (dpll_wtimer_num > 4)) { - dpll_wtimer_num = hal_set_si32(hm2->xy2mod.hal->pin.dpll_wtimer_num, 0); + dpll_wtimer_num = hal_set_sint(hm2->xy2mod.hal->pin.dpll_wtimer_num, 0); } if (dpll_wtimer_num > -1) { data = (dpll_wtimer_num << 12) | (1 << 15); @@ -299,10 +299,10 @@ void hm2_xy2mod_write(hostmot2_t *hm2) { hm2_xy2mod_instance_write(hm2, i); } if (hm2->xy2mod.num_instances > 0 && hm2->dpll_module_present) { - if (hal_get_si32(hm2->xy2mod.hal->pin.dpll_rtimer_num) != hm2->xy2mod.written_dpll_rtimer_num) { + if (hal_get_sint(hm2->xy2mod.hal->pin.dpll_rtimer_num) != hm2->xy2mod.written_dpll_rtimer_num) { hm2_xy2mod_set_dpll_rtimer(hm2); } - if (hal_get_si32(hm2->xy2mod.hal->pin.dpll_wtimer_num) != hm2->xy2mod.written_dpll_wtimer_num) { + if (hal_get_sint(hm2->xy2mod.hal->pin.dpll_wtimer_num) != hm2->xy2mod.written_dpll_wtimer_num) { hm2_xy2mod_set_dpll_wtimer(hm2); } } @@ -521,14 +521,14 @@ int hm2_xy2mod_parse_md(hostmot2_t *hm2, int md_index) { { if (hm2->dpll_module_present) { - r = hal_pin_new_si32(hm2->llio->comp_id, HAL_IN, &(hm2->xy2mod.hal->pin.dpll_rtimer_num), + r = hal_pin_new_sint(hm2->llio->comp_id, HAL_IN, &(hm2->xy2mod.hal->pin.dpll_rtimer_num), -1, "%s.xy2mod.read-timer-number", hm2->llio->name); if (r < 0) { HM2_ERR("error %d adding pin '%s.xy2mod.read-timer-number', aborting\n", r, hm2->llio->name); return -EINVAL; } - r = hal_pin_new_si32(hm2->llio->comp_id, HAL_IN, &(hm2->xy2mod.hal->pin.dpll_wtimer_num), + r = hal_pin_new_sint(hm2->llio->comp_id, HAL_IN, &(hm2->xy2mod.hal->pin.dpll_wtimer_num), -1, "%s.xy2mod.write-timer-number", hm2->llio->name); if (r < 0) { HM2_ERR("error %d adding pin '%s.xy2mod.write-timer-number', aborting\n", r, hm2->llio->name); @@ -629,7 +629,7 @@ int hm2_xy2mod_parse_md(hostmot2_t *hm2, int md_index) { goto fail0; } - r = hal_pin_new_ui32(hm2->llio->comp_id, HAL_IN, &(hm2->xy2mod.instance[i].hal.pin.controlx), + r = hal_pin_new_uint(hm2->llio->comp_id, HAL_IN, &(hm2->xy2mod.instance[i].hal.pin.controlx), 1, "%s.xy2mod.%02d.controlx", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.xy2mod.%02d.controlx', aborting\n", r, hm2->llio->name, i); @@ -637,14 +637,14 @@ int hm2_xy2mod_parse_md(hostmot2_t *hm2, int md_index) { } - r = hal_pin_new_ui32(hm2->llio->comp_id, HAL_IN, &(hm2->xy2mod.instance[i].hal.pin.controly), + r = hal_pin_new_uint(hm2->llio->comp_id, HAL_IN, &(hm2->xy2mod.instance[i].hal.pin.controly), 1, "%s.xy2mod.%02d.controly", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.xy2mod.%02d.controly', aborting\n", r, hm2->llio->name, i); goto fail0; } - r = hal_pin_new_ui32(hm2->llio->comp_id, HAL_IN, &(hm2->xy2mod.instance[i].hal.pin.commandx), + r = hal_pin_new_uint(hm2->llio->comp_id, HAL_IN, &(hm2->xy2mod.instance[i].hal.pin.commandx), 0, "%s.xy2mod.%02d.commandx", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.xy2mod.%02d.commandx', aborting\n", r, hm2->llio->name, i); @@ -652,7 +652,7 @@ int hm2_xy2mod_parse_md(hostmot2_t *hm2, int md_index) { } - r = hal_pin_new_ui32(hm2->llio->comp_id, HAL_IN, &(hm2->xy2mod.instance[i].hal.pin.commandy), + r = hal_pin_new_uint(hm2->llio->comp_id, HAL_IN, &(hm2->xy2mod.instance[i].hal.pin.commandy), 0, "%s.xy2mod.%02d.commandy", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.xy2mod.%02d.commandy', aborting\n", r, hm2->llio->name, i); @@ -716,7 +716,7 @@ int hm2_xy2mod_parse_md(hostmot2_t *hm2, int md_index) { goto fail0; } - r = hal_pin_new_ui32(hm2->llio->comp_id, HAL_OUT, &(hm2->xy2mod.instance[i].hal.pin.status), + r = hal_pin_new_uint(hm2->llio->comp_id, HAL_OUT, &(hm2->xy2mod.instance[i].hal.pin.status), 0, "%s.xy2mod.%02d.status", hm2->llio->name, i); if (r < 0) { HM2_ERR("error %d adding pin '%s.xy2mod.%02d.status', aborting\n", r, hm2->llio->name, i);