Squash a Smart Serial startup bug caused by writing an uninitialised variable to TRAM. Also change the 7i64 pins to match the canonical spec and shut down the cards on exit rather than leaving the watchdog to do it. Signed-off-by: Andy Pugh <an...@bo...> http://git.linuxcnc.org/?p=emc2.git;a=commitdiff;h=900c2f9 --- src/hal/drivers/mesa-hostmot2/mesa_7i64.c | 42 ++++++++++++++++------------- src/hal/drivers/mesa-hostmot2/sserial.c | 12 +++++++- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/hal/drivers/mesa-hostmot2/mesa_7i64.c b/src/hal/drivers/mesa-hostmot2/mesa_7i64.c index 54fc532..6e22ac0 100644 --- a/src/hal/drivers/mesa-hostmot2/mesa_7i64.c +++ b/src/hal/drivers/mesa-hostmot2/mesa_7i64.c @@ -66,30 +66,33 @@ int hm2_7i64_create(hostmot2_t *hm2, hm2_module_descriptor_t *md) { r = hal_pin_bit_newf(HAL_OUT, &(hal->pin.digital_in[p]), hm2->llio->comp_id, - "%s.7i64.%1d.%1d.gpio.%02d.in", - hm2->llio->name, inst->module_index, c, p); + "%s.7i64.%1d.%1d.digin.%02d.in", + hm2->llio->name, inst->module_index, + c, p); if (r < 0) { - HM2_ERR("error adding pin %s.7i64.%1d.%1d.gpio.%02d.in, " - "aborting\n", + HM2_ERR("error adding pin %s.7i64.%1d.%1d.digin.%02d.in" + ", aborting\n", hm2->llio->name, inst->module_index, c, p); goto fail1; } r = hal_pin_bit_newf(HAL_OUT, &(hal->pin.digital_in_not[p]), hm2->llio->comp_id, - "%s.7i64.%1d.%1d.gpio.%02d.in_not", - hm2->llio->name, inst->module_index, c, p); + "%s.7i64.%1d.%1d.digin.%02d.in-not", + hm2->llio->name, inst->module_index, + c, p); if (r < 0) { - HM2_ERR("error adding pin %s.7i64.%1d.%1d.gpio.%02d.in_not, " - "aborting\n", + HM2_ERR("error adding pin %s.7i64.%1d.%1d.digin.%02d." + "in-not, aborting\n", hm2->llio->name, inst->module_index, c, p); goto fail1; } r = hal_pin_bit_newf(HAL_IN, &(hal->pin.digital_out[p]), hm2->llio->comp_id, - "%s.7i64.%1d.%1d.gpio.%02d.out", - hm2->llio->name, inst->module_index, c, p); + "%s.7i64.%1d.%1d.digout.%02d", + hm2->llio->name, inst->module_index, + c, p); if (r < 0) { - HM2_ERR("error adding pin %s.7i64.%1d.%1d.gpio.%02d.out, " + HM2_ERR("error adding pin %s.7i64.%1d.%1d.digout.%02d, " "aborting\n", hm2->llio->name, inst->module_index, c, p); goto fail1; @@ -97,31 +100,32 @@ int hm2_7i64_create(hostmot2_t *hm2, hm2_module_descriptor_t *md) { r = hal_param_bit_newf(HAL_RW, &(hal->param.invert[p]), hm2->llio->comp_id, - "%s.7i64.%1d.%1d.gpio.%02d.invert_output", - hm2->llio->name, inst->module_index, c, p); + "%s.7i64.%1d.%1d.digout.%02d.invert", + hm2->llio->name, inst->module_index, + c, p); if (r < 0) { - HM2_ERR("error adding pin %s.7i64.%1d.%1d.gpio.%02d." - "invert_output, aborting\n", + HM2_ERR("error adding param %s.7i64.%1d.%1d.digout.%02d" + ".invert, aborting\n", hm2->llio->name, inst->module_index, c, p); goto fail1; } } r = hal_pin_float_newf(HAL_OUT, &(hal->pin.analogue_in[0]), hm2->llio->comp_id, - "%s.7i64.%1d.%1d.analogue.00", + "%s.7i64.%1d.%1d.adcin.00.in", hm2->llio->name, inst->module_index, c); if (r < 0) { - HM2_ERR("error adding pin %s.7i64.%1d.%1d.analogue.00, " + HM2_ERR("error adding pin %s.7i64.%1d.%1d.adcin.00.in, " "aborting\n", hm2->llio->name, inst->module_index, c); goto fail1; } r = hal_pin_float_newf(HAL_OUT, &(hal->pin.analogue_in[1]), hm2->llio->comp_id, - "%s.7i64.%1d.%1d.analogue.01", + "%s.7i64.%1d.%1d.adcin.01.in", hm2->llio->name, inst->module_index,c ); if (r < 0) { - HM2_ERR("error adding pin %s.7i64.%1d.%1d.analogue.01, " + HM2_ERR("error adding pin %s.7i64.%1d.%1d.adcin.01.in, " "aborting\n", hm2->llio->name, inst->module_index, c); goto fail1; diff --git a/src/hal/drivers/mesa-hostmot2/sserial.c b/src/hal/drivers/mesa-hostmot2/sserial.c index b51294d..2049cd2 100644 --- a/src/hal/drivers/mesa-hostmot2/sserial.c +++ b/src/hal/drivers/mesa-hostmot2/sserial.c @@ -445,7 +445,8 @@ void hm2_sserial_prepare_tram_write(hostmot2_t *hm2, long period){ } HM2_ERR("sserial_write:" "Timeout waiting for CMD to clear\n"); - // Carry on regardless + *inst->fault_count += inst->fault_inc; + // carry on, nothing much we can do about it } *inst->state &= 0x0F; *inst->command_reg_write = 0x80000000; // mask pointless writes @@ -905,12 +906,20 @@ void hm2_sserial_force_write(hostmot2_t *hm2){ *hm2->sserial.instance[i].state = 0; hm2_sserial_waitfor(hm2, hm2->sserial.instance[i].command_reg_addr, 0xFFFFFFFF, 20); *hm2->sserial.instance[i].run = 1; + *hm2->sserial.instance[i].command_reg_write = 0x80000000; } } void hm2_sserial_cleanup(hostmot2_t *hm2){ int i; + u32 buff; for (i = 1 ; i < hm2->sserial.num_instances; i++){ + //Shut down the sserial devices rather than leave that to the watchdog. + buff = 0x800; + hm2->llio->write(hm2->llio, + hm2->sserial.instance[i].command_reg_addr, + &buff, + sizeof(u32)); if (hm2->sserial.instance[i].tram_8i20 != NULL){ kfree(hm2->sserial.instance[i].tram_8i20); } @@ -919,3 +928,4 @@ void hm2_sserial_cleanup(hostmot2_t *hm2){ } } } + |