From c39a91a6162011ceed36557b51e4de0018e92f4a Mon Sep 17 00:00:00 2001 From: Bertho Stultiens Date: Thu, 2 Jul 2026 15:34:57 +0200 Subject: [PATCH] Preliminary - HAL types update and HAL isolation --- VERSION | 2 +- configs/apps/gladevcp/complex/complex.py | 2 +- .../attic/unclaimed/plasma-thc/mp1000A.hal | 8 +- .../attic/unclaimed/plasma-thc/mp1000B.hal | 8 +- configs/attic/unclaimed/plasma-thc/thc300.hal | 8 +- .../mesa/hm2-modbus/bldc_and_wavebox.mbccs | 36 +- .../brushless-dc-motor-driver.mbccs | 28 +- .../hm2-modbus/hm2-stepper-eth-modbus.hal | 6 +- .../mesa/hm2-modbus/rs485io.mbccs | 8 +- .../mesa/hm2-servo/hm2-servo-eth.hal | 6 +- .../by_interface/mesa/hm2-servo/hm2-servo.hal | 6 +- .../mesa/hm2-stepper/hm2-stepper-eth.hal | 6 +- .../mesa/hm2-stepper/hm2-stepper-rpspi.hal | 6 +- .../mesa/hm2-stepper/hm2-stepper.hal | 6 +- .../mesa/plasma-5i20/plasma-5i20.hal | 6 +- .../parport/plasma-thc-sim/thc.hal | 8 +- .../pico/USC_encod/univstep_io.hal | 6 +- configs/by_interface/pico/ppmc/ppmc_io.hal | 4 +- .../by_interface/pico/univpwm/univpwm_io.hal | 6 +- .../by_interface/pico/univpwmv/univpwm_io.hal | 54 +- .../pico/univpwmv/univpwm_load.hal | 4 +- .../pico/univpwmv/univpwm_motion.hal | 22 +- .../pico/univpwmv/univpwm_servo.hal | 26 +- .../pico/univstep/univstep_io.hal | 6 +- .../Sherline4Axis/standard_pinout.hal | 2 +- configs/by_machine/smithy/1240.hal | 2 +- configs/by_machine/smithy/1240_4axis.hal | 2 +- configs/by_machine/smithy/1240gecko.hal | 2 +- configs/by_machine/smithy/1240rutex.hal | 2 +- configs/by_machine/smithy/1240rutex_4axis.hal | 2 +- configs/by_machine/smithy/516gecko.hal | 2 +- configs/by_machine/smithy/622.hal | 2 +- configs/by_machine/smithy/622_4axis.hal | 2 +- configs/by_machine/smithy/622gecko.hal | 2 +- configs/by_machine/smithy/622keyence.hal | 2 +- configs/by_machine/smithy/622leadshine.hal | 2 +- .../by_machine/smithy/622leadshine_4axis.hal | 2 +- configs/by_machine/smithy/8i20.xml | 24 +- configs/by_machine/smithy/924.hal | 2 +- .../configurable_options/pyvcp/m5i20panel.xml | 48 +- configs/common/shuttle.hal | 12 +- configs/sim/axis/db_demo/db_panel.xml | 20 +- .../dynamic_offsets_panel.hal | 2 +- .../sim/axis/external_offsets/eoffsets.txt | 8 +- .../sim/axis/external_offsets/eoffsets_es.txt | 8 +- configs/sim/axis/gantry/gantry_panel.hal | 12 +- configs/sim/axis/laser/laser.hal | 2 +- configs/sim/axis/laser/pyvcp.xml | 4 +- .../sim/axis/moveoff/moveoff_display_7.xml | 4 +- configs/sim/axis/mtconnect/mtconnect.hal | 10 +- configs/sim/axis/panelui-demo/_panelui.ini | 10 +- configs/sim/axis/pentapod/panel.xml | 8 +- configs/sim/axis/plasma/plasmac2/plasmac2.py | 10 +- .../axis/vismach/VMC_toolchange/sim_vmc.hal | 32 +- .../VMC_toolchange/toolchange_gray.hal | 8 +- .../VMC_toolchange/toolchange_index.hal | 8 +- .../sim/axis/vismach/hexapod-sim/hexapod.xml | 8 +- configs/sim/axis/vismach/scara/scara.xml | 8 +- .../qtdragon_hd_xyz/qtdragon_hd_postgui.hal | 12 +- .../qtdragon_hd_postgui.hal | 12 +- .../screens/qtdragon/qtdragon_handler.py | 12 +- .../1280x1024_5axis/woodpecker_handler.py | 16 +- configs/sim/woodpecker/compensate.py | 2 +- configs/sim/woodpecker/numstr.py | 2 +- configs/sim/woodpecker/python/stdglue.py | 4 +- configs/sim/woodpecker/woodpecker.hal | 8 +- .../woodpecker_/woodpecker_handler.py | 8 +- docs/po4a.cfg | 25 +- docs/src/common/glossary.adoc | 4 +- docs/src/config/ini-homing.adoc | 12 +- docs/src/config/python-hal-interface.adoc | 33 +- .../getting-started/updating-linuxcnc.adoc | 170 ++-- docs/src/gui/gladevcp.adoc | 84 +- docs/src/gui/panelui.adoc | 12 +- docs/src/gui/pyvcp.adoc | 82 +- docs/src/gui/qtdragon.adoc | 38 +- docs/src/gui/qtvcp-custom-widgets.adoc | 2 +- docs/src/gui/qtvcp-libraries.adoc | 10 +- docs/src/gui/qtvcp-vcp-panels.adoc | 2 +- docs/src/gui/qtvcp-vismach.adoc | 20 +- docs/src/gui/qtvcp-widgets.adoc | 40 +- docs/src/hal/basic-hal.adoc | 135 ++- docs/src/hal/comp.adoc | 219 ++--- docs/src/hal/components.adoc | 46 +- docs/src/hal/halmodule.adoc | 28 +- docs/src/hal/parallel-port.adoc | 2 +- docs/src/man/man1/halcompile.1.adoc | 2 + docs/src/man/man1/mesambccc.1.adoc | 70 +- docs/src/man/man3/hal_create_thread.3.adoc | 5 +- docs/src/man/man3/hal_export_funct.3.adoc | 7 +- docs/src/man/man3/rtapi_task_new.3.adoc | 6 +- docs/src/man/man9/demux_generic.9.adoc | 51 +- docs/src/man/man9/motion.9.adoc | 272 +++--- docs/src/man/man9/mux_generic.9.adoc | 43 +- docs/src/man/man9/weighted_sum.9.adoc | 2 +- lib/python/gladevcp/hal_widgets.py | 12 +- lib/python/hal.py | 16 + lib/python/pyvcp_widgets.py | 32 +- lib/python/qtvcp/lib/message.py | 4 +- lib/python/qtvcp/qt_halobjects.py | 4 +- lib/python/qtvcp/widgets/bar.py | 14 +- lib/python/qtvcp/widgets/dialog_widget.py | 2 +- lib/python/qtvcp/widgets/general_hal_input.py | 2 +- .../qtvcp/widgets/general_hal_output.py | 2 +- lib/python/qtvcp/widgets/hal_label.py | 2 +- lib/python/qtvcp/widgets/hal_selectionbox.py | 18 +- lib/python/qtvcp/widgets/joypad.py | 8 +- lib/python/qtvcp/widgets/simple_widgets.py | 24 +- lib/python/qtvcp/widgets/widget_baseclass.py | 2 +- lib/python/raster.py | 2 +- nc_files/remap_lib/python-stdglue/stdglue.py | 4 +- scripts/hal-histogram | 34 +- scripts/hal_demo | 8 +- .../panels/qtplasmac_sim/qtplasmac_sim.ui | 2 +- .../qtplasmac_sim/qtplasmac_sim_handler.py | 2 +- share/qtvcp/panels/sim_panel/sim_panel.ui | 6 +- share/qtvcp/screens/qtaxis/qtaxis_handler.py | 2 +- .../screens/qtdragon/qtdragon_handler.py | 12 +- .../qtdragon_hd/qtdragon_hd_handler.py | 16 +- .../qtdragon_hd_vert_handler.py | 16 +- .../screens/qtdragon_lathe/qtdragon_lathe.ui | 6 +- .../qtdragon_lathe/qtdragon_lathe_handler.py | 12 +- share/qtvcp/screens/qtplasmac/qtplasmac.ui | 2 +- .../screens/qtplasmac/qtplasmac_handler.py | 18 +- .../screens/qtplasmac_4x3/qtplasmac_4x3.ui | 2 +- .../screens/qtplasmac_9x16/qtplasmac_9x16.ui | 2 +- .../screens/qttouchy/qttouchy_handler.py | 2 +- .../screens/woodpecker/woodpecker_handler.py | 8 +- src/Makefile | 2 +- src/emc/motion/axis.c | 14 +- src/emc/motion/command.c | 2 +- src/emc/motion/control.c | 46 +- src/emc/motion/homing.c | 4 +- src/emc/motion/mot_priv.h | 16 +- src/emc/motion/motion.c | 42 +- src/emc/motion/motion.h | 4 +- src/emc/nml_intf/state_tag.h | 3 +- src/emc/rs274ngc/interp_namedparams.cc | 2 - src/emc/rs274ngc/rs274ngc_pre.cc | 2 +- src/emc/usr_intf/axis/scripts/axis.py | 2 +- .../axis/scripts/hal_manualtoolchange.py | 2 +- src/emc/usr_intf/axis/scripts/haltest.py | 10 - src/emc/usr_intf/gmoccapy/gmoccapy.py | 16 +- src/emc/usr_intf/gscreen/gscreen.py | 6 +- src/emc/usr_intf/pncconf/options.glade | 12 +- src/emc/usr_intf/pncconf/tests.py | 18 +- src/emc/usr_intf/pyui/_panelui.ini | 12 +- src/emc/usr_intf/pyui/panelui_spec.ini | 10 +- src/emc/usr_intf/pyui/widgets.py | 12 +- src/emc/usr_intf/stepconf/options.glade | 4 +- src/emc/usr_intf/touchy/hal_interface.py | 2 +- src/hal/classicladder/module_hal.c | 2 +- src/hal/components/.gitignore | 1 + src/hal/components/Submakefile | 156 +--- src/hal/components/abs_s32.comp | 41 - .../{abs_s64.comp => abs_sint.comp} | 2 +- src/hal/components/anglejog.comp | 26 +- src/hal/components/axistest.comp | 4 +- src/hal/components/bin2gray.comp | 6 +- src/hal/components/biquad.comp | 2 +- src/hal/components/bitmerge.comp | 12 +- src/hal/components/bitslice.comp | 10 +- src/hal/components/bitwise.comp | 20 +- src/hal/components/bldc.comp | 37 +- src/hal/components/boss_plc.c | 2 +- src/hal/components/carousel.comp | 40 +- src/hal/components/comp.comp | 1 + src/hal/components/conv_real_bool.comp | 23 + src/hal/components/counter.c | 4 +- src/hal/components/dbounce.comp | 4 +- src/hal/components/debounce.c | 2 +- src/hal/components/demux.comp | 4 +- src/hal/components/demux_generic.c | 105 ++- src/hal/components/edge.comp | 14 +- src/hal/components/encoder.c | 4 +- src/hal/components/encoder_ratio.c | 4 +- src/hal/components/enum.c | 18 +- src/hal/components/eoffset_per_angle.comp | 18 +- src/hal/components/gray2bin.comp | 8 +- src/hal/components/histobins.comp | 40 +- src/hal/components/histobinstream.comp | 34 +- src/hal/components/knob2float.comp | 6 +- src/hal/components/latencybins.comp | 69 +- src/hal/components/lcd.c | 2 +- src/hal/components/limit3.comp | 2 +- src/hal/components/limit_axis.comp | 4 +- src/hal/components/matrix_kb.c | 2 +- src/hal/components/max31855.comp | 2 +- src/hal/components/mesa_pktgyro_test.comp | 2 +- src/hal/components/millturn.comp | 2 +- src/hal/components/mkconv.sh | 92 +- src/hal/components/modmath.c | 2 +- src/hal/components/momentary2nist.comp | 8 +- src/hal/components/moveoff.comp | 6 +- src/hal/components/multiclick.comp | 30 +- src/hal/components/multiswitch.comp | 4 +- src/hal/components/mux16.comp | 6 +- src/hal/components/mux_generic.c | 97 +-- src/hal/components/orient.comp | 8 +- src/hal/components/pid.c | 2 +- src/hal/components/plasmac.comp | 22 +- src/hal/components/pushmsg.comp | 29 +- src/hal/components/pwmgen.c | 4 +- src/hal/components/radiobutton.comp | 16 +- src/hal/components/raster.comp | 22 +- src/hal/components/reset.comp | 32 +- src/hal/components/safety_latch.comp | 12 +- src/hal/components/sample_hold.comp | 4 +- src/hal/components/sampler.c | 6 +- src/hal/components/sampler_usr.c | 6 - ...ed_s32_sums.comp => scaled_sint_sums.comp} | 12 +- src/hal/components/select8.comp | 4 +- src/hal/components/siggen.c | 2 +- src/hal/components/sim_encoder.c | 4 +- src/hal/components/sim_matrix_kb.comp | 2 +- src/hal/components/sphereprobe.comp | 25 +- src/hal/components/spindle.comp | 6 +- src/hal/components/spindle_monitor.comp | 2 +- src/hal/components/stepgen.c | 86 +- src/hal/components/steptest.comp | 6 +- src/hal/components/streamer.c | 6 +- src/hal/components/streamer_usr.c | 6 - src/hal/components/sum2.comp | 2 +- src/hal/components/supply.c | 2 +- src/hal/components/threads.c | 6 +- src/hal/components/threadtest.comp | 2 +- src/hal/components/time.comp | 24 +- src/hal/components/timedelta.comp | 14 +- src/hal/components/toggle.comp | 4 +- src/hal/components/toggle2nist.comp | 8 +- src/hal/components/updown.comp | 8 +- src/hal/components/userkins.comp | 2 +- src/hal/components/watchdog.c | 4 +- src/hal/components/weighted_sum.c | 18 +- src/hal/components/xhc_hb04_util.comp | 16 +- src/hal/components/xyzab_tdr_kins.comp | 2 +- src/hal/components/xyzacb_trsrn.comp | 2 +- src/hal/components/xyzbca_trsrn.comp | 2 +- src/hal/drivers/hal_bb_gpio.c | 4 +- src/hal/drivers/hal_gm.c | 6 +- src/hal/drivers/hal_gpio.c | 6 +- src/hal/drivers/hal_parport.c | 22 +- src/hal/drivers/hal_pi_gpio.c | 6 +- src/hal/drivers/hal_ppmc.c | 4 +- src/hal/drivers/hal_speaker.c | 2 +- src/hal/drivers/mesa-hostmot2/abs_encoder.c | 2 +- src/hal/drivers/mesa-hostmot2/hm2_eth.c | 2 +- src/hal/drivers/mesa-hostmot2/hm2_modbus.c | 160 +--- src/hal/drivers/mesa-hostmot2/hostmot2.c | 10 +- src/hal/drivers/mesa-hostmot2/mesambccc.py | 100 ++- src/hal/drivers/mesa_uart.comp | 8 +- src/hal/drivers/serport.comp | 2 +- src/hal/hal.h | 622 +++++-------- src/hal/hal_lib.c | 822 ++++-------------- src/hal/hal_lib_query.c | 43 +- src/hal/hal_priv.h | 201 ++--- src/hal/halmodule.cc | 121 +-- src/hal/halqrec.hh | 4 + src/hal/halquery.cc | 6 +- src/hal/setps_util.c | 6 - src/hal/user_comps/hal_bridge.py | 2 +- src/hal/user_comps/hal_input.py | 12 +- src/hal/user_comps/mqtt-publisher.py | 4 +- src/hal/user_comps/mtconnect-agent.py | 4 +- src/hal/user_comps/pi500_vfd/pi500_vfd.comp | 4 +- src/hal/user_comps/pyvcp.py | 2 +- src/hal/user_comps/scorbot-er-3.py | 2 +- src/hal/user_comps/sim-torch.py | 10 +- src/hal/user_comps/wj200_vfd/wj200_vfd.comp | 4 +- src/hal/user_comps/xhc-hb04.cc | 6 +- src/hal/user_comps/xhc-whb04b-6/hal.cc | 16 +- src/hal/user_comps/xhc-whb04b-6/hal.h | 14 +- src/hal/user_comps/z_level_compensation.py | 4 +- src/hal/utils/halcmd_commands.cc | 524 ++++++----- src/hal/utils/halcmd_completion.c | 8 +- src/hal/utils/halcompile.g | 214 +++-- src/hal/utils/halrmt.cc | 395 ++++----- src/hal/utils/halsh.c | 12 +- src/hal/utils/meter.c | 10 - src/hal/utils/scope_disp.c | 12 - src/hal/utils/scope_files.c | 14 - src/hal/utils/scope_rt.c | 10 +- src/hal/utils/scope_trig.c | 18 - src/hal/utils/scope_vert.c | 2 - src/rtapi/examples/fifo/fifotask.c | 2 +- src/rtapi/examples/semaphore/master.c | 2 +- src/rtapi/examples/semaphore/slave.c | 2 +- src/rtapi/examples/shmem/shmemtask.c | 2 +- src/rtapi/examples/timer/timertask.c | 2 +- src/rtapi/rtai_rtapi.c | 5 +- src/rtapi/rtapi.h | 6 +- src/rtapi/uspace_rtai.cc | 2 +- src/rtapi/uspace_rtapi_app.cc | 7 +- src/rtapi/uspace_rtapi_app.hh | 3 +- src/rtapi/uspace_rtapi_main.cc | 4 +- tcl/bin/halshow.tcl | 4 +- tests/hal-backslash/expected | 2 +- tests/hal-link-unlink/hallink.py | 4 +- tests/hal-show/expected | 120 +-- tests/hal-show/test.hal | 70 +- .../personalities_mod/4count_2pers.expected | 196 ++--- .../personalities_mod/4names_2pers.expected | 196 ++--- tests/halmodule/comp-set-get/expected | 6 +- tests/halmodule/comp-set-get/test.py | 12 +- tests/halmodule/deprecated/deprecated.py | 18 + tests/halmodule/deprecated/expected | 12 + tests/halmodule/deprecated/test.sh | 2 + tests/halmodule/halquery/expected | 18 +- tests/io-startup/test-ui.py | 2 +- tests/limit3/constraints/test.hal | 24 +- tests/mb2hal/mb2hal.1b/expected | 48 +- tests/mb2hal/mb2hal.2b/expected | 96 +- tests/motion/jogwheel-axis/test-ui.py | 6 +- tests/motion/jogwheel-joint/test-ui.py | 6 +- tests/mux/expected | 68 +- tests/mux/test.hal | 70 +- tests/pyvcp/expected | 48 +- tests/raster/rastertest.py | 10 +- tests/save.0/expected | 10 +- tests/tlo/test-ui.py | 2 +- tests/tool-info/non-random/test-ui.py | 6 +- .../random-no-startup-tool/test-ui.py | 6 +- .../random-with-startup-tool/test-ui.py | 6 +- .../abort-during-change/test-ui.py | 16 +- tests/toolchanger/m61/test-ui.py | 8 +- .../reload-tool/non-random/test-ui.py | 8 +- .../toolchanger/reload-tool/random/test-ui.py | 8 +- .../circular-arcs/configs/vcp.xml | 12 +- 328 files changed, 3695 insertions(+), 4935 deletions(-) delete mode 100644 src/emc/usr_intf/axis/scripts/haltest.py delete mode 100644 src/hal/components/abs_s32.comp rename src/hal/components/{abs_s64.comp => abs_sint.comp} (94%) create mode 100644 src/hal/components/conv_real_bool.comp rename src/hal/components/{scaled_s32_sums.comp => scaled_sint_sums.comp} (72%) create mode 100755 tests/halmodule/deprecated/deprecated.py create mode 100644 tests/halmodule/deprecated/expected create mode 100755 tests/halmodule/deprecated/test.sh diff --git a/VERSION b/VERSION index 72e5166f076..d5de4396c40 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -2.10.0~pre1 +2.10.0~pre2 diff --git a/configs/apps/gladevcp/complex/complex.py b/configs/apps/gladevcp/complex/complex.py index db694758b37..98dd9a449af 100644 --- a/configs/apps/gladevcp/complex/complex.py +++ b/configs/apps/gladevcp/complex/complex.py @@ -124,7 +124,7 @@ def _hal_setup(self,halcomp, builder): # standard hal pins not associated with any widget self.halcomp.newpin("example-out", hal.Type.BOOL, hal.Dir.OUT) - self.halcomp.newpin("example-in", hal.HAL_S32, hal.Dir.IN) + self.halcomp.newpin("example-in", hal.Type.SINT, hal.Dir.IN) # hal pins with change callback. Also unrelated to any HAL widget. # When the pin's value changes the callback is executed. diff --git a/configs/attic/unclaimed/plasma-thc/mp1000A.hal b/configs/attic/unclaimed/plasma-thc/mp1000A.hal index c4935bdc3a5..59e72834910 100644 --- a/configs/attic/unclaimed/plasma-thc/mp1000A.hal +++ b/configs/attic/unclaimed/plasma-thc/mp1000A.hal @@ -16,7 +16,7 @@ loadrt or2 count=9 loadrt scale loadrt sum2 count=5 loadrt xor2 count=4 -loadrt conv_s32_float +loadrt conv_sint_real loadrt edge count=2 # Attach realtime hal components to a realtime thread @@ -32,7 +32,7 @@ addf and2.8 servo-thread addf comp.0 servo-thread addf comp.1 servo-thread addf comp.2 servo-thread -addf conv-s32-float.0 servo-thread +addf conv-sint-real.0 servo-thread addf edge.0 servo-thread addf edge.1 servo-thread addf flipflop.0 servo-thread @@ -178,8 +178,8 @@ net FeedHold xor2.0.out => motion.feed-hold net CHLSwitched xor2.2.out => and2.1.in1 net ArcOKTimer oneshot.2.out => xor2.1.in0 net PierceLatch flipflop.1.out => mux2.0.sel oneshot.0.in -net IgnitionCounterS32 updown.0.count => conv-s32-float.0.in -net IgnitionCounterFloat conv-s32-float.0.out => comp.2.in1 +net IgnitionCounterS32 updown.0.count => conv-sint-real.0.in +net IgnitionCounterFloat conv-sint-real.0.out => comp.2.in1 net IgnitionTimerOff oneshot.1.out-not => updown.0.countup net TorchOff not.2.out => flipflop.1.reset net TorchTurnedOffOrTimeout or2.7.out => or2.6.in1 diff --git a/configs/attic/unclaimed/plasma-thc/mp1000B.hal b/configs/attic/unclaimed/plasma-thc/mp1000B.hal index a65f06ebe11..94bfbbf2a10 100644 --- a/configs/attic/unclaimed/plasma-thc/mp1000B.hal +++ b/configs/attic/unclaimed/plasma-thc/mp1000B.hal @@ -16,7 +16,7 @@ loadrt or2 count=9 loadrt scale loadrt sum2 count=5 loadrt xor2 count=4 -loadrt conv_s32_float +loadrt conv_sint_real loadrt edge count=2 # Attach realtime hal components to a realtime thread @@ -32,7 +32,7 @@ addf and2.8 servo-thread addf comp.0 servo-thread addf comp.1 servo-thread addf comp.2 servo-thread -addf conv-s32-float.0 servo-thread +addf conv-sint-real.0 servo-thread addf edge.0 servo-thread addf edge.1 servo-thread addf flipflop.0 servo-thread @@ -178,8 +178,8 @@ net FeedHold xor2.0.out => motion.feed-hold net CHLSwitched xor2.2.out => and2.1.in1 net ArcOKTimer oneshot.2.out => xor2.1.in0 net PierceLatch flipflop.1.out => mux2.0.sel oneshot.0.in -net IgnitionCounterS32 updown.0.count => conv-s32-float.0.in -net IgnitionCounterFloat conv-s32-float.0.out => comp.2.in1 +net IgnitionCounterS32 updown.0.count => conv-sint-real.0.in +net IgnitionCounterFloat conv-sint-real.0.out => comp.2.in1 net IgnitionTimerOff oneshot.1.out-not => updown.0.countup net TorchOff not.2.out => flipflop.1.reset net TorchTurnedOffOrTimeout or2.7.out => or2.6.in1 diff --git a/configs/attic/unclaimed/plasma-thc/thc300.hal b/configs/attic/unclaimed/plasma-thc/thc300.hal index 8a3d838e509..37950d48b61 100644 --- a/configs/attic/unclaimed/plasma-thc/thc300.hal +++ b/configs/attic/unclaimed/plasma-thc/thc300.hal @@ -16,7 +16,7 @@ loadrt or2 count=9 loadrt scale loadrt sum2 count=5 loadrt xor2 count=4 -loadrt conv_s32_float +loadrt conv_sint_real loadrt edge count=2 # Attach realtime hal components to a realtime thread @@ -32,7 +32,7 @@ addf and2.8 servo-thread addf comp.0 servo-thread addf comp.1 servo-thread addf comp.2 servo-thread -addf conv-s32-float.0 servo-thread +addf conv-sint-real.0 servo-thread addf edge.0 servo-thread addf edge.1 servo-thread addf flipflop.0 servo-thread @@ -178,8 +178,8 @@ net FeedHold xor2.0.out => motion.feed-hold net CHLSwitched xor2.2.out => and2.1.in1 net ArcOKTimer oneshot.2.out => xor2.1.in0 net PierceLatch flipflop.1.out => mux2.0.sel oneshot.0.in -net IgnitionCounterS32 updown.0.count => conv-s32-float.0.in -net IgnitionCounterFloat conv-s32-float.0.out => comp.2.in1 +net IgnitionCounterS32 updown.0.count => conv-sint-real.0.in +net IgnitionCounterFloat conv-sint-real.0.out => comp.2.in1 net IgnitionTimerOff oneshot.1.out-not => updown.0.countup net TorchOff not.2.out => flipflop.1.reset net TorchTurnedOffOrTimeout or2.7.out => or2.6.in1 diff --git a/configs/by_interface/mesa/hm2-modbus/bldc_and_wavebox.mbccs b/configs/by_interface/mesa/hm2-modbus/bldc_and_wavebox.mbccs index 389e7818c71..9205c6b0ed6 100644 --- a/configs/by_interface/mesa/hm2-modbus/bldc_and_wavebox.mbccs +++ b/configs/by_interface/mesa/hm2-modbus/bldc_and_wavebox.mbccs @@ -28,7 +28,7 @@ - + @@ -36,19 +36,19 @@ diff --git a/configs/by_interface/mesa/hm2-modbus/brushless-dc-motor-driver.mbccs b/configs/by_interface/mesa/hm2-modbus/brushless-dc-motor-driver.mbccs index b5ce958b4ac..4806441b8cc 100644 --- a/configs/by_interface/mesa/hm2-modbus/brushless-dc-motor-driver.mbccs +++ b/configs/by_interface/mesa/hm2-modbus/brushless-dc-motor-driver.mbccs @@ -36,7 +36,7 @@ - + @@ -44,19 +44,19 @@ - - Will create a HAL_U32 pin + Will create a HAL_UINT pin - (in) hm2_modbus.0.watcher The 'count' is implicit 1. The data is mapped to U_AB and is clamped. The data is sent every time (resend=1), regardless whether the HAL pin @@ -533,7 +539,7 @@ Recognized '/' attributes: The HAL pin type for interactions. You do not need to specify this attribute for the Modbus functions read/write coil(s) or inputs, `R_COILS` (`1`), `R_INPUTS` (`2`), `W_COIL` (`5`) and `W_COILS` (`15`), as these always use - the 'HAL_BIT' type. + the 'HAL_BOOL' type. *interval* [once,0..3600000000]:: The command repeat interval in micro-seconds. This is the time between repeating this ''. An interval shorter than the time it takes to work @@ -564,12 +570,12 @@ Recognized '/' attributes: *scale* [Boolean]:: Add scaling HAL pins. Modbus read functions `R_REGISTERS` (`3`) and `R_INPUTREGS` (`4`) add extra HAL pins *pin.name.offset* (in, 64-bit 'haltype'), *pin.name.scale* - (in, 'HAL_FLOAT') and *pin.name.scaled* (out, 'HAL_FLOAT'). + + (in, 'HAL_REAL') and *pin.name.scaled* (out, 'HAL_REAL'). + The Modbus write functions `W_REGISTER` (`6`) and `W_REGISTERS` (`16`) create extra HAL pins *pin.name.offset* (in, 64-bit 'haltype') and *pin.name.scale* - (in, 'HAL_FLOAT'). + - The 'scale' attribute is only supported for 'HAL_FLOAT', 'HAL_S32' and 'HAL_S64'. - Default is true for 'HAL_FLOAT' and false for others. The *scale* pin is + (in, 'HAL_REAL'). + + The 'scale' attribute is only supported for 'HAL_REAL' and 'HAL_SINT'. + Default is true for 'HAL_REAL' and false for others. The *scale* pin is initialized to one (1.0) and the *offset* pin is initialized to zero (0). + Scaling is always multiplicative to prevent division-by-zero. The offset is always subtracted before scaling. The scaling action performed and subject to @@ -621,25 +627,25 @@ attributes and can be overridden by adding them to the '' tag. - + ---- diff --git a/docs/src/man/man3/hal_create_thread.3.adoc b/docs/src/man/man3/hal_create_thread.3.adoc index 9289803f210..dbbc8d258ce 100644 --- a/docs/src/man/man3/hal_create_thread.3.adoc +++ b/docs/src/man/man3/hal_create_thread.3.adoc @@ -12,7 +12,7 @@ hal_create_thread - Create a HAL thread ---- #include -int hal_create_thread(const char *name, unsigned long period, int uses_fp); +int hal_create_thread(const char *name, unsigned long period); int hal_thread_delete(const char *name); ---- @@ -22,9 +22,6 @@ name:: The name of the thread. period:: The interval, in nanoseconds, between iterations of the thread. -uses_fp:: - Deprecated and ignored. All threads now unconditionally save and restore - floating point state. This parameter will be removed in a future version. == DESCRIPTION diff --git a/docs/src/man/man3/hal_export_funct.3.adoc b/docs/src/man/man3/hal_export_funct.3.adoc index 3ff00485fab..484cefbd145 100644 --- a/docs/src/man/man3/hal_export_funct.3.adoc +++ b/docs/src/man/man3/hal_export_funct.3.adoc @@ -14,8 +14,8 @@ hal_export_funct, hal_export_functf - create a realtime function callable from a typedef void(*hal_funct_t)(void *arg, long period); -int hal_export_funct(const char *name, hal_funct_t funct, void *arg, int uses_fp, int reentrant, int comp_id); -int hal_export_functf(hal_funct_t funct, void *arg, int uses_fp, int reentrant, int comp_id, const char *fmt, ...); +int hal_export_funct(const char *name, hal_funct_t funct, void *arg, int reentrant, int comp_id); +int hal_export_functf(hal_funct_t funct, void *arg, int reentrant, int comp_id, const char *fmt, ...); ---- == ARGUMENTS @@ -26,9 +26,6 @@ funct:: The pointer to the function. arg:: The argument to be passed as the first parameter of _funct_. -uses_fp:: - Deprecated and ignored. All threads now unconditionally save and restore - floating point state. This parameter will be removed in a future version. reentrant:: If reentrant is non-zero, the function may be preempted and called again before the first call completes. Otherwise, it may only be added to one thread. diff --git a/docs/src/man/man3/rtapi_task_new.3.adoc b/docs/src/man/man3/rtapi_task_new.3.adoc index fd437d71172..5f22d802087 100644 --- a/docs/src/man/man3/rtapi_task_new.3.adoc +++ b/docs/src/man/man3/rtapi_task_new.3.adoc @@ -10,8 +10,7 @@ rtapi_task_new, rtapi_task_delete - create a realtime task [source,c] ---- -int rtapi_task_new(void (*_taskcode_)(void*), void *_arg_, int _prio_, - unsigned long _stacksize_, int _uses_fp_); +int rtapi_task_new(void (*_taskcode_)(void*), void *_arg_, int _prio_, unsigned long _stacksize_); int rtapi_task_delete(int _task_id_); ---- @@ -23,9 +22,6 @@ arg:: An argument to be passed to the _taskcode_ function when the task is started prio:: A task priority value returned by *rtapi_prio_xxxx* -uses_fp:: - Deprecated and ignored. All tasks now unconditionally save and restore - floating point state. This parameter will be removed in a future version. task_id:: A task ID returned by a previous call to *rtapi_task_new* diff --git a/docs/src/man/man9/demux_generic.9.adoc b/docs/src/man/man9/demux_generic.9.adoc index 01d75542fe8..9948af5df4d 100644 --- a/docs/src/man/man9/demux_generic.9.adoc +++ b/docs/src/man/man9/demux_generic.9.adoc @@ -8,7 +8,7 @@ demux_generic - routes a single input signal to one of multiple outputs **loadrt demux_generic config="**____[,____],...**"** -Types: **b** = bit, **f** = float, **s** = signed integer, **u** = unsigned integer +Types: **b** = bool, **f** = real, **s** = sint, **u** = uint Example: **loadrt demux_generic config="**bb8,fu12**"** @@ -16,7 +16,7 @@ Example: == FUNCTIONS -**demux-gen.**_NN_ Depending on the data types can run in either a floating point or non-floating point thread. +**demux-gen.**_NN_ Demultiplexer function. == PINS @@ -25,22 +25,22 @@ Example: demux-gen.NN.sel-bit-BB ───────────────┐ │ │ demux-gen.NN.sel-int ─────────────┐ │ │ │ ┌───────┴─┴─┴─┴───────┐ - │ / o───── ├───── demux-gen.NN.out-[bit/float/s32/u32]-00 -demux-gen.NN.in-[bit/float/s32/u32] ─────┤ ─────o o───── ├───── ... - │ o───── ├───── demux-gen.NN.out-[bit/float/s32/u32]-MM + │ / o───── ├───── demux-gen.NN.out-[bool/real/sint/uint]-00 +demux-gen.NN.in-[bool/real/sint/uint] ───┤ ─────o o───── ├───── ... + │ o───── ├───── demux-gen.NN.out-[bool/real/sint/uint]-MM demux-gen.NN.suppress-no-input ─────┤ │ demux-gen.NN.debounce-us ─────┤ │ └─────────────────────┘ -**demux-gen**.__N__.**suppress-no-input** bit in:: +**demux-gen**.__N__.**suppress-no-input** bool in:: This suppresses changing the output if all select lines are false. This stops unwanted jumps in output between transitions of input but makes in00 unavailable. -**demux-gen**.__N__.**debounce-us** unsigned in:: +**demux-gen**.__N__.**debounce-us** uint in:: sets debounce time in microseconds, e.g. 100000 = a tenth of a second. The selection inputs must be stable this long before the output changes. This helps to ignore 'noisy' switches. -**demux-gen**.__N__.**sel-bit-**__BB__ bit in (BB=0..bit width of _size_):: -**demux-gen**.__N__.**sel-int** unsigned in:: +**demux-gen**.__N__.**sel-bit-**__BB__ bool in (BB=0..bit width of _size_):: +**demux-gen**.__N__.**sel-int** uint in:: The sel-bit pins are only created when the size of the demux_gen component is an integer power of two. Together, these determine to which **out**-__MM__ the **in** value is forwarded. @@ -48,21 +48,20 @@ demux-gen.NN.in-[bit/float/s32/u32] ─────┤ ─────o o─ added on to the integer pin input. It is expected that either one or the other would normally be used. However, the possibility exists to use a higher-order bit to "shift" the values set by the integer pin. -**demux-gen**.__N__.**in-**[**bit**/**float**/**s32**/**u32**] variable-type in:: +**demux-gen**.__N__.**in-**[**bool**/**real**/**sint**/**uint**] variable-type in:: The input value which is routed to an output depending on the selection pins. -**demux-gen**.__N__.**out-**[**bit**/**float**/**s32**/**u32**]**-**__MM__ variable-type out (M=0..size-1):: +**demux-gen**.__N__.**out-**[**bool**/**real**/**sint**/**uint**]**-**__MM__ variable-type out (M=0..size-1):: According to the selection bits and/or the selection number, the selected output follows the **in** value. The other outputs retain the values they had before resp. zero if they have not been selected yet. Values will be - converted/truncated according to standard C rules. This means, for - example that a float input greater than 2147483647 will give an S32 - output of -2147483648. + converted and clamped. This means, for example that a REAL input greater + than (approx.) 2^63^-1 will give a SINT output of 2^63^-1. == PARAMETERS -**demux-gen**.__N__.**elapsed** float r:: +**demux-gen**.__N__.**elapsed** real r:: Current value of the internal debounce timer for debugging. -**demux-gen**.__N__.**selected** s32 r:: +**demux-gen**.__N__.**selected** sint r:: Current value of the internal selection variable after conversion for debugging. Possibly useful for setting up gray-code switches. @@ -73,26 +72,22 @@ It allows the creation of arbitrary-size demultiplexers (up to 1024 entries) and also supports differing data types on the input and output pins. The configuration string is a comma-separated list of code-letters and numbers, such as "bb4,fu12". This would create a -4-element bit-to-bit demux and a 12-element float-to-unsigned demux. +4-element bit-to-bit demux and a 12-element real-to-uint demux. The code letters are: -**b** = bit, -**f** = float, -**s** = signed integer and -**u** = unsigned integer. +**b** = bool (boolean), +**f** = real (floating point), +**s** = sint (signed integer) and +**u** = uint (unsigned integer). The first letter code is the input type, the second is the output type. The codes are not case-sensitive. The order of the letters is significant but the position in the string is not. Do not insert any -spaces in the config string. Any non-zero float value will be converted -to a "true" output in bit form. Be wary that float datatypes can be -very, very, close to zero and not actually be equal to zero. +spaces in the config string. Any non-zero real value will be converted +to a "true" output in bool form when it is more than ±2e-7 from zero. Each demux has its own HAL function and must be added to a thread -separately. If neither input nor output is of type float then the -function is base-thread (non floating-point) safe. Any demux_generic with -a floating point input or output can only be added to a floating-point -thread. +separately. == SEE ALSO diff --git a/docs/src/man/man9/motion.9.adoc b/docs/src/man/man9/motion.9.adoc index 4d2c1840cb9..15ea43cc33a 100644 --- a/docs/src/man/man9/motion.9.adoc +++ b/docs/src/man/man9/motion.9.adoc @@ -105,47 +105,47 @@ digital pins and two analog pins. == MOTION PINS -*motion-command-handler.time* OUT S32:: +*motion-command-handler.time* OUT SINT:: Time (in ns) for the motion module motion-command-handler -*motion-controller.time* OUT S32:: +*motion-controller.time* OUT SINT:: Time (in ns) for the motion module motion-controller -*motion.adaptive-feed* IN FLOAT:: +*motion.adaptive-feed* IN REAL:: When adaptive feed is enabled with M52 P1, the commanded velocity is multiplied by this value. This effect is multiplicative with the NML-level feed override value and motion.feed-hold. Negative values are valid and will run the G-code path in reverse. -**motion.analog-in-**_NN_ IN FLOAT:: +**motion.analog-in-**_NN_ IN REAL:: These pins are used by M66 Enn wait-for-input mode. -**motion.analog-out-**_NN_ OUT FLOAT:: +**motion.analog-out-**_NN_ OUT REAL:: These pins are used by M67-68. -*motion.coord-error* OUT BIT:: +*motion.coord-error* OUT BOOL:: TRUE when motion has encountered an error, such as exceeding a soft limit -*motion.coord-mode* OUT BIT:: +*motion.coord-mode* OUT BOOL:: TRUE when motion is in "coordinated mode", as opposed to "teleop mode" -*motion.current-vel* OUT FLOAT:: +*motion.current-vel* OUT REAL:: Current cartesian velocity -**motion.digital-in-**_NN_ IN BIT:: +**motion.digital-in-**_NN_ IN BOOL:: These pins are used by M66 Pnn wait-for-input mode. -**motion.digital-out-**_NN_ OUT BIT:: +**motion.digital-out-**_NN_ OUT BOOL:: These pins are controlled by the M62 through M65 words. -*motion.distance-to-go* OUT FLOAT:: +*motion.distance-to-go* OUT REAL:: Distance remaining in the current move -*motion.enable* IN BIT:: +*motion.enable* IN BOOL:: If this bit is driven FALSE, motion stops, the machine is placed in the "machine off" state, and a message is displayed for the operator. For normal motion, drive this bit TRUE. -*motion.eoffset-active* OUT BIT:: +*motion.eoffset-active* OUT BOOL:: Indicates external offsets are active (non-zero) -*motion.eoffset-limited* OUT BIT:: +*motion.eoffset-limited* OUT BOOL:: Indicates motion with external offsets was limited by a soft limit constraint ([AXIS_L]MIN_LIMIT,MAX_LIMIT). -*motion.feed-hold* IN BIT:: +*motion.feed-hold* IN BOOL:: When Feed Stop Control is enabled with M53 P1, and this bit is TRUE, the feed rate is set to 0. Note: feed-hold applies to G-code commands -- not jogs. -*motion.feed-inhibit* IN BIT:: +*motion.feed-inhibit* IN BOOL:: When this pin is TRUE, machine motion is inhibited for G-code commands. If the machine is performing a spindle synchronized move when this pin @@ -161,7 +161,7 @@ Motion resumes when this pin goes FALSE. Note: feed-inhibit applies to G-code commands -- not jogs. -*motion.feed-upm* OUT FLOAT:: +*motion.feed-upm* OUT REAL:: Current feed rate in G-code program units per minute for motion.motion-type feed(2) and arc(3). Value is the G-code program F value multiplied by the current feed override value and the @@ -169,53 +169,53 @@ Note: feed-inhibit applies to G-code commands -- not jogs. motion.feed-hold or motion.feed-inhibit are asserted. If units (G20 or G21) are not specified in the G-code file then units will be the last units used. -*motion.feed-inches-per-minute* OUT FLOAT:: +*motion.feed-inches-per-minute* OUT REAL:: Current feed rate in inches per minute for motion.motion-type feed(2) and arc(3). Value is the inch equivalent of the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted. -*motion.feed-inches-per-second* OUT FLOAT:: +*motion.feed-inches-per-second* OUT REAL:: Current feed rate in inches per second for motion.motion-type feed(2) and arc(3). Value is the inch equivalent of the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted. -*motion.feed-mm-per-minute* OUT FLOAT:: +*motion.feed-mm-per-minute* OUT REAL:: Current feed rate in mm per minute for motion.motion-type feed(2) and arc(3). Value is the mm equivalent of the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted. -*motion.feed-mm-per-second* OUT FLOAT:: +*motion.feed-mm-per-second* OUT REAL:: Current feed rate in mm per second for motion.motion-type feed(2) and arc(3). Value is the mm equivalent of the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted. -*motion.homing-inhibit* IN BIT:: +*motion.homing-inhibit* IN BOOL:: If this bit is TRUE, initiation of any joint homing move (including "Home All") is disallowed and an error is reported. By default, homing is allowed in joint mode whenever motion is enabled. -*motion.is-all-homed* OUT BIT:: +*motion.is-all-homed* OUT BOOL:: TRUE if all active joints is homed. -*motion.jog-inhibit* IN BIT:: +*motion.jog-inhibit* IN BOOL:: If this bit is TRUE, jogging of any joint or axis is disallowed and an error is reported. -*motion.jog-stop* IN BIT:: +*motion.jog-stop* IN BOOL:: If any jog is active when the pin state changes to TRUE then that jog will be stopped following the associated acceleration values. -*motion.jog-stop-immediate* IN BIT:: +*motion.jog-stop-immediate* IN BOOL:: If any jog is active when the pin state changes to TRUE then that jog will be stopped immediately. -*motion.jog-is-active* OUT BIT:: +*motion.jog-is-active* OUT BOOL:: TRUE if any joint or axis is jogging. -*motion.in-position* OUT BIT:: +*motion.in-position* OUT BOOL:: TRUE if the machine is in position (i.e., not currently moving towards the commanded position). -**motion.misc-error-**_NN_ IN BIT:: +**motion.misc-error-**_NN_ IN BOOL:: Extra error inputs for faults such as over-temperature sensors, low coolant warnings, custom HAL component errors. If driven TRUE this will disable a machine. Similar to spindle.amp-fault-in. -*motion.motion-enabled* OUT BIT:: +*motion.motion-enabled* OUT BOOL:: + -*motion.motion-type* OUT S32:: +*motion.motion-type* OUT SINT:: These values are from src/emc/nml_intf/motion_types.h: 0: Idle (no motion) @@ -233,24 +233,24 @@ Note: feed-inhibit applies to G-code commands -- not jogs. 6: Rotary unlock for traverse -*motion.on-soft-limit* OUT BIT:: -*motion.probe-input* IN BIT:: +*motion.on-soft-limit* OUT BOOL:: +*motion.probe-input* IN BOOL:: G38.n uses the value on this pin to determine when the probe has made contact. TRUE for probe contact closed (touching), FALSE for probe contact open. -*motion.program-line* OUT S32:: +*motion.program-line* OUT SINT:: The current program line while executing. Zero if not running or between lines while single stepping. -*motion.requested-vel* OUT FLOAT:: +*motion.requested-vel* OUT REAL:: The current requested velocity in user units per second. This value is the F-word setting from the G-code file, possibly reduced to accommodate machine velocity and acceleration limits. The value on this pin does not reflect the feed override or any other adjustments. -*motion.servo.last-period* OUT U32:: +*motion.servo.last-period* OUT UINT:: Time (in ns) between invocations of the servo thread. Typically, this number divided by the CPU speed gives the time in seconds, and can be used to determine whether the realtime motion controller is meeting its timing constraints -*motion.switchkins-type* IN float:: +*motion.switchkins-type* IN REAL:: Kinematics modules that define the functions kinematicsSwitchable() and kinematicsSwitch() receive the *integer* value of this pin to select the machine kinematics functions. Extra G-code commands are @@ -263,15 +263,15 @@ Note: feed-inhibit applies to G-code commands -- not jogs. deprecation once, the first time the pin is used to change the kinematics. The pin is in a grace period: it keeps working for now, but is meant to be removed in the future. -*motion.kins-type* OUT float:: +*motion.kins-type* OUT REAL:: The kinematics currently in force, whether it was selected by *G12.1*, by *G13.1* or from *motion.switchkins-type*. A kinematics type the module refuses is not reported here. -*motion.teleop-mode* OUT BIT:: +*motion.teleop-mode* OUT BOOL:: Motion mode is teleop (axis coordinate jogging available). -*motion.tooloffset.L* OUT FLOAT:: +*motion.tooloffset.L* OUT REAL:: Current tool offset for each axis where (*L* is the axis letter, one of: *x y z a b c u v w*) -*motion.tp-reverse* OUT BIT:: +*motion.tp-reverse* OUT BOOL:: Trajectory planning is reversed (reverse run) === Interpreter Metadata Pins @@ -280,10 +280,10 @@ These pins provide geometric intent and interpreter state for the segment of mot ==== Interpreter Status Pins -* `motion.interp.line-number` (s32, out) + +* `motion.interp.line-number` (sint, out) + The current G-code line number being executed. -* `motion.interp.motion-type` (s32, out) + +* `motion.interp.motion-type` (sint, out) + The type of motion currently in progress: ** 0: None ** 1: Rapid (G0) @@ -291,30 +291,30 @@ These pins provide geometric intent and interpreter state for the segment of mot ** 3: Arc (G2, G3) ** 4: Tool Change/Other -* `motion.interp.feedrate` (float, out) + +* `motion.interp.feedrate` (real, out) + The interpreted feedrate for the current segment in units per minute. ==== Interpreter Geometric Pins -* `motion.interp.heading` (float, out) + +* `motion.interp.heading` (real, out) + The XY plane heading of the current linear move in degrees. Measured counter-clockwise from the +X axis (0 to 360). This could be used to control a tangential knife. -* `motion.interp.arc-radius` (float, out) + +* `motion.interp.arc-radius` (real, out) + The radius of the current circular move. This value is 0.0 during linear moves. This could be used to modify plasma cutting parameters based on the arc radius and when hole cutting. -* `motion.interp.arc-center-x` (float, out) + +* `motion.interp.arc-center-x` (real, out) + The absolute X-coordinate of the center point for the current arc. 0 if in YZ plane -* `motion.interp.arc-center-y` (float, out) + +* `motion.interp.arc-center-y` (real, out) + The absolute Y-coordinate of the center point for the current arc. 0 if in XZ plane -* `motion.interp.arc-center-z` (float, out) + +* `motion.interp.arc-center-z` (real, out) + The absolute Y-coordinate of the center point for the current arc if in XZ or YZ plane. -* `motion.interp.normal-heading` (float, out) + +* `motion.interp.normal-heading` (real, out) + the heading from the current point back to the arc centre for the current arc. - * `motion.interp.iscircle` (bit, out) + + * `motion.interp.iscircle` (bool, out) + True if the current arc is a full circle and not a helix. [NOTE] @@ -324,52 +324,52 @@ These pins represent the *commanded geometric intent* from the interpreter and a (*L* is the axis letter, one of: *x y z a b c u v w*) -**axis.**_L_**.eoffset** OUT FLOAT:: +**axis.**_L_**.eoffset** OUT REAL:: Current external offset. -**axis.**_L_**.eoffset-clear** IN BIT:: +**axis.**_L_**.eoffset-clear** IN BOOL:: Clear external offset request -**axis.**_L_**.eoffset-counts** IN S32:: +**axis.**_L_**.eoffset-counts** IN SINT:: Counts input for external offset. The eoffset-counts are transferred to an internal register. The applied external offset is the product of the register counts and the eoffset-scale value. The register is *reset to zero at each machine startup*. If the machine is turned off with an external offset active, the eoffset-counts pin should be set to zero before restarting. -**axis.**_L_**.eoffset-enable** IN BIT:: +**axis.**_L_**.eoffset-enable** IN BOOL:: Enable for external offset (also requires INI file setting for [AXIS_L]OFFSET_AV_RATIO) -**axis.**_L_**.eoffset-request** OUT FLOAT:: +**axis.**_L_**.eoffset-request** OUT REAL:: Debug pin for requested external offset. -**axis.**_L_**.eoffset-scale** IN FLOAT:: +**axis.**_L_**.eoffset-scale** IN REAL:: Scale for external offset. -**axis.**_L_**.jog-accel-fraction** IN FLOAT:: +**axis.**_L_**.jog-accel-fraction** IN REAL:: Sets acceleration for wheel jogging to a fraction of the INI max_acceleration for the axis. Values greater than 1 or less than zero are ignored. -**axis.**_L_**.jog-counts** IN S32:: +**axis.**_L_**.jog-counts** IN SINT:: Connect to the "counts" pin of an external encoder to use a physical jog wheel. -**axis.**_L_**.jog-enable** IN BIT:: +**axis.**_L_**.jog-enable** IN BOOL:: When TRUE (and in manual mode), any change to "jog-counts" will result in motion. When false, "jog-counts" is ignored. -**axis.**_L_**.jog-scale** IN FLOAT:: +**axis.**_L_**.jog-scale** IN REAL:: Sets the distance moved for each count on "jog-counts", in machine units. -**axis.**_L_**.jog-vel-mode** IN BIT:: +**axis.**_L_**.jog-vel-mode** IN BOOL:: When FALSE (the default), the jogwheel operates in position mode. The axis will move exactly jog-scale units for each count, regardless of how long that might take. When TRUE, the wheel operates in velocity mode - motion stops when the wheel stops, even if that means the commanded motion is not completed. -**axis.**_L_**.kb-jog-active** OUT BIT:: +**axis.**_L_**.kb-jog-active** OUT BOOL:: (free planner axis jogging active (keyboard or halui)) -**axis.**_L_**.pos-cmd** OUT FLOAT:: +**axis.**_L_**.pos-cmd** OUT REAL:: The axis commanded position. There may be several offsets between the axis and motor coordinates: Backlash compensation, screw error compensation, and home offsets. External offsets are reported separately (axis._L_.eoffset). -**axis.**_L_**.teleop-pos-cmd** OUT FLOAT:: -**axis.**_L_**.teleop-tp-enable** OUT BIT:: +**axis.**_L_**.teleop-pos-cmd** OUT REAL:: +**axis.**_L_**.teleop-tp-enable** OUT BOOL:: TRUE when the "teleop planner" is enabled for this axis. -**axis.**_L_**.teleop-vel-cmd** OUT FLOAT:: +**axis.**_L_**.teleop-vel-cmd** OUT REAL:: The axis's commanded velocity. -**axis.**_L_**.teleop-vel-lim** OUT FLOAT:: +**axis.**_L_**.teleop-vel-lim** OUT REAL:: The velocity limit for the teleop planner. -**axis.**_L_**.wheel-jog-active** OUT BIT:: +**axis.**_L_**.wheel-jog-active** OUT BOOL:: + == JOINT PINS @@ -378,97 +378,97 @@ _N_ is the joint number (0 ... _num_joints_-1)) Note: Pins marked *(DEBUG)* serve as debugging aids and are subject to change or removal at any time. -**joint.**_N_**.acc-cmd** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.acc-cmd** OUT REAL *(DEBUG)*:: The joint's commanded acceleration. -**joint.**_N_**.active** OUT BIT *(DEBUG)*:: +**joint.**_N_**.active** OUT BOOL *(DEBUG)*:: TRUE when this joint is active. -**joint.**_N_**.amp-enable-out** OUT BIT:: +**joint.**_N_**.amp-enable-out** OUT BOOL:: TRUE if the amplifier for this joint should be enabled. -**joint.**_N_**.amp-fault-in** IN BIT:: +**joint.**_N_**.amp-fault-in** IN BOOL:: Should be driven TRUE if an external fault is detected with the amplifier for this joint. -**joint.**_N_**.backlash-corr** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.backlash-corr** OUT REAL *(DEBUG)*:: Backlash or screw compensation raw value. -**joint.**_N_**.backlash-filt** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.backlash-filt** OUT REAL *(DEBUG)*:: Backlash or screw compensation filtered value (respecting motion limits). -**joint.**_N_**.backlash-vel** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.backlash-vel** OUT REAL *(DEBUG)*:: Backlash or screw compensation velocity. -**joint.**_N_**.coarse-pos-cmd** OUT FLOAT *(DEBUG)*:: -**joint.**_N_**.error** OUT BIT *(DEBUG)*:: +**joint.**_N_**.coarse-pos-cmd** OUT REAL *(DEBUG)*:: +**joint.**_N_**.error** OUT BOOL *(DEBUG)*:: TRUE when t*his joint has encountered an error, such as a limit switch closing. -**joint.**_N_**.f-error** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.f-error** OUT REAL *(DEBUG)*:: The actual following error. -**joint.**_N_**.f-error-lim** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.f-error-lim** OUT REAL *(DEBUG)*:: The following error limit. -**joint.**_N_**.f-errored** OUT BIT *(DEBUG)*:: +**joint.**_N_**.f-errored** OUT BOOL *(DEBUG)*:: TRUE when this joint has exceeded the following error limit. -**joint.**_N_**.faulted** OUT BIT *(DEBUG)*:: -**joint.**_N_**.free-pos-cmd** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.faulted** OUT BOOL *(DEBUG)*:: +**joint.**_N_**.free-pos-cmd** OUT REAL *(DEBUG)*:: The "free planner" commanded position for this joint. -**joint.**_N_**.free-tp-enable** OUT BIT *(DEBUG)*:: +**joint.**_N_**.free-tp-enable** OUT BOOL *(DEBUG)*:: TRUE when the "free planner" is enabled for this joint. -**joint.**_N_**.free-vel-lim** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.free-vel-lim** OUT REAL *(DEBUG)*:: The velocity limit for the free planner. -**joint.**_N_**.home-state** OUT S32 *(DEBUG)*:: +**joint.**_N_**.home-state** OUT SINT *(DEBUG)*:: homing state machine state -**joint.**_N_**.home-sw-in** IN BIT:: +**joint.**_N_**.home-sw-in** IN BOOL:: Should be driven TRUE if the home switch for this joint is closed. -**joint.**_N_**.homed** OUT BIT *(DEBUG)*:: +**joint.**_N_**.homed** OUT BOOL *(DEBUG)*:: TRUE if the joint has been homed. -**joint.**_N_**.homing** OUT BIT:: +**joint.**_N_**.homing** OUT BOOL:: TRUE if the joint is currently homing. -**joint.**_N_**.in-position** OUT BIT *(DEBUG)*:: +**joint.**_N_**.in-position** OUT BOOL *(DEBUG)*:: TRUE if the joint is using the "free planner" and has come to a stop. -**joint.**_N_**.index-enable** IO BIT:: +**joint.**_N_**.index-enable** IO BOOL:: Should be attached to the index-enable pin of the joint's encoder to enable homing to index pulse. -**joint.**_N_**.is-unlocked** IN BIT:: +**joint.**_N_**.is-unlocked** IN BOOL:: Indicates joint is unlocked (see JOINT UNLOCK PINS). -**joint.**_N_**.jog-accel-fraction** IN FLOAT:: +**joint.**_N_**.jog-accel-fraction** IN REAL:: Sets acceleration for wheel jogging to a fraction of the INI max_acceleration for the joint. Values greater than 1 or less than zero are ignored. -**joint.**_N_**.jog-counts** IN S32:: +**joint.**_N_**.jog-counts** IN SINT:: Connect to the "counts" pin of an external encoder to use a physical jog wheel. -**joint.**_N_**.jog-enable** IN BIT:: +**joint.**_N_**.jog-enable** IN BOOL:: When TRUE (and in manual mode), any change to "jog-counts" will result in motion. When false, "jog-counts" is ignored. -**joint.**_N_**.jog-scale** IN FLOAT:: +**joint.**_N_**.jog-scale** IN REAL:: Sets the distance moved for each count on "jog-counts", in machine units. -**joint.**_N_**.jog-vel-mode** IN BIT:: +**joint.**_N_**.jog-vel-mode** IN BOOL:: When FALSE (the default), the jogwheel operates in position mode. The joint will move exactly jog-scale units for each count, regardless of how long that might take. When TRUE, the wheel operates in velocity mode - motion stops when the wheel stops, even if that means the commanded motion is not completed. -**joint.**_N_**.kb-jog-active** OUT BIT *(DEBUG)*:: +**joint.**_N_**.kb-jog-active** OUT BOOL *(DEBUG)*:: (free planner joint jogging active (keyboard or halui)) -**joint.**_N_**.motor-offset** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.motor-offset** OUT REAL *(DEBUG)*:: joint motor offset established when joint is homed. -**joint.**_N_**.motor-pos-cmd** OUT FLOAT:: +**joint.**_N_**.motor-pos-cmd** OUT REAL:: The commanded position for this joint. -**joint.**_N_**.motor-pos-fb** IN FLOAT:: +**joint.**_N_**.motor-pos-fb** IN REAL:: The actual position for this joint. -**joint.**_N_**.neg-hard-limit** OUT BIT *(DEBUG)*:: +**joint.**_N_**.neg-hard-limit** OUT BOOL *(DEBUG)*:: The negative hard limit for the joint -**joint.**_N_**.neg-lim-sw-in** IN BIT:: +**joint.**_N_**.neg-lim-sw-in** IN BOOL:: Should be driven TRUE if the negative limit switch for this joint is tripped. -**joint.**_N_**.pos-cmd** OUT FLOAT:: +**joint.**_N_**.pos-cmd** OUT REAL:: The joint (as opposed to motor) commanded position. There may be several offsets between the joint and motor coordinates: backlash compensation, screw error compensation, and home offsets. -**joint.**_N_**.pos-fb** OUT FLOAT:: +**joint.**_N_**.pos-fb** OUT REAL:: The joint feedback position. This value is computed from the actual motor position minus joint offsets. Useful for machine visualization. -**joint.**_N_**.pos-hard-limit** OUT BIT *(DEBUG)*:: +**joint.**_N_**.pos-hard-limit** OUT BOOL *(DEBUG)*:: The positive hard limit for the joint. -**joint.**_N_**.pos-lim-sw-in** IN BIT:: +**joint.**_N_**.pos-lim-sw-in** IN BOOL:: Should be driven TRUE if the positive limit switch for this joint is tripped. -**joint.**_N_**.unlock** OUT BIT:: +**joint.**_N_**.unlock** OUT BOOL:: TRUE if the axis is a locked joint (typically a rotary) and a move is commanded (see JOINT UNLOCK PINS). -**joint.**_N_**.vel-cmd** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.vel-cmd** OUT REAL *(DEBUG)*:: The joint's commanded velocity. -**joint.**_N_**.jerk-cmd** OUT FLOAT *(DEBUG)*:: +**joint.**_N_**.jerk-cmd** OUT REAL *(DEBUG)*:: The joint's commanded jerk (rate of change of acceleration). Only active when S-curve trajectory planning is enabled (INI file [TRAJ]PLANNER_TYPE=1 and [TRAJ]MAX_LINEAR_JERK>0). Jerk limits are set via INI file [JOINT_N]MAX_JERK or via the ini.N.max_jerk HAL pin. -**joint.**_N_**.wheel-jog-active** OUT BIT *(DEBUG)*:: +**joint.**_N_**.wheel-jog-active** OUT BOOL *(DEBUG)*:: + == JOINT posthome pins @@ -491,78 +491,78 @@ Example: loadrt motmod ... **unlock_joints_mask=**0x38 creates unlock pins for j (_M_ is the spindle number (*0* ... *num_spindles-1*)) -**spindle.**_M_**.amp-fault-in** IN BIT:: +**spindle.**_M_**.amp-fault-in** IN BOOL:: Should be driven TRUE if an external fault is detected with the amplifier for this spindle. -**spindle.**_M_**.at-speed** IN BIT:: +**spindle.**_M_**.at-speed** IN BOOL:: Motion will pause until this pin is TRUE, under the following conditions: Before the first feed move after each spindle start or speed change; before the start of every chain of spindle-synchronized moves; and if in CSS mode, at every rapid->feed transition. -**spindle.**_M_**.brake** OUT BIT:: +**spindle.**_M_**.brake** OUT BOOL:: TRUE when the spindle brake should be applied. -**spindle.**_M_**.forward** OUT BIT:: +**spindle.**_M_**.forward** OUT BOOL:: TRUE when the spindle should rotate forward. -**spindle.**_M_**.index-enable** I/O BIT:: +**spindle.**_M_**.index-enable** IO BOOL:: For correct operation of spindle synchronized moves, this signal must be hooked to the index-enable pin of the spindle encoder. -**spindle.**_M_**.inhibit** IN BIT:: +**spindle.**_M_**.inhibit** IN BOOL:: When TRUE, the spindle speed is set and held to 0. -**spindle.**_M_**.is-oriented** IN BIT:: +**spindle.**_M_**.is-oriented** IN BOOL:: Acknowledge pin for spindle-orient. Completes orient cycle. If spindle-orient was true when spindle-is-oriented was asserted, the spindle-orient pin is cleared and the spindle-locked pin is asserted. Also, the spindle-brake pin is asserted. -**spindle.**_M_**.locked** OUT BIT:: +**spindle.**_M_**.locked** OUT BOOL:: Spindle orient complete pin. Cleared by any of M3, M4 or M5. -**spindle.**_M_**.on** OUT BIT:: +**spindle.**_M_**.on** OUT BOOL:: TRUE when spindle should rotate. -**spindle.**_M_**.orient** OUT BIT:: +**spindle.**_M_**.orient** OUT BOOL:: Indicates start of spindle orient cycle. Set by M19. Cleared by any of M3, M4 or M5. If spindle-orient-fault is not zero during spindle-orient true, the M19 command fails with an error message. -**spindle.**_M_**.orient-angle** OUT FLOAT:: +**spindle.**_M_**.orient-angle** OUT REAL:: Desired spindle orientation for M19. Value of the M19 R word parameter plus the value of the [RS274NGC]ORIENT_OFFSET INI parameter. -**spindle.**_M_**.orient-fault** IN S32:: +**spindle.**_M_**.orient-fault** IN SINT:: Fault code input for orient cycle. Any value other than zero will cause the orient cycle to abort. -**spindle.**_M_**.orient-mode** OUT BIT:: +**spindle.**_M_**.orient-mode** OUT BOOL:: Desired spindle rotation mode. Reflects M19 P parameter word. -**spindle.**_M_**.reverse** OUT BIT:: +**spindle.**_M_**.reverse** OUT BOOL:: TRUE when the spindle should rotate backward. -**spindle.**_M_**.revs** IN FLOAT:: +**spindle.**_M_**.revs** IN REAL:: For correct operation of spindle synchronized moves, this signal must be hooked to the position pin of the spindle encoder. -**spindle.**_M_**.speed-cmd-rps** FLOAT OUT:: +**spindle.**_M_**.speed-cmd-rps** OUT REAL:: Commanded spindle speed in units of revolutions per second. -**spindle.**_M_**.speed-in** IN FLOAT:: +**spindle.**_M_**.speed-in** IN REAL:: Actual spindle speed feedback in revolutions per second; used for G96 (constant surface speed) and G95 (feed per revolution) modes. -**spindle.**_M_**.speed-out** OUT FLOAT:: +**spindle.**_M_**.speed-out** OUT REAL:: Desired spindle speed in rotations per minute. -**spindle.**_M_**.speed-out-abs** OUT FLOAT:: +**spindle.**_M_**.speed-out-abs** OUT REAL:: Desired spindle speed in rotations per minute, always positive regardless of spindle direction. -**spindle.**_M_**.speed-out-rps** OUT FLOAT:: +**spindle.**_M_**.speed-out-rps** OUT REAL:: Desired spindle speed in rotations per second. -**spindle.**_M_**.speed-out-rps-abs** OUT FLOAT:: +**spindle.**_M_**.speed-out-rps-abs** OUT REAL:: Desired spindle speed in rotations per second, always positive regardless of spindle direction. == MOTION PARAMETERS Many of the parameters serve as debugging aids, and are subject to change or removal at any time. -*motion-command-handler.tmax* RW S32:: +*motion-command-handler.tmax* RW SINT:: Show information about the execution time of these HAL functions in ns. -*motion-command-handler.tmax-increased* RO BIT:: +*motion-command-handler.tmax-increased* RO BOOL:: -*motion-controller.tmax* RW S32:: +*motion-controller.tmax* RW SINT:: Show information about the execution time of these HAL functions in ns. -*motion-controller.tmax-increased* RO BIT:: +*motion-controller.tmax-increased* RO BOOL:: + **motion.debug-**_*_:: diff --git a/docs/src/man/man9/mux_generic.9.adoc b/docs/src/man/man9/mux_generic.9.adoc index 16f28d729c9..e02b068aa7f 100644 --- a/docs/src/man/man9/mux_generic.9.adoc +++ b/docs/src/man/man9/mux_generic.9.adoc @@ -8,13 +8,13 @@ mux_generic - select one from several inputs and forwards it to a single output **loadrt mux_generic config="**____[,____],...**"** -Types: **b** = bit, **f** = float, **s** = signed integer, **u** = unsigned integer +Types: **b** = bool, **f** = real, **s** = sint, **u** = uint Example: **loadrt mux_generic config="**bb8,fu12**"** == FUNCTIONS -**mux-gen.**_NN_ Depending on the data types can run in either a floating point or non-floating point thread. +**mux-gen.**_NN_ Multiplexer function. == PINS @@ -23,23 +23,23 @@ Example: **loadrt mux_generic config="**bb8,fu12**"** mux-gen.NN.sel-bit-BB ───────────────┐ │ │ mux-gen.NN.sel-int ─────────────┐ │ │ │ ┌───────┴─┴─┴─┴───────┐ -mux-gen.NN.in-[bit/float/s32/u32]-00 ─────┤ ─────o \ │ - ... ─────┤ ─────o o───── ├───── mux-gen.NN.out-[bit/float/s32/u32] -mux-gen.NN.in-[bit/float/s32/u32]-MM ─────┤ ─────o │ +mux-gen.NN.in-[bool/real/sint/uint]-00 ───┤ ─────o \ │ + ... ─────┤ ─────o o───── ├───── mux-gen.NN.out-[bool/real/sint/uint] +mux-gen.NN.in-[bool/real/sint/uint]-MM ───┤ ─────o │ │ │ mux-gen.NN.suppress-no-input ─────┤ │ mux-gen.NN.debounce-us ─────┤ │ └─────────────────────┘ -**mux-gen**.__N__.**suppress-no-input** bit in:: +**mux-gen**.__N__.**suppress-no-input** bool in:: This suppresses changing the output if all select lines are false. This stops unwanted jumps in output between transitions of input but makes in00 unavailable. -**mux-gen**.__N__.**debounce-us** unsigned in:: +**mux-gen**.__N__.**debounce-us** uint in:: sets debounce time in microseconds, e.g. 100000 = a tenth of a second. The selection inputs must be stable this long before the output changes. This helps to ignore 'noisy' switches. **mux-gen**.__N__.**sel-bit-**__BB__ bit in (BB=0..bit width of _size_):: -**mux-gen**.__N__.**sel-int** unsigned in:: +**mux-gen**.__N__.**sel-int** uint in:: Together, these determine which **in**__M__ value is copied to *output*. The bit pins are interpreted as binary bits, and the result is simply added on to the integer pin input. It is expected that either one or @@ -49,20 +49,19 @@ mux-gen.NN.in-[bit/float/s32/u32]-MM ─────┤ ─────o component is an integer power of two. This component (unlike mux16) does not offer the option of decoding Gray-code, however the same effect can be achieved by arranging the order of the input values to suit. -**mux-gen**.__N__.**in-**[**bit**/**float**/**s32**/**u32**]**-**__MM__ variable-type in:: +**mux-gen**.__N__.**in-**[**bool**/**real**/**sint**/**uint**]**-**__MM__ variable-type in:: The possible output values that are selected by the selection pins. -**mux-gen**.__N__.**out-**[**bit**/**float**/**s32**/**u32**] variable-type out:: +**mux-gen**.__N__.**out-**[**real**/**real**/**sint**/**uint**] variable-type out:: Follows the value of one of the **in**__N__ values according to the selection bits and/or the selection number. Values will be - converted/truncated according to standard C rules. This means, for - example that a float input greater than 2147483647 will give an S32 - output of -2147483648. + converted and clamped. This means, for example that a REAL input greater + than (approx.) 2^63^-1 will give a SINT output of 2^63^-1. == PARAMETERS -**mux-gen**.__N__.**elapsed** float r:: +**mux-gen**.__N__.**elapsed** real r:: Current value of the internal debounce timer for debugging. -**mux-gen**.__N__.**selected** s32 r:: +**mux-gen**.__N__.**selected** sint r:: Current value of the internal selection variable after conversion for debugging. Possibly useful for setting up gray-code switches. @@ -73,20 +72,16 @@ components. It allows the creation of arbitrary-size multiplexers (up to 1024 entries) and also supports differing data types on the input and output pins. The configuration string is a comma-separated list of code-letters and numbers, such as "bb4,fu12". This would create a -4-element bit-to-bit mux and a 12-element float-to-unsigned mux. The -code letters are **b** = bit, **f** = float, **s** = signed integer, **u** = unsigned +4-element bit-to-bit mux and a 12-element real-to-uint mux. The +code letters are **b** = bool, **f** = real, **s** = sint, **u** = uint integer. The first letter code is the input type, the second is the output type. The codes are not case-sensitive. The order of the letters is significant but the position in the string is not. Do not insert any -spaces in the config string. Any non-zero float value will be converted -to a "true" output in bit form. Be wary that float datatypes can be -very, very, close to zero and not actually be equal to zero. +spaces in the config string. Any non-zero real value will be converted +to a "true" output in bool form when it is more than ±2e-7 from zero. Each mux has its own HAL function and must be added to a thread -separately. If neither input nor output is of type float then the -function is base-thread (non floating-point) safe. Any mux_generic with -a floating point input or output can only be added to a floating-point -thread. +separately. == SEE ALSO diff --git a/docs/src/man/man9/weighted_sum.9.adoc b/docs/src/man/man9/weighted_sum.9.adoc index dfd1593cad8..d2dcec09008 100644 --- a/docs/src/man/man9/weighted_sum.9.adoc +++ b/docs/src/man/man9/weighted_sum.9.adoc @@ -45,4 +45,4 @@ There is a limit of 8 weighted summers and each may have up to 16 input bits. == SEE ALSO -scaled_s32_sums(9), sum2(9) +scaled_sint_sums(9), sum2(9) diff --git a/lib/python/gladevcp/hal_widgets.py b/lib/python/gladevcp/hal_widgets.py index d7d993f4779..ddb18f0a9e9 100644 --- a/lib/python/gladevcp/hal_widgets.py +++ b/lib/python/gladevcp/hal_widgets.py @@ -53,7 +53,7 @@ def hal_update(self, *a): class _HalScaleBase(_HalWidgetBase): def _hal_init(self): self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.REAL, hal.Dir.OUT) - self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.HAL_S32, hal.Dir.OUT) + self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.Type.SINT, hal.Dir.OUT) self.connect("value-changed", self.hal_update) def hal_update(self, *a): @@ -86,7 +86,7 @@ def _hal_init(self): class _HalJogWheelBase(_HalWidgetBase): def _hal_init(self): - self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_S32, hal.Dir.OUT) + self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.SINT, hal.Dir.OUT) try: self.get_scaled_value() self.hal_pin_scaled = self.hal.newpin(self.hal_name+'-scaled', hal.Type.REAL, hal.Dir.OUT) @@ -167,7 +167,7 @@ def do_set_property(self, property, value): def _hal_init(self): self.hal_pin_f = self.hal.newpin(self.hal_name+"-f", hal.Type.REAL, hal.Dir.OUT) - self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.HAL_S32, hal.Dir.OUT) + self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.Type.SINT, hal.Dir.OUT) self.connect("changed", self.hal_update) def hal_update(self, *a): @@ -220,7 +220,7 @@ def hal_update(self, *a): def _hal_init(self): self.hal_pin_f = self.hal.newpin(self.hal_name+"-f", hal.Type.REAL, hal.Dir.OUT) - self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.HAL_S32, hal.Dir.OUT) + self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.Type.SINT, hal.Dir.OUT) self.connect("value-changed", self.hal_update) self.emit("value-changed") @@ -349,9 +349,9 @@ def do_set_property(self, property, value): def _hal_init(self): - types = {0:hal.HAL_S32 + types = {0:hal.Type.SINT ,1:hal.Type.REAL - ,2:hal.HAL_U32 + ,2:hal.Type.UINT } pin_type = types.get(self.label_pin_type, None) if pin_type is None: diff --git a/lib/python/hal.py b/lib/python/hal.py index 34f90289cb6..0fa81b63991 100644 --- a/lib/python/hal.py +++ b/lib/python/hal.py @@ -48,6 +48,22 @@ def __getattr__(name): warnings.warn(f"{name} is deprecated, use lcnc_realtime.verify() instead", FutureWarning, stacklevel=2) return not lcnc_realtime.verify() + oldnames = { + 'HAL_BIT' : (_hal.Type.BOOL, 'BOOL'), + 'HAL_FLOAT': (_hal.Type.REAL, 'REAL'), + 'HAL_S32' : (_hal.Type.SINT, 'SINT'), + 'HAL_U32' : (_hal.Type.UINT, 'UINT'), + 'HAL_S64' : (_hal.Type.SINT, 'SINT'), + 'HAL_U64' : (_hal.Type.UINT, 'UINT') + } + if name in oldnames: + nt, nn = oldnames[name] + if name in ('HAL_S32', 'HAL_U32'): + warnings.warn(f"{name} is no longer supported and replaced by hal.Type.{nn}", FutureWarning, stacklevel=2) + else: + warnings.warn(f"{name} has been deprecated. Please use the IntEnum type hal.Type.{nn}", FutureWarning, stacklevel=2) + return nt + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") class _ItemWrap(object): diff --git a/lib/python/pyvcp_widgets.py b/lib/python/pyvcp_widgets.py index 7e831fbcae8..e3c3398911a 100644 --- a/lib/python/pyvcp_widgets.py +++ b/lib/python/pyvcp_widgets.py @@ -1074,8 +1074,8 @@ def update(self,pycomp): self.v.set( str( dummy % {'b':newvalue} ) ) -class pyvcp_u32(Label): - """ (indicator) shows a u32 as text """ +class pyvcp_uint(Label): + """ (indicator) shows a uint as text """ n=0 def __init__(self,master,pycomp,halpin=None,format="d",**kw): self.v = StringVar() @@ -1088,7 +1088,7 @@ def __init__(self,master,pycomp,halpin=None,format="d",**kw): self.value=int(0.0) dummy = "%(b)"+self.format self.v.set( str( dummy % {'b':self.value} ) ) - pycomp.newpin(halpin, HAL_U32, Dir.IN) + pycomp.newpin(halpin, Type.UINT, Dir.IN) def update(self,pycomp): newvalue = pycomp[self.halpin] @@ -1097,9 +1097,13 @@ def update(self,pycomp): dummy = "%(b)"+self.format self.v.set( str( dummy % {'b':newvalue} ) ) - -class pyvcp_s32(Label): - """ (indicator) shows a s32 as text """ +class pyvcp_u32(pyvcp_uint): + """ (indicator) shows a uint as text """ + # This is just a proxy so that tags still work. + # We changed the actual pin type to UINT. + +class pyvcp_sint(Label): + """ (indicator) shows a sint as text """ n=0 def __init__(self,master,pycomp,halpin=None,format="d",**kw): self.v = StringVar() @@ -1112,7 +1116,7 @@ def __init__(self,master,pycomp,halpin=None,format="d",**kw): self.value=int(0.0) dummy = "%(b)"+self.format self.v.set( str( dummy % {'b':self.value} ) ) - pycomp.newpin(halpin, HAL_S32, Dir.IN) + pycomp.newpin(halpin, Type.SINT, Dir.IN) def update(self,pycomp): newvalue = pycomp[self.halpin] @@ -1121,6 +1125,11 @@ def update(self,pycomp): dummy = "%(b)"+self.format self.v.set( str( dummy % {'b':newvalue} ) ) +class pyvcp_s32(pyvcp_sint): + """ (indicator) shows a sint as text """ + # This is just a proxy so that tags still work. + # We changed the actual pin type to SINT. + class pyvcp_timer(Label): """ (indicator) shows elapsed time as HH:MM:SS two pins - run and reset @@ -1568,7 +1577,7 @@ def __init__(self,master,pycomp, pyvcp_scale.n += 1 - pycomp.newpin(halpin+"-i", HAL_S32, Dir.OUT) + pycomp.newpin(halpin+"-i", Type.SINT, Dir.OUT) pycomp.newpin(halpin+"-f", Type.REAL, Dir.OUT) self.bind('',self.wheel_up) @@ -1775,10 +1784,15 @@ def update(self, pycomp): print("Unknown image #%d on %s" % (l, self.halpin), file=sys.stderr) self.last = l +class pyvcp_image_bool(_pyvcp_image): + pintype = Type.BOOL +class pyvcp_image_uint(_pyvcp_image): + pintype = Type.UINT +# Keep the old names for compatibility class pyvcp_image_bit(_pyvcp_image): pintype = Type.BOOL class pyvcp_image_u32(_pyvcp_image): - pintype = HAL_U32 + pintype = Type.UINT # This must come after all the pyvcp_xxx classes elements = [] diff --git a/lib/python/qtvcp/lib/message.py b/lib/python/qtvcp/lib/message.py index e74e111baf7..825552a3153 100644 --- a/lib/python/qtvcp/lib/message.py +++ b/lib/python/qtvcp/lib/message.py @@ -76,7 +76,7 @@ def message_setup(self, hal_comp, window=None, notify=None): self.HAL_GCOMP_.newpin(name + "-waiting", hal.Type.BOOL, hal.Dir.OUT) if not ("ok" in details): self.HAL_GCOMP_.newpin(name + "-response", hal.Type.BOOL, hal.Dir.OUT) - self.HAL_GCOMP_.newpin(name + "-response-s32", hal.HAL_S32, hal.Dir.OUT) + self.HAL_GCOMP_.newpin(name + "-response-s32", hal.Type.SINT, hal.Dir.OUT) self.HAL_GCOMP_[name + "-response-s32"] = -1 # undetermined if not INFO.USRMULTIMESS_ID is None: @@ -88,7 +88,7 @@ def message_setup(self, hal_comp, window=None, notify=None): D.hal_init(HAL_NAME=name) D.pinname = name - D._halpin = self.HAL_GCOMP_.newpin(name, hal.HAL_S32, hal.Dir.IN) + D._halpin = self.HAL_GCOMP_.newpin(name, hal.Type.SINT, hal.Dir.IN) D._halpin.value_changed.connect(self.multiMessageCallback(D, D._halpin, name, mess, )) diff --git a/lib/python/qtvcp/qt_halobjects.py b/lib/python/qtvcp/qt_halobjects.py index 97db41a57ac..38846757bc9 100644 --- a/lib/python/qtvcp/qt_halobjects.py +++ b/lib/python/qtvcp/qt_halobjects.py @@ -121,8 +121,8 @@ class _QHal(object): HAL_BIT = hal.Type.BOOL # Deprecated HAL_FLOAT = hal.Type.REAL # Deprecated - HAL_S32 = hal.HAL_S32 - HAL_U32 = hal.HAL_U32 + HAL_S32 = hal.Type.SINT # Replaced by hal.Type.SINT + HAL_U32 = hal.Type.UINT # Replaced by hal.Type.UINT HAL_IN = hal.Dir.IN HAL_OUT = hal.Dir.OUT diff --git a/lib/python/qtvcp/widgets/bar.py b/lib/python/qtvcp/widgets/bar.py index e57b6aca887..1d59c283c2b 100644 --- a/lib/python/qtvcp/widgets/bar.py +++ b/lib/python/qtvcp/widgets/bar.py @@ -408,7 +408,7 @@ def resetVert(self): class HALPinType(enum.IntEnum): NONE = 0 - S32 = hal.HAL_S32 + S32 = hal.Type.SINT # Removed FLOAT= hal.Type.REAL # Deprecated SINT = hal.Type.SINT REAL = hal.Type.REAL @@ -420,14 +420,14 @@ class HalBar(Bar, _HalWidgetBase): # older version of pyqt5 need this as well as QEnum NONE = 0 - S32 = hal.HAL_S32 + S32 = hal.Type.SINT # Removed FLOAT= hal.Type.REAL # Deprecated SINT = hal.Type.SINT REAL = hal.Type.REAL def __init__(self, *args, **kwargs): super(). __init__( *args, **kwargs) - self._pin_type = HALPinType.S32 + self._pin_type = HALPinType.SINT self._pin_name = '' self._invert_negative = False self._superOpposite = self._opposite @@ -440,11 +440,11 @@ def _hal_init(self): self._superOpposite = self._opposite - if self._pin_type == HALPinType.FLOAT: + if self._pin_type == HALPinType.REAL: self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.REAL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.updateDisplay(data)) - elif self._pin_type == HALPinType.S32: - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_S32, hal.Dir.IN) + elif self._pin_type == HALPinType.SINT: + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.SINT, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.updateDisplay(data)) def updateDisplay(self, data): @@ -460,7 +460,7 @@ def set_pin_type(self, value): def get_pin_type(self): return self._pin_type def reset_pin_type(self): - self._pin_type = HALPinType.S32 + self._pin_type = HALPinType.SINT def set_pin_name(self, value): self._pin_name = value diff --git a/lib/python/qtvcp/widgets/dialog_widget.py b/lib/python/qtvcp/widgets/dialog_widget.py index c1dce5b2622..bd869c61271 100644 --- a/lib/python/qtvcp/widgets/dialog_widget.py +++ b/lib/python/qtvcp/widgets/dialog_widget.py @@ -465,7 +465,7 @@ def _hal_init(self): self.HAL_GCOMP_.comp.setprefix('hal_manualtoolchange') self.hal_pin = self.HAL_GCOMP_.newpin('change', hal.Type.BOOL, hal.Dir.IN) self.hal_pin.value_changed.connect(self.tool_change) - self.tool_number = self.HAL_GCOMP_.newpin('number', hal.HAL_S32, hal.Dir.IN) + self.tool_number = self.HAL_GCOMP_.newpin('number', hal.Type.SINT, hal.Dir.IN) self.changed = self.HAL_GCOMP_.newpin('changed', hal.Type.BOOL, hal.Dir.OUT) self.ext_ack = self.HAL_GCOMP_.newpin(self.HAL_NAME_ + 'change_button', hal.Type.BOOL, hal.Dir.IN) self.ext_ack.value_changed.connect(self.external_acknowledge) diff --git a/lib/python/qtvcp/widgets/general_hal_input.py b/lib/python/qtvcp/widgets/general_hal_input.py index 942fe4cae22..3f8cd3be73e 100644 --- a/lib/python/qtvcp/widgets/general_hal_input.py +++ b/lib/python/qtvcp/widgets/general_hal_input.py @@ -55,7 +55,7 @@ def _hal_init(self): self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_, hal.Type.REAL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.pin_update(data)) else: - self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_, hal.HAL_S32, hal.Dir.IN) + self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_, hal.Type.SINT, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.pin_update(data)) def pin_update(self, *a): diff --git a/lib/python/qtvcp/widgets/general_hal_output.py b/lib/python/qtvcp/widgets/general_hal_output.py index f04439ab3b7..bf555cf3d6d 100644 --- a/lib/python/qtvcp/widgets/general_hal_output.py +++ b/lib/python/qtvcp/widgets/general_hal_output.py @@ -53,7 +53,7 @@ def _hal_init(self): if self.istate: self._pin_bit_update(self._initial_float) else: - ptype = hal.HAL_S32 + ptype = hal.Type.SINT ptype2 = hal.Type.REAL self.hal_pin = self.HAL_GCOMP_.newpin(pname + '-s32', ptype, hal.Dir.OUT) self.hal_pin_2 = self.HAL_GCOMP_.newpin(pname + "-float", ptype2, hal.Dir.OUT) diff --git a/lib/python/qtvcp/widgets/hal_label.py b/lib/python/qtvcp/widgets/hal_label.py index 81b06784867..add3f4fc664 100644 --- a/lib/python/qtvcp/widgets/hal_label.py +++ b/lib/python/qtvcp/widgets/hal_label.py @@ -55,7 +55,7 @@ def _hal_init(self): self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.REAL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self._setText(data)) elif self._s32_pin_type or self._use_multi_label: - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_S32, hal.Dir.IN) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.SINT, hal.Dir.IN) if self._s32_pin_type: self.hal_pin.value_changed.connect(lambda data: self._setText(data)) else: diff --git a/lib/python/qtvcp/widgets/hal_selectionbox.py b/lib/python/qtvcp/widgets/hal_selectionbox.py index 8e3d08e6c74..260f46bff26 100644 --- a/lib/python/qtvcp/widgets/hal_selectionbox.py +++ b/lib/python/qtvcp/widgets/hal_selectionbox.py @@ -113,8 +113,8 @@ class HALSelectionBox(TreeComboBox, _HalWidgetBase): HAL_BIT = hal.Type.BOOL # Deprecated HAL_FLOAT = hal.Type.REAL # Deprecated - HAL_S32 = hal.HAL_S32 - HAL_U32 = hal.HAL_U32 + HAL_S32 = hal.Type.SINT # Replaced by hal.Type.SINT + HAL_U32 = hal.Type.UINT # Replaced by hal.Type.SINT HAL_IN = hal.Dir.IN HAL_OUT = hal.Dir.OUT @@ -128,9 +128,9 @@ class HALSelectionBox(TreeComboBox, _HalWidgetBase): def __init__(self, parent=None): super(HALSelectionBox, self).__init__(parent) - self.PINTYPE = [self.HAL_BOOL,self.HAL_REAL,self.HAL_S32,self.HAL_U32] + self.PINTYPE = [self.HAL_BOOL,self.HAL_REAL,self.HAL_SINT,self.HAL_UINT] self.PINDIRECTION = [self.HAL_IN, self.HAL_OUT] - self.SIGTYPE = [self.HAL_BOOL,self.HAL_REAL,self.HAL_S32,self.HAL_U32] + self.SIGTYPE = [self.HAL_BOOL,self.HAL_REAL,self.HAL_SINT,self.HAL_UINT] self.SIGDRIVEN = [True, False] self.PARAMTYPE = [self.HAL_RO, self.HAL_RW] self.SHOWTYPES = [self.PINS] @@ -192,16 +192,16 @@ def _hal_init(self): self.view().adjustSize() def setShowTypes(self, types): - ''' Sets the pin type: HAL_BOOL,HAL_REAL,HAL_S32,HAL_U32 + ''' Sets the pin type: HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT that will be shown in the combbox. widget defaults to all pin types shown ie. combobox.setShowTypes([combobox.HAL_BOOL])''' self.SHOWTYPES = types def setPinTypes(self, \ - types = [HAL_BOOL,HAL_REAL,HAL_S32,HAL_U32], \ + types = [HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT], \ direction = [HAL_IN, HAL_OUT]): - ''' Sets the pin type: HAL_BOOL,HAL_REAL,HAL_S32,HAL_U32 + ''' Sets the pin type: HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT and direction: HAL_IN, HAL_OUT that will be shown in combobox. widget defaults to all pins, all directions. @@ -210,9 +210,9 @@ def setPinTypes(self, \ self.PINDIRECTION = direction def setSignalTypes(self, \ - types = [HAL_BOOL,HAL_REAL,HAL_S32,HAL_U32], \ + types = [HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT], \ driven = [True, False]): - ''' Sets the pin type: HAL_BOOL,HAL_REAL,HAL_S32,HAL_U32 + ''' Sets the pin type: HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT and what type of signals (driven by a pin, not or both). True being driven and False being un-driven signals combobox.setSignalTypes([combobox.HAL_BOOL], direction = [True,False])''' diff --git a/lib/python/qtvcp/widgets/joypad.py b/lib/python/qtvcp/widgets/joypad.py index 223f459c34d..85620e61b8e 100644 --- a/lib/python/qtvcp/widgets/joypad.py +++ b/lib/python/qtvcp/widgets/joypad.py @@ -540,7 +540,7 @@ def __setitem__(self, item, value): class HALPinType(enum.IntEnum): NONE = 0 BIT = hal.Type.BOOL # Deprecated - S32 = hal.HAL_S32 + S32 = hal.Type.SINT # Removed FLOAT= hal.Type.REAL # Deprecated BOOL = hal.Type.BOOL SINT = hal.Type.SINT @@ -553,7 +553,7 @@ class HALPad(JoyPad, _HalWidgetBase): # older version of pyqt5 need this as well as QEnum NONE = 0 BIT = hal.Type.BOOL # Deprecated - S32 = hal.HAL_S32 + S32 = hal.Type.SINT # Removed FLOAT= hal.Type.REAL # Deprecated BOOL = hal.Type.BOOL SINT = hal.Type.SINT @@ -602,7 +602,7 @@ def _pressedOutput(self, btncode): data = True elif self._pin_type == HALPinType.REAL: data = float(self['_trueOutput{}'.format(btncode)]) - elif self._pin_type == HALPinType.S32: + elif self._pin_type == HALPinType.SINT: data = int(self['_trueOutput{}'.format(btncode)]) else: return @@ -619,7 +619,7 @@ def _releasedOutput(self, btncode): data = False elif self._pin_type == HALPinType.REAL: data = float(self._falseOutput) - elif self._pin_type == HALPinType.S32: + elif self._pin_type == HALPinType.SINT: data = int(self._falseOutput) else: return diff --git a/lib/python/qtvcp/widgets/simple_widgets.py b/lib/python/qtvcp/widgets/simple_widgets.py index 586ea21939a..3e814efee42 100644 --- a/lib/python/qtvcp/widgets/simple_widgets.py +++ b/lib/python/qtvcp/widgets/simple_widgets.py @@ -45,9 +45,9 @@ class HALPinType(enum.IntEnum): NONE = 0 - BIT = hal.Type.BOOL # Deprecated - S32 = hal.HAL_S32 - FLOAT = hal.Type.REAL # Deprecated + BIT = hal.Type.BOOL # Deprecated + S32 = hal.Type.SINT # Removed + FLOAT= hal.Type.REAL # Deprecated BOOL = hal.Type.BOOL SINT = hal.Type.SINT REAL = hal.Type.REAL @@ -73,7 +73,7 @@ def _hal_init(self): self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.REAL, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.updateFloatDisplay(data)) elif self._s32_pin_type: - self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_S32, hal.Dir.IN) + self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.SINT, hal.Dir.IN) self.hal_pin.value_changed.connect(lambda data: self.updateDisplay(data)) def updateDisplay(self, data): @@ -180,7 +180,7 @@ def _hal_init(self): pname = self.HAL_NAME_ else: pname = self._pin_name_ - self.hal_pin_s = self.HAL_GCOMP_.newpin(str(pname +'-s'), hal.HAL_S32, hal.Dir.OUT) + self.hal_pin_s = self.HAL_GCOMP_.newpin(str(pname +'-s'), hal.Type.SINT, hal.Dir.OUT) self.hal_pin_f = self.HAL_GCOMP_.newpin(pname +'-f', hal.Type.REAL, hal.Dir.OUT) self.hal_pin_scale = self.HAL_GCOMP_.newpin(pname +'-scale', hal.Type.REAL, hal.Dir.IN) self.hal_pin_scale.set(1) @@ -215,7 +215,7 @@ def _hal_init(self): pname = self.HAL_NAME_ else: pname = self._pin_name_ - self.hal_pin_s = self.HAL_GCOMP_.newpin(str(pname +'-s'), hal.HAL_S32, hal.Dir.OUT) + self.hal_pin_s = self.HAL_GCOMP_.newpin(str(pname +'-s'), hal.Type.SINT, hal.Dir.OUT) self.hal_pin_f = self.HAL_GCOMP_.newpin(pname +'-f', hal.Type.REAL, hal.Dir.OUT) self.hal_pin_d = self.HAL_GCOMP_.newpin(pname +'-d', hal.Type.REAL, hal.Dir.OUT) self.hal_pin_scale = self.HAL_GCOMP_.newpin(pname +'-scale', hal.Type.REAL, hal.Dir.IN) @@ -362,9 +362,9 @@ class PushButton(QtWidgets.QPushButton, IndicatedMixIn): # older version of pyqt5 need this as well as QEnum NONE = 0 - BIT = hal.HAL_BIT # Deprecated - S32 = hal.HAL_S32 - FLOAT = hal.HAL_FLOAT # Deprecated + BIT = hal.Type.BOOL # Deprecated + S32 = hal.Type.SINT # Removed + FLOAT= hal.Type.REAL # Deprecated BOOL = hal.Type.BOOL SINT = hal.Type.SINT REAL = hal.Type.REAL @@ -372,7 +372,7 @@ class PushButton(QtWidgets.QPushButton, IndicatedMixIn): def __init__(self, parent=None): super(PushButton, self).__init__(parent) - self._pin_type = HALPinType.S32 + self._pin_type = HALPinType.SINT self._groupPinName = '' self._exclusiveValue = 0.0 self.halPinGroup = None @@ -462,7 +462,7 @@ def updateGroup(self): data = bool(value) elif self._pin_type == HALPinType.REAL: data = float(value) - elif self._pin_type == HALPinType.S32: + elif self._pin_type == HALPinType.SINT: data = int(value) else: return @@ -485,7 +485,7 @@ def set_pin_type(self, value): def get_pin_type(self): return self._pin_type def reset_pin_type(self): - self._pin_type = HALPinType.S32 + self._pin_type = HALPinType.SINT # designer will show these properties in this order: pin_type = QtCore.Property(HALPinType, get_pin_type, set_pin_type, reset_pin_type) diff --git a/lib/python/qtvcp/widgets/widget_baseclass.py b/lib/python/qtvcp/widgets/widget_baseclass.py index 586a832c7d9..8cd98a9a8d8 100644 --- a/lib/python/qtvcp/widgets/widget_baseclass.py +++ b/lib/python/qtvcp/widgets/widget_baseclass.py @@ -144,7 +144,7 @@ def _hal_init(self): else: pname = self._pin_name_ self.hal_pin_f = self.HAL_GCOMP_.newpin(pname + "-f", hal.Type.REAL, hal.Dir.OUT) - self.hal_pin_s = self.HAL_GCOMP_.newpin(pname + "-s", hal.HAL_S32, hal.Dir.OUT) + self.hal_pin_s = self.HAL_GCOMP_.newpin(pname + "-s", hal.Type.SINT, hal.Dir.OUT) self.valueChanged.connect(lambda data: self._pin_update(data)) # default scale self.input = 1 diff --git a/lib/python/raster.py b/lib/python/raster.py index 574fdc06c8b..37676dd5756 100644 --- a/lib/python/raster.py +++ b/lib/python/raster.py @@ -55,7 +55,7 @@ def __init__(self, name): self.__timeout = 5.0 self.component = hal.component(name) self.port = self.component.newpin("program", hal.Type.PORT, hal.Dir.OUT) - self.faultCode = self.component.newpin("fault-code", hal.HAL_S32, hal.Dir.IN) + self.faultCode = self.component.newpin("fault-code", hal.Type.SINT, hal.Dir.IN) self.enabled = self.component.newpin("enabled", hal.Type.BOOL, hal.Dir.IN) self.run = self.component.newpin("run", hal.Type.BOOL, hal.Dir.OUT) self.component.ready() diff --git a/nc_files/remap_lib/python-stdglue/stdglue.py b/nc_files/remap_lib/python-stdglue/stdglue.py index 19d29d93520..8457e400f38 100644 --- a/nc_files/remap_lib/python-stdglue/stdglue.py +++ b/nc_files/remap_lib/python-stdglue/stdglue.py @@ -33,8 +33,8 @@ def build_hal(self): import hal try: h=hal.component('remapStat') - h.newpin("tool", hal.HAL_S32, hal.Dir.OUT) - h.newpin("wear", hal.HAL_S32, hal.Dir.OUT) + h.newpin("tool", hal.Type.SINT, hal.Dir.OUT) + h.newpin("wear", hal.Type.SINT, hal.Dir.OUT) h.ready() self.hal_tool_comp = h except Exception as e: diff --git a/scripts/hal-histogram b/scripts/hal-histogram index e4c210cef7d..a6fa342f668 100755 --- a/scripts/hal-histogram +++ b/scripts/hal-histogram @@ -106,10 +106,10 @@ proc set_defaults {} { # defaults for items with no cmdline opts: set ::HH(color) seagreen - set ::HH(signame,prefix,float) hhf - set ::HH(signame,prefix,s32) hhs - set ::HH(signame,prefix,u32) hhu - set ::HH(signame,prefix,bit) hhb + set ::HH(signame,prefix,real) hhf + set ::HH(signame,prefix,sint) hhs + set ::HH(signame,prefix,uint) hhu + set ::HH(signame,prefix,bool) hhb set ::HH(max_histos) 5 set ::HH(guess,ct) 100 set ::HH(guess,factor) 10 @@ -212,10 +212,10 @@ proc config {} { set ::HH(pintype) [hal ptype $::HH(pinname)] switch -exact "$::HH(pintype)" { - float {} - s32 {} - u32 {} - bit { + real {} + sint {} + uint {} + bool { # ignore input args on startup: set ::HH(minvalue) 0 set ::HH(binsize) 1 @@ -498,10 +498,10 @@ proc check_inputs {minvalue binsize nbins} { if { ![is_int $nbins] } {return "nbins must be integer"} switch -exact "$::HH(pintype)" { - float {} - s32 - - u32 - - bit { + real {} + sint - + uint - + bool { if { ![is_int $minvalue]} { return "minvalue must be integer <$minvalue> for type $::HH(pintype)" } @@ -597,16 +597,16 @@ proc setup_hal {} { if [catch { switch -exact "$::HH(pintype)" { - float { set ::HH(inputpinname) $::HH(instance).input + real { set ::HH(inputpinname) $::HH(instance).input hal setp $::HH(instance).pintype 0 } - s32 { set ::HH(inputpinname) $::HH(instance).input-s32 + sint { set ::HH(inputpinname) $::HH(instance).input-sint hal setp $::HH(instance).pintype 1 } - u32 { set ::HH(inputpinname) $::HH(instance).input-u32 + uint { set ::HH(inputpinname) $::HH(instance).input-uint hal setp $::HH(instance).pintype 2 } - bit { set ::HH(inputpinname) $::HH(instance).input-bit + bool { set ::HH(inputpinname) $::HH(instance).input-bool hal setp $::HH(instance).pintype 3 } default { puts notdoneyet; exit 77 } @@ -968,7 +968,7 @@ proc usage { {errtxt ""} } { puts " 1) LinuxCNC (or another Hal application) must be running" puts " 2) If no pinname is specified, default is: $::HH(pinname)" puts " 3) This app may be opened for $::HH(max_histos) pins" - puts " 4) pintypes float, s32, u32, bit are supported" + puts " 4) pintypes real, sint, uint, bool are supported" if {"$errtxt" != ""} { puts "" diff --git a/scripts/hal_demo b/scripts/hal_demo index 6591d65a2e5..3e27e42153b 100755 --- a/scripts/hal_demo +++ b/scripts/hal_demo @@ -136,10 +136,10 @@ if [ "$1" = "parport1" ] ; then bin/halcmd show param echo "Hit enter to create some signals" read - echo "$ bin/halcmd newsig jumper1 bit" - bin/halcmd newsig jumper1 bit - echo "$ bin/halcmd newsig jumper2 bit" - bin/halcmd newsig jumper2 bit + echo "$ bin/halcmd newsig jumper1 bool" + bin/halcmd newsig jumper1 bool + echo "$ bin/halcmd newsig jumper2 bool" + bin/halcmd newsig jumper2 bool echo "(signals created - lets look at them)" echo "$ bin/halcmd show sig" bin/halcmd show sig diff --git a/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim.ui b/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim.ui index fe7944d7a2a..9e2ed47b599 100644 --- a/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim.ui +++ b/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim.ui @@ -187,7 +187,7 @@ Qt::NoFocus - FLOAT + REAL diff --git a/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim_handler.py b/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim_handler.py index 86ce65d815d..9214601d5ed 100644 --- a/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim_handler.py +++ b/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim_handler.py @@ -59,7 +59,7 @@ def initialized__(self): self.materialPin = self.hal.newpin('material_height', hal.Type.REAL, hal.Dir.IN) self.ohmicPin = self.hal.newpin('sensor_ohmic', hal.Type.BOOL, hal.Dir.OUT) self.torchPin = self.hal.newpin('torch_on', hal.Type.BOOL, hal.Dir.IN) - self.statePin = self.hal.newpin('state', hal.HAL_S32, hal.Dir.IN) + self.statePin = self.hal.newpin('state', hal.Type.SINT, hal.Dir.IN) self.stylePin = self.hal.newpin('style_update', hal.Type.BOOL, hal.Dir.IN) self.zPosPin = self.hal.newpin('z_position', hal.Type.REAL, hal.Dir.IN) simStepconf = False diff --git a/share/qtvcp/panels/sim_panel/sim_panel.ui b/share/qtvcp/panels/sim_panel/sim_panel.ui index 92d76cc0100..8428bc2a63b 100644 --- a/share/qtvcp/panels/sim_panel/sim_panel.ui +++ b/share/qtvcp/panels/sim_panel/sim_panel.ui @@ -96,7 +96,7 @@ true - PushButton::FLOAT + PushButton::REAL increments @@ -130,7 +130,7 @@ false - PushButton::FLOAT + PushButton::REAL 10.000000000000000 @@ -161,7 +161,7 @@ false - PushButton::FLOAT + PushButton::REAL 30.000000000000000 diff --git a/share/qtvcp/screens/qtaxis/qtaxis_handler.py b/share/qtvcp/screens/qtaxis/qtaxis_handler.py index d5827821182..9fbea092ec9 100644 --- a/share/qtvcp/screens/qtaxis/qtaxis_handler.py +++ b/share/qtvcp/screens/qtaxis/qtaxis_handler.py @@ -404,7 +404,7 @@ def init_pins(self): self['jog_axis_{}_pin'.format(i)] = \ QHAL.newpin("axis-{}-selected".format(i.lower()), QHAL.HAL_BOOL, QHAL.HAL_OUT) # screen MPG controls - self.pin_mpg_in = QHAL.newpin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newpin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.value_changed.connect(lambda s: self.external_mpg(s)) self.pin_mpg_enabled = QHAL.newpin('mpg-enable',QHAL.HAL_BOOL, QHAL.HAL_IN) diff --git a/share/qtvcp/screens/qtdragon/qtdragon_handler.py b/share/qtvcp/screens/qtdragon/qtdragon_handler.py index f4f94a9a3c9..b7b12bea23e 100644 --- a/share/qtvcp/screens/qtdragon/qtdragon_handler.py +++ b/share/qtvcp/screens/qtdragon/qtdragon_handler.py @@ -339,14 +339,14 @@ def init_pins(self): pin = QHAL.newPin("spindle-volts", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v)) - pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-fault", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN) @@ -361,7 +361,7 @@ def init_pins(self): QHAL.newPin("eoffset-enable", QHAL.HAL_BOOL, QHAL.HAL_OUT) QHAL.newPin("eoffset-clear", QHAL.HAL_BOOL, QHAL.HAL_OUT) self.h['eoffset-clear'] = True - QHAL.newPin("eoffset-spindle-count", QHAL.HAL_S32, QHAL.HAL_OUT) + QHAL.newPin("eoffset-spindle-count", QHAL.HAL_SINT, QHAL.HAL_OUT) pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.external_offset_state_changed(v)) @@ -369,7 +369,7 @@ def init_pins(self): pin = QHAL.newPin("eoffset-value", QHAL.HAL_REAL, QHAL.HAL_IN) # MPG scrolling pin - self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.pinValueChanged.connect(lambda p,v: self.external_mpg(v)) # dialog answer pins diff --git a/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py b/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py index 7c6055aca71..a8c4d45c378 100644 --- a/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py +++ b/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py @@ -266,14 +266,14 @@ def init_pins(self): pin = QHAL.newPin("spindle-volts", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v)) - pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-fault", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN) @@ -288,8 +288,8 @@ def init_pins(self): QHAL.newPin("eoffset-enable", QHAL.HAL_BOOL, QHAL.HAL_OUT) QHAL.newPin("eoffset-clear", QHAL.HAL_BOOL, QHAL.HAL_OUT) self.h['eoffset-clear'] = False - QHAL.newPin("eoffset-spindle-count", QHAL.HAL_S32, QHAL.HAL_OUT) - QHAL.newPin("eoffset-count", QHAL.HAL_S32, QHAL.HAL_OUT) + QHAL.newPin("eoffset-spindle-count", QHAL.HAL_SINT, QHAL.HAL_OUT) + QHAL.newPin("eoffset-count", QHAL.HAL_SINT, QHAL.HAL_OUT) pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BOOL, QHAL.HAL_IN) @@ -297,13 +297,13 @@ def init_pins(self): pin = QHAL.newPin("eoffset-value", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.external_offset_state_changed(v)) - pin = QHAL.newPin("eoffset-zlevel-count", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("eoffset-zlevel-count", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.comp_count_changed(v)) QHAL.newPin("comp-on", QHAL.HAL_BOOL, QHAL.HAL_OUT) QHAL.newPin("spindle-lift-on", QHAL.HAL_BOOL, QHAL.HAL_OUT) # MPG scrolling pin - self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.pinValueChanged.connect(lambda p,v: self.external_mpg(v)) # dialog answer pins diff --git a/share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py b/share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py index dd6829fe5c7..2a3a072639b 100644 --- a/share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py +++ b/share/qtvcp/screens/qtdragon_hd_vert/qtdragon_hd_vert_handler.py @@ -266,14 +266,14 @@ def init_pins(self): pin = QHAL.newPin("spindle-volts", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v)) - pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-fault", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN) @@ -288,8 +288,8 @@ def init_pins(self): QHAL.newPin("eoffset-enable", QHAL.HAL_BOOL, QHAL.HAL_OUT) QHAL.newPin("eoffset-clear", QHAL.HAL_BOOL, QHAL.HAL_OUT) self.h['eoffset-clear'] = False - QHAL.newPin("eoffset-spindle-count", QHAL.HAL_S32, QHAL.HAL_OUT) - QHAL.newPin("eoffset-count", QHAL.HAL_S32, QHAL.HAL_OUT) + QHAL.newPin("eoffset-spindle-count", QHAL.HAL_SINT, QHAL.HAL_OUT) + QHAL.newPin("eoffset-count", QHAL.HAL_SINT, QHAL.HAL_OUT) pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BOOL, QHAL.HAL_IN) @@ -297,13 +297,13 @@ def init_pins(self): pin = QHAL.newPin("eoffset-value", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.external_offset_state_changed(v)) - pin = QHAL.newPin("eoffset-zlevel-count", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("eoffset-zlevel-count", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.comp_count_changed(v)) QHAL.newPin("comp-on", QHAL.HAL_BOOL, QHAL.HAL_OUT) QHAL.newPin("spindle-lift-on", QHAL.HAL_BOOL, QHAL.HAL_OUT) # MPG scrolling pin - self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.pinValueChanged.connect(lambda p,v: self.external_mpg(v)) # dialog answer pins diff --git a/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe.ui b/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe.ui index 15d2c406682..ab2f0dbd144 100644 --- a/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe.ui +++ b/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe.ui @@ -14942,7 +14942,7 @@ SCROLL 1 - HalBar::FLOAT + HalBar::REAL axis-x-load @@ -14971,7 +14971,7 @@ SCROLL 1 - HalBar::FLOAT + HalBar::REAL axis-z-load @@ -17008,7 +17008,7 @@ SCROLL 0 - HalBar::FLOAT + HalBar::REAL spindle-rpm diff --git a/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py b/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py index 698eb9de9b1..e9069833b7e 100644 --- a/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py +++ b/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py @@ -327,14 +327,14 @@ def init_pins(self): pin = QHAL.newPin("spindle-volts", QHAL.HAL_REAL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v)) - pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-fault", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-fault", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.spindle_fault_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors-u32", QHAL.HAL_UINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) - pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_S32, QHAL.HAL_IN) + pin = QHAL.newPin("spindle-modbus-errors", QHAL.HAL_SINT, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.mb_errors_changed(v)) pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN) @@ -349,14 +349,14 @@ def init_pins(self): QHAL.newPin("eoffset-enable", QHAL.HAL_BOOL, QHAL.HAL_OUT) QHAL.newPin("eoffset-clear", QHAL.HAL_BOOL, QHAL.HAL_OUT) self.h['eoffset-clear'] = True - QHAL.newPin("eoffset-spindle-count", QHAL.HAL_S32, QHAL.HAL_OUT) + QHAL.newPin("eoffset-spindle-count", QHAL.HAL_SINT, QHAL.HAL_OUT) pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BOOL, QHAL.HAL_IN) pin.pinValueChanged.connect(lambda p,v: self.external_offset_state_changed(v)) # total external offset pin = QHAL.newPin("eoffset-value", QHAL.HAL_REAL, QHAL.HAL_IN) - self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newPin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.pinValueChanged.connect(lambda p,v: self.external_mpg(v)) # dialog answer pins diff --git a/share/qtvcp/screens/qtplasmac/qtplasmac.ui b/share/qtvcp/screens/qtplasmac/qtplasmac.ui index 4fa95420fea..385a99777d3 100644 --- a/share/qtvcp/screens/qtplasmac/qtplasmac.ui +++ b/share/qtvcp/screens/qtplasmac/qtplasmac.ui @@ -4944,7 +4944,7 @@ EDGE - FLOAT + REAL Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter diff --git a/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py b/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py index 23e54a2518f..fe3ebfd54a3 100644 --- a/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py +++ b/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py @@ -844,7 +844,7 @@ def new_process_error(self, w, kind, text): def make_hal_pins(self): self.consChangePin = self.h.newpin('consumable_changing', hal.Type.BOOL, hal.Dir.IN) self.convTabDisable = self.h.newpin('conv_disable', hal.Type.BOOL, hal.Dir.IN) - self.cutTypePin = self.h.newpin('cut_type', hal.HAL_S32, hal.Dir.IN) + self.cutTypePin = self.h.newpin('cut_type', hal.Type.SINT, hal.Dir.IN) self.developmentPin = self.h.newpin('development', hal.Type.BOOL, hal.Dir.IN) self.extAbortPin = self.h.newpin('ext_abort', hal.Type.BOOL, hal.Dir.IN) self.extAutoVoltsEnablePin = self.h.newpin('ext_auto_volts_enable', hal.Type.BOOL, hal.Dir.IN) @@ -862,7 +862,7 @@ def make_hal_pins(self): self.extCutRecWPin = self.h.newpin('ext_cutrec_w', hal.Type.BOOL, hal.Dir.IN) self.extCutRecNWPin = self.h.newpin('ext_cutrec_nw', hal.Type.BOOL, hal.Dir.IN) self.extFramingPin = self.h.newpin('ext_frame_job', hal.Type.BOOL, hal.Dir.IN) - self.extHeightOvrCountsPin = self.h.newpin('ext_height_ovr_counts', hal.HAL_S32, hal.Dir.IN) + self.extHeightOvrCountsPin = self.h.newpin('ext_height_ovr_counts', hal.Type.SINT, hal.Dir.IN) self.extHeightOvrCountEnablePin = self.h.newpin('ext_height_ovr_count_enable', hal.Type.BOOL, hal.Dir.IN) self.extHeightOvrMinusPin = self.h.newpin('ext_height_ovr_minus', hal.Type.BOOL, hal.Dir.IN) self.extHeightOvrPlusPin = self.h.newpin('ext_height_ovr_plus', hal.Type.BOOL, hal.Dir.IN) @@ -894,19 +894,19 @@ def make_hal_pins(self): self.laserOnPin = self.h.newpin('laser_on', hal.Type.BOOL, hal.Dir.OUT) self.offsetSetProbePin = self.h.newpin('offset_set_probe', hal.Type.BOOL, hal.Dir.OUT) self.offsetSetScribePin = self.h.newpin('offset_set_scribe', hal.Type.BOOL, hal.Dir.OUT) - self.laserRecStatePin = self.h.newpin('laser_recovery_state', hal.HAL_S32, hal.Dir.IN) - self.materialChangePin = self.h.newpin('material_change', hal.HAL_S32, hal.Dir.IN) - self.materialChangeNumberPin = self.h.newpin('material_change_number', hal.HAL_S32, hal.Dir.IN) + self.laserRecStatePin = self.h.newpin('laser_recovery_state', hal.Type.SINT, hal.Dir.IN) + self.materialChangePin = self.h.newpin('material_change', hal.Type.SINT, hal.Dir.IN) + self.materialChangeNumberPin = self.h.newpin('material_change_number', hal.Type.SINT, hal.Dir.IN) self.materialChangeTimeoutPin = self.h.newpin('material_change_timeout', hal.Type.BOOL, hal.Dir.IN) self.materialReloadPin = self.h.newpin('material_reload', hal.Type.BOOL, hal.Dir.IN) - self.materialTempPin = self.h.newpin('material_temp', hal.HAL_S32, hal.Dir.IN) + self.materialTempPin = self.h.newpin('material_temp', hal.Type.SINT, hal.Dir.IN) self.offsetsActivePin = self.h.newpin('offsets_active', hal.Type.BOOL, hal.Dir.IN) self.ohmicLedInPin = self.h.newpin('ohmic_led_in', hal.Type.BOOL, hal.Dir.IN) self.paramTabDisable = self.h.newpin('param_disable', hal.Type.BOOL, hal.Dir.IN) self.settingsTabDisable = self.h.newpin('settings_disable', hal.Type.BOOL, hal.Dir.IN) self.simStyleUpdate = self.h.newpin('sim_style_update', hal.Type.BOOL, hal.Dir.OUT) - self.plasmacStatePin = self.h.newpin('plasmac_state', hal.HAL_S32, hal.Dir.IN) - self.plasmacStopPin = self.h.newpin('plasmac_stop', hal.HAL_S32, hal.Dir.IN) + self.plasmacStatePin = self.h.newpin('plasmac_state', hal.Type.SINT, hal.Dir.IN) + self.plasmacStopPin = self.h.newpin('plasmac_stop', hal.Type.SINT, hal.Dir.IN) self.pmx485CurrentPin = self.h.newpin('pmx485_current', hal.Type.REAL, hal.Dir.IN) self.pmx485CurrentMaxPin = self.h.newpin('pmx485_current_max', hal.Type.REAL, hal.Dir.IN) self.pmx485CurrentMinPin = self.h.newpin('pmx485_current_min', hal.Type.REAL, hal.Dir.IN) @@ -928,7 +928,7 @@ def make_hal_pins(self): self.xOffsetPin = self.h.newpin('x_offset', hal.Type.REAL, hal.Dir.IN) self.yOffsetPin = self.h.newpin('y_offset', hal.Type.REAL, hal.Dir.IN) self.zHeightPin = self.h.newpin('z_height', hal.Type.REAL, hal.Dir.IN) - self.zOffsetPin = self.h.newpin('z_offset_counts', hal.HAL_S32, hal.Dir.IN) + self.zOffsetPin = self.h.newpin('z_offset_counts', hal.Type.SINT, hal.Dir.IN) self.xMinPierceExtentPin = self.h.newpin('x_min_pierce_extent', hal.Type.REAL, hal.Dir.IN) self.xMaxPierceExtentPin = self.h.newpin('x_max_pierce_extent', hal.Type.REAL, hal.Dir.IN) self.yMinPierceExtentPin = self.h.newpin('y_min_pierce_extent', hal.Type.REAL, hal.Dir.IN) diff --git a/share/qtvcp/screens/qtplasmac_4x3/qtplasmac_4x3.ui b/share/qtvcp/screens/qtplasmac_4x3/qtplasmac_4x3.ui index 1cf34cf6faf..8b10fda787f 100644 --- a/share/qtvcp/screens/qtplasmac_4x3/qtplasmac_4x3.ui +++ b/share/qtvcp/screens/qtplasmac_4x3/qtplasmac_4x3.ui @@ -7341,7 +7341,7 @@ MOVE - FLOAT + REAL Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter diff --git a/share/qtvcp/screens/qtplasmac_9x16/qtplasmac_9x16.ui b/share/qtvcp/screens/qtplasmac_9x16/qtplasmac_9x16.ui index ef42bda9fc1..3d6075b931f 100644 --- a/share/qtvcp/screens/qtplasmac_9x16/qtplasmac_9x16.ui +++ b/share/qtvcp/screens/qtplasmac_9x16/qtplasmac_9x16.ui @@ -7256,7 +7256,7 @@ MOVE - FLOAT + REAL Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter diff --git a/share/qtvcp/screens/qttouchy/qttouchy_handler.py b/share/qtvcp/screens/qttouchy/qttouchy_handler.py index 0da4e405dd4..69a66c97f37 100644 --- a/share/qtvcp/screens/qttouchy/qttouchy_handler.py +++ b/share/qtvcp/screens/qttouchy/qttouchy_handler.py @@ -57,7 +57,7 @@ def __init__(self, halcomp,widgets,paths): def initialized__(self): KEYBIND.add_call('Key_F12','on_keycall_F12') - self.pin_mpg_in = QHAL.newpin('mpg-in',QHAL.HAL_S32, QHAL.HAL_IN) + self.pin_mpg_in = QHAL.newpin('mpg-in',QHAL.HAL_SINT, QHAL.HAL_IN) self.pin_mpg_in.value_changed.connect(lambda s: self.external_mpg(s)) self.pin_cycle_start_in = QHAL.newpin('cycle-start-in',QHAL.HAL_BOOL, QHAL.HAL_IN) diff --git a/share/qtvcp/screens/woodpecker/woodpecker_handler.py b/share/qtvcp/screens/woodpecker/woodpecker_handler.py index 622642c1c7c..7b254d3727c 100644 --- a/share/qtvcp/screens/woodpecker/woodpecker_handler.py +++ b/share/qtvcp/screens/woodpecker/woodpecker_handler.py @@ -250,18 +250,18 @@ def init_pins(self): pin.value_changed.connect(self.spindle_pwr_changed) pin = QHAL.newpin("spindle-volts", QHAL.HAL_REAL, QHAL.HAL_IN) pin.value_changed.connect(self.spindle_pwr_changed) - pin = QHAL.newpin("spindle-fault", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-fault", QHAL.HAL_UINT, QHAL.HAL_IN) pin.value_changed.connect(self.spindle_fault_changed) - pin = QHAL.newpin("spindle-modbus-errors", QHAL.HAL_U32, QHAL.HAL_IN) + pin = QHAL.newpin("spindle-modbus-errors", QHAL.HAL_UINT, QHAL.HAL_IN) pin.value_changed.connect(self.mb_errors_changed) QHAL.newpin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT) # external offset control pins QHAL.newpin("eoffset-enable", QHAL.HAL_BOOL, QHAL.HAL_OUT) QHAL.newpin("eoffset-clear", QHAL.HAL_BOOL, QHAL.HAL_OUT) - QHAL.newpin("eoffset-count", QHAL.HAL_S32, QHAL.HAL_OUT) + QHAL.newpin("eoffset-count", QHAL.HAL_SINT, QHAL.HAL_OUT) pin = QHAL.newpin("eoffset-value", QHAL.HAL_REAL, QHAL.HAL_IN) - self.pin_mpg_in = self.h.newpin('mpg-in',hal.HAL_S32, hal.Dir.IN) + self.pin_mpg_in = self.h.newpin('mpg-in',hal.Type.SINT, hal.Dir.IN) self.pin_mpg_in.value_changed.connect(lambda s: self.external_mpg(s)) self.wheel_x = self.h.newpin('jog.wheel.x',hal.Type.BOOL, hal.Dir.OUT) self.wheel_y = self.h.newpin('jog.wheel.y',hal.Type.BOOL, hal.Dir.OUT) diff --git a/src/Makefile b/src/Makefile index aeca112723e..29d8e83b1bd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -564,7 +564,7 @@ genclean: -rm -f ../lib/*.so.[0-9]* -rm -rf ../docs/build/man -rm -f ../rtlib/*.$(MODULE_EXT) - -rm -f hal/components/conv_*.comp + -rm -f $(patsubst %,hal/components/%,$(notdir $(CONVERTERS))) pycheck-python-files: @echo 'Checking *.py files for python3 compatibility...' diff --git a/src/emc/motion/axis.c b/src/emc/motion/axis.c index 9e1908a6aa4..4cc55035c0e 100644 --- a/src/emc/motion/axis.c +++ b/src/emc/motion/axis.c @@ -16,14 +16,14 @@ typedef struct { double jerk_limit; /* upper limit of axis jerk */ simple_tp_t teleop_tp; /* planner for teleop mode motion */ - int old_ajog_counts; /* prior value, used for deltas */ + rtapi_sint old_ajog_counts; /* prior value, used for deltas */ int kb_ajog_active; /* non-zero during a keyboard jog */ int wheel_ajog_active; /* non-zero during a wheel jog */ int locking_joint; /* locking_joint number, -1 ==> notused */ double ext_offset_vel_limit; /* upper limit of axis speed for ext offset */ double ext_offset_acc_limit; /* upper limit of axis accel for ext offset */ - int old_eoffset_counts; + rtapi_sint old_eoffset_counts; simple_tp_t ext_offset_tp; /* planner for external coordinate offsets*/ } emcmot_axis_t; @@ -102,7 +102,7 @@ static int export_axis(int mot_comp_id, char c, axis_hal_t * addr) CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_IN, &(addr->ajog_enable), 0, "axis.%c.jog-enable", c)); CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_IN, &(addr->ajog_scale), 0.0, "axis.%c.jog-scale", c)); - CALL_CHECK(hal_pin_new_si32(mot_comp_id, HAL_IN, &(addr->ajog_counts), 0, "axis.%c.jog-counts", c)); + CALL_CHECK(hal_pin_new_sint(mot_comp_id, HAL_IN, &(addr->ajog_counts), 0, "axis.%c.jog-counts", c)); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_IN, &(addr->ajog_vel_mode), 0, "axis.%c.jog-vel-mode", c)); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_OUT, &(addr->kb_ajog_active), 0, "axis.%c.kb-jog-active", c)); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_OUT, &(addr->wheel_ajog_active), 0, "axis.%c.wheel-jog-active", c)); @@ -135,7 +135,7 @@ int axis_init_hal_io(int mot_comp_id) CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_OUT, &axis_data->teleop_tp_enable, 0, "axis.%c.teleop-tp-enable",c)); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_IN, &axis_data->eoffset_enable, 0, "axis.%c.eoffset-enable", c)); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_IN, &axis_data->eoffset_clear, 0, "axis.%c.eoffset-clear", c)); - CALL_CHECK(hal_pin_new_si32(mot_comp_id, HAL_IN, &axis_data->eoffset_counts, 0, "axis.%c.eoffset-counts", c)); + CALL_CHECK(hal_pin_new_sint(mot_comp_id, HAL_IN, &axis_data->eoffset_counts, 0, "axis.%c.eoffset-counts", c)); CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_IN, &axis_data->eoffset_scale, 0.0, "axis.%c.eoffset-scale", c)); CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_OUT, &axis_data->external_offset, 0.0, "axis.%c.eoffset", c)); CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_OUT, &axis_data->external_offset_requested, @@ -370,7 +370,7 @@ void axis_handle_jogwheels(bool motion_teleop_flag, bool motion_enable_flag, boo int axis_num; emcmot_axis_t *axis; axis_hal_t *axis_data; - int new_ajog_counts, delta; + rtapi_sint new_ajog_counts, delta; double distance, pos, stop_dist; static int first_pass = 1; /* used to set initial conditions */ @@ -486,7 +486,7 @@ bool axis_plan_external_offsets(double servo_period, bool motion_enable_flag, bo int n; emcmot_axis_t *axis; axis_hal_t *axis_data; - int new_eoffset_counts, delta; + rtapi_sint new_eoffset_counts, delta; static int last_eoffset_enable[EMCMOT_MAX_AXIS]; double ext_offset_epsilon; bool eoffset_active = 0; @@ -499,7 +499,7 @@ bool axis_plan_external_offsets(double servo_period, bool motion_enable_flag, bo axis_data = &hal_data->axis[n]; - new_eoffset_counts = hal_get_si32(axis_data->eoffset_counts); + new_eoffset_counts = hal_get_sint(axis_data->eoffset_counts); delta = new_eoffset_counts - axis->old_eoffset_counts; axis->old_eoffset_counts = new_eoffset_counts; diff --git a/src/emc/motion/command.c b/src/emc/motion/command.c index a938fa5d613..b46fe1d1e7a 100644 --- a/src/emc/motion/command.c +++ b/src/emc/motion/command.c @@ -1864,7 +1864,7 @@ void emcmotCommandHandler_locked(void *arg, long servo_period) // https://github.com/LinuxCNC/linuxcnc/issues/3389 hal_set_real(emcmot_hal_data->spindle[n].spindle_orient_angle, emcmotCommand->orientation); - hal_set_si32(emcmot_hal_data->spindle[n].spindle_orient_mode, emcmotCommand->mode); + hal_set_sint(emcmot_hal_data->spindle[n].spindle_orient_mode, emcmotCommand->mode); hal_set_bool(emcmot_hal_data->spindle[n].spindle_locked, 0); hal_set_bool(emcmot_hal_data->spindle[n].spindle_orient, 1); diff --git a/src/emc/motion/control.c b/src/emc/motion/control.c index 50ddadc6c07..5e10e918d60 100644 --- a/src/emc/motion/control.c +++ b/src/emc/motion/control.c @@ -56,7 +56,7 @@ KINEMATICS_INVERSE_FLAGS iflags = 0; ************************************************************************/ /* the (nominal) period the last time the motion handler was invoked */ -static unsigned long last_period = 0; +static rtapi_uint last_period = 0; /* servo cycle time */ static double servo_period; @@ -229,8 +229,8 @@ void emcmotController(void *arg, long period) static long long int last = 0; long long int now = rtapi_get_time(); - long int this_run = (long int)(now - last); - hal_set_ui32(emcmot_hal_data->last_period, this_run); + rtapi_sint this_run = (rtapi_sint)(now - last); + hal_set_uint(emcmot_hal_data->last_period, this_run); // we need this for next time last = now; @@ -239,7 +239,7 @@ void emcmotController(void *arg, long period) /* calculate servo period as a double - period is in integer nsec */ servo_period = period * 0.000000001; - if(period != (long)last_period) { + if((rtapi_uint)period != last_period) { emcmotSetCycleTime(period); last_period = period; } @@ -583,12 +583,12 @@ static void process_inputs(void) emcmotStatus->spindle_status[spindle_num].fault = 0; } if (hal_get_bool(emcmot_hal_data->spindle[spindle_num].spindle_orient)) { - if (hal_get_si32(emcmot_hal_data->spindle[spindle_num].spindle_orient_fault)) { + if (hal_get_sint(emcmot_hal_data->spindle[spindle_num].spindle_orient_fault)) { emcmotStatus->spindle_status[spindle_num].orient_state = EMCMOT_ORIENT_FAULTED; hal_set_bool(emcmot_hal_data->spindle[spindle_num].spindle_orient, 0); emcmotStatus->spindle_status[spindle_num].orient_fault = - hal_get_si32(emcmot_hal_data->spindle[spindle_num].spindle_orient_fault); - reportError(_("fault %d during orient in progress"), + hal_get_sint(emcmot_hal_data->spindle[spindle_num].spindle_orient_fault); + reportError(_("fault %ld during orient in progress"), emcmotStatus->spindle_status[spindle_num].orient_fault); emcmotStatus->commandStatus = EMCMOT_COMMAND_INVALID_COMMAND; tpAbort(&emcmotInternal->coord_tp); @@ -1104,7 +1104,7 @@ static void handle_jjogwheels(void) int joint_num; emcmot_joint_t *joint; joint_hal_t *joint_data; - int new_jjog_counts, delta; + rtapi_sint new_jjog_counts, delta; double distance, pos, stop_dist; static int first_pass = 1; /* used to set initial conditions */ @@ -1127,7 +1127,7 @@ static void handle_jjogwheels(void) jaccel_limit = jjog_accel_fraction * joint->acc_limit; } /* get counts from jogwheel */ - new_jjog_counts = hal_get_si32(joint_data->jjog_counts); + new_jjog_counts = hal_get_sint(joint_data->jjog_counts); delta = new_jjog_counts - joint->old_jjog_counts; /* save value for next time */ joint->old_jjog_counts = new_jjog_counts; @@ -1966,9 +1966,9 @@ static void output_to_hal(void) /* Performance Metadata */ hal_set_real(emcmot_hal_data->interp_feedrate, emcmotStatus->tag.fields_float[GM_FIELD_FLOAT_FEED]); - /* Line and Motion Type (Casting to int for s32 HAL pins) */ - hal_set_si32(emcmot_hal_data->interp_line_number, (int)emcmotStatus->tag.fields[GM_FIELD_LINE_NUMBER]); - hal_set_si32(emcmot_hal_data->interp_motion_type, (int)emcmotStatus->tag.fields[GM_FIELD_MOTION_MODE]); + /* Line and Motion Type (implicitly casted to integer for sint HAL pins) */ + hal_set_sint(emcmot_hal_data->interp_line_number, emcmotStatus->tag.fields[GM_FIELD_LINE_NUMBER]); + hal_set_sint(emcmot_hal_data->interp_motion_type, emcmotStatus->tag.fields[GM_FIELD_MOTION_MODE]); hal_set_bool(emcmot_hal_data->iscircle, (emcmotStatus->tag.packed_flags & (1UL << GM_FLAG_IS_CIRCLE)) != 0); switch (emcmotStatus->motionType) { case EMC_MOTION_TYPE_FEED: //fall thru @@ -2042,9 +2042,9 @@ static void output_to_hal(void) emcmotStatus->spindle_status[spindle_num].speed / 60.); } - hal_set_si32(emcmot_hal_data->program_line, emcmotStatus->id); + hal_set_sint(emcmot_hal_data->program_line, emcmotStatus->id); hal_set_bool(emcmot_hal_data->tp_reverse, emcmotStatus->reverse_run); - hal_set_si32(emcmot_hal_data->motion_type, emcmotStatus->motionType); + hal_set_sint(emcmot_hal_data->motion_type, emcmotStatus->motionType); hal_set_real(emcmot_hal_data->distance_to_go, emcmotStatus->distance_to_go); if(GET_MOTION_COORD_FLAG()) { hal_set_real(emcmot_hal_data->current_vel, emcmotStatus->current_vel); @@ -2070,14 +2070,14 @@ static void output_to_hal(void) to one of the debug parameters. You can also comment out these lines and copy elsewhere if you want to observe an automatic variable that isn't in scope here. */ - hal_set_bool(emcmot_hal_data->debug_bit_0, joints[1].free_tp.active); - hal_set_bool(emcmot_hal_data->debug_bit_1, emcmotStatus->enables_new & AF_ENABLED); - hal_set_real(emcmot_hal_data->debug_float_0, emcmotStatus->spindle_status[0].speed); - hal_set_real(emcmot_hal_data->debug_float_1, emcmotStatus->spindleSync); - hal_set_real(emcmot_hal_data->debug_float_2, emcmotStatus->vel); - hal_set_real(emcmot_hal_data->debug_float_3, emcmotStatus->spindle_status[0].net_scale); - hal_set_si32(emcmot_hal_data->debug_s32_0, emcmotStatus->overrideLimitMask); - hal_set_si32(emcmot_hal_data->debug_s32_1, emcmotStatus->tcqlen); + hal_set_bool(emcmot_hal_data->debug_bool_0, joints[1].free_tp.active); + hal_set_bool(emcmot_hal_data->debug_bool_1, emcmotStatus->enables_new & AF_ENABLED); + hal_set_real(emcmot_hal_data->debug_real_0, emcmotStatus->spindle_status[0].speed); + hal_set_real(emcmot_hal_data->debug_real_1, emcmotStatus->spindleSync); + hal_set_real(emcmot_hal_data->debug_real_2, emcmotStatus->vel); + hal_set_real(emcmot_hal_data->debug_real_3, emcmotStatus->spindle_status[0].net_scale); + hal_set_sint(emcmot_hal_data->debug_sint_0, emcmotStatus->overrideLimitMask); + hal_set_sint(emcmot_hal_data->debug_sint_1, emcmotStatus->tcqlen); /* two way handshaking for the spindle encoder */ for (spindle_num = 0; spindle_num < emcmotConfig->numSpindles; spindle_num++){ @@ -2295,7 +2295,7 @@ static void update_status(void) // Get the current executing trajectory component (the "Source of Truth") /* Update the HAL Output Pins from the active tag */ // Line and Motion Type - hal_set_si32(emcmot_hal_data->interp_line_number, (int)emcmotStatus->tag.fields[GM_FIELD_LINE_NUMBER]); + hal_set_sint(emcmot_hal_data->interp_line_number, emcmotStatus->tag.fields[GM_FIELD_LINE_NUMBER]); // Performance Metadata hal_set_real(emcmot_hal_data->interp_feedrate, emcmotStatus->tag.fields_float[GM_FIELD_FLOAT_FEED]); diff --git a/src/emc/motion/homing.c b/src/emc/motion/homing.c index 662cd2f3591..04c26e4338d 100644 --- a/src/emc/motion/homing.c +++ b/src/emc/motion/homing.c @@ -249,7 +249,7 @@ static int base_make_joint_home_pins(int id,int njoints) 0, "joint.%d.homing", jno); retval += hal_pin_new_bool(id, HAL_OUT, &(addr->homed), 0, "joint.%d.homed", jno); - retval += hal_pin_new_si32(id, HAL_OUT, &(addr->home_state), + retval += hal_pin_new_sint(id, HAL_OUT, &(addr->home_state), 0, "joint.%d.home-state", jno); retval += hal_pin_new_bool(id, HAL_IO, &(addr->index_enable), 0, "joint.%d.index-enable", jno); @@ -558,7 +558,7 @@ static void base_write_homing_out_pins(int njoints) hal_set_bool(addr->homing, H[jno].homing); } hal_set_bool(addr->homed, H[jno].homed); // OUT - hal_set_si32(addr->home_state, H[jno].home_state); // OUT + hal_set_sint(addr->home_state, H[jno].home_state); // OUT // index_enable is a HAL_IO pin: the encoder driver also writes it // (clears it on the index pulse). We do not own it, so we must not // clamp it every cycle; drive it only on our own edges and otherwise diff --git a/src/emc/motion/mot_priv.h b/src/emc/motion/mot_priv.h index a996e183fa6..954de98dd84 100644 --- a/src/emc/motion/mot_priv.h +++ b/src/emc/motion/mot_priv.h @@ -148,14 +148,14 @@ typedef struct { hal_real_t requested_vel; /* RPI: requested velocity magnitude in machine units */ hal_real_t distance_to_go; /* RPI: distance to go in current move*/ - hal_bool_t debug_bit_0; /* RPA: generic param, for debugging */ - hal_bool_t debug_bit_1; /* RPA: generic param, for debugging */ - hal_real_t debug_float_0; /* RPA: generic param, for debugging */ - hal_real_t debug_float_1; /* RPA: generic param, for debugging */ - hal_real_t debug_float_2; /* RPA: generic param, for debugging */ - hal_real_t debug_float_3; /* RPA: generic param, for debugging */ - hal_sint_t debug_s32_0; /* RPA: generic param, for debugging */ - hal_sint_t debug_s32_1; /* RPA: generic param, for debugging */ + hal_bool_t debug_bool_0; /* RPA: generic param, for debugging */ + hal_bool_t debug_bool_1; /* RPA: generic param, for debugging */ + hal_real_t debug_real_0; /* RPA: generic param, for debugging */ + hal_real_t debug_real_1; /* RPA: generic param, for debugging */ + hal_real_t debug_real_2; /* RPA: generic param, for debugging */ + hal_real_t debug_real_3; /* RPA: generic param, for debugging */ + hal_sint_t debug_sint_0; /* RPA: generic param, for debugging */ + hal_sint_t debug_sint_1; /* RPA: generic param, for debugging */ hal_bool_t synch_do[EMCMOT_MAX_DIO]; /* WPI array: output pins for motion synched IO */ hal_bool_t synch_di[EMCMOT_MAX_DIO]; /* RPI array: input pins for motion synched IO */ diff --git a/src/emc/motion/motion.c b/src/emc/motion/motion.c index b0b5acd91da..30ce42a6315 100644 --- a/src/emc/motion/motion.c +++ b/src/emc/motion/motion.c @@ -597,7 +597,7 @@ static int init_hal_io(void) /* export machine wide hal pins */ CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_OUT, &(emcmot_hal_data->motion_enabled), 0, "motion.motion-enabled")); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_OUT, &(emcmot_hal_data->in_position), 0, "motion.in-position")); - CALL_CHECK(hal_pin_new_si32(mot_comp_id, HAL_OUT, &(emcmot_hal_data->motion_type), 0, "motion.motion-type")); + CALL_CHECK(hal_pin_new_sint(mot_comp_id, HAL_OUT, &(emcmot_hal_data->motion_type), 0, "motion.motion-type")); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_OUT, &(emcmot_hal_data->coord_mode), 0, "motion.coord-mode")); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_OUT, &(emcmot_hal_data->teleop_mode), 0, "motion.teleop-mode")); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_OUT, &(emcmot_hal_data->coord_error), 0, "motion.coord-error")); @@ -605,12 +605,12 @@ static int init_hal_io(void) CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_OUT, &(emcmot_hal_data->current_vel), 0.0, "motion.current-vel")); CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_OUT, &(emcmot_hal_data->requested_vel), 0.0, "motion.requested-vel")); CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_OUT, &(emcmot_hal_data->distance_to_go), 0.0, "motion.distance-to-go")); - CALL_CHECK(hal_pin_new_si32(mot_comp_id, HAL_OUT, &(emcmot_hal_data->program_line), 0, "motion.program-line")); + CALL_CHECK(hal_pin_new_sint(mot_comp_id, HAL_OUT, &(emcmot_hal_data->program_line), 0, "motion.program-line")); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_OUT, &(emcmot_hal_data->jog_is_active), 0, "motion.jog-is-active")); /* Standard Interp State Pins */ - CALL_CHECK(hal_pin_new_si32(mot_comp_id, HAL_OUT, &(emcmot_hal_data->interp_line_number), 0, "motion.interp.line-number")); - CALL_CHECK(hal_pin_new_si32(mot_comp_id, HAL_OUT, &(emcmot_hal_data->interp_motion_type), 0, "motion.interp.motion-type")); + CALL_CHECK(hal_pin_new_sint(mot_comp_id, HAL_OUT, &(emcmot_hal_data->interp_line_number), 0, "motion.interp.line-number")); + CALL_CHECK(hal_pin_new_sint(mot_comp_id, HAL_OUT, &(emcmot_hal_data->interp_motion_type), 0, "motion.interp.motion-type")); CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_OUT, &(emcmot_hal_data->interp_feedrate), 0.0, "motion.interp.feedrate")); /* New Geometric Metadata Pins */ @@ -625,21 +625,21 @@ static int init_hal_io(void) /* export debug parameters */ /* these can be used to view any internal variable, simply change a line in control.c:output_to_hal() and recompile */ - CALL_CHECK(hal_param_new_bool(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_bit_0), 0, "motion.debug-bit-0")); - CALL_CHECK(hal_param_new_bool(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_bit_1), 0, "motion.debug-bit-1")); - CALL_CHECK(hal_param_new_real(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_float_0), 0.0, "motion.debug-float-0")); - CALL_CHECK(hal_param_new_real(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_float_1), 0.0, "motion.debug-float-1")); - CALL_CHECK(hal_param_new_real(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_float_2), 0.0, "motion.debug-float-2")); - CALL_CHECK(hal_param_new_real(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_float_3), 0.0, "motion.debug-float-3")); - CALL_CHECK(hal_param_new_si32(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_s32_0), 0, "motion.debug-s32-0")); - CALL_CHECK(hal_param_new_si32(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_s32_1), 0, "motion.debug-s32-1")); + CALL_CHECK(hal_param_new_bool(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_bool_0), 0, "motion.debug-bool-0")); + CALL_CHECK(hal_param_new_bool(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_bool_1), 0, "motion.debug-bool-1")); + CALL_CHECK(hal_param_new_real(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_real_0), 0.0, "motion.debug-real-0")); + CALL_CHECK(hal_param_new_real(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_real_1), 0.0, "motion.debug-real-1")); + CALL_CHECK(hal_param_new_real(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_real_2), 0.0, "motion.debug-real-2")); + CALL_CHECK(hal_param_new_real(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_real_3), 0.0, "motion.debug-real-3")); + CALL_CHECK(hal_param_new_sint(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_sint_0), 0, "motion.debug-sint-0")); + CALL_CHECK(hal_param_new_sint(mot_comp_id, HAL_RO, &(emcmot_hal_data->debug_sint_1), 0, "motion.debug-sint-1")); // FIXME - debug only, remove later // export HAL parameters for some trajectory planner internal variables // so they can be scoped CALL_CHECK(hal_param_new_real(mot_comp_id, HAL_RO, &(emcmot_hal_data->traj_pos_out), 0.0, "traj.pos_out")); CALL_CHECK(hal_param_new_real(mot_comp_id, HAL_RO, &(emcmot_hal_data->traj_vel_out), 0.0, "traj.vel_out")); - CALL_CHECK(hal_param_new_ui32(mot_comp_id, HAL_RO, &(emcmot_hal_data->traj_active_tc), 0, "traj.active_tc")); + CALL_CHECK(hal_param_new_uint(mot_comp_id, HAL_RO, &(emcmot_hal_data->traj_active_tc), 0, "traj.active_tc")); for (n = 0; n < 4; n++) { CALL_CHECK(hal_param_new_real(mot_comp_id, HAL_RO, &(emcmot_hal_data->tc_pos[n]), 0.0, "tc.%d.pos", n)); @@ -649,7 +649,7 @@ static int init_hal_io(void) // end of exporting trajectory planner internals // export timing related HAL pins so they can be scoped and/or connected - CALL_CHECK(hal_pin_new_ui32(mot_comp_id, HAL_OUT, &(emcmot_hal_data->last_period), 0, "motion.servo.last-period")); + CALL_CHECK(hal_pin_new_uint(mot_comp_id, HAL_OUT, &(emcmot_hal_data->last_period), 0, "motion.servo.last-period")); // export timing related HAL pins so they can be scoped CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_OUT, &(emcmot_hal_data->tooloffset_x), 0.0, "motion.tooloffset.x")); @@ -728,11 +728,11 @@ static int export_spindle(int num, spindle_hal_t * addr){ // spindle orient pins CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_OUT, &(addr->spindle_orient_angle), 0.0, "spindle.%d.orient-angle", num)); - CALL_CHECK(hal_pin_new_si32(mot_comp_id, HAL_OUT, &(addr->spindle_orient_mode), 0, "spindle.%d.orient-mode", num)); + CALL_CHECK(hal_pin_new_sint(mot_comp_id, HAL_OUT, &(addr->spindle_orient_mode), 0, "spindle.%d.orient-mode", num)); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_OUT, &(addr->spindle_orient), 0, "spindle.%d.orient", num)); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_OUT, &(addr->spindle_locked), 0, "spindle.%d.locked", num)); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_IN, &(addr->spindle_is_oriented), 0, "spindle.%d.is-oriented", num)); - CALL_CHECK(hal_pin_new_si32(mot_comp_id, HAL_IN, &(addr->spindle_orient_fault), 0, "spindle.%d.orient-fault", num)); + CALL_CHECK(hal_pin_new_sint(mot_comp_id, HAL_IN, &(addr->spindle_orient_fault), 0, "spindle.%d.orient-fault", num)); CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_IN, &(addr->spindle_revs), 0.0, "spindle.%d.revs", num)); CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_IN, &(addr->spindle_speed_in), 0.0, "spindle.%d.speed-in", num)); @@ -764,7 +764,7 @@ static int export_joint(int num, joint_hal_t * addr) CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_IN, &(addr->neg_lim_sw), 0, "joint.%d.neg-lim-sw-in", num)); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_OUT, &(addr->amp_enable), 0, "joint.%d.amp-enable-out", num)); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_IN, &(addr->amp_fault), 0, "joint.%d.amp-fault-in", num)); - CALL_CHECK(hal_pin_new_si32(mot_comp_id, HAL_IN, &(addr->jjog_counts), 0, "joint.%d.jog-counts", num)); + CALL_CHECK(hal_pin_new_sint(mot_comp_id, HAL_IN, &(addr->jjog_counts), 0, "joint.%d.jog-counts", num)); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_IN, &(addr->jjog_enable), 0, "joint.%d.jog-enable", num)); CALL_CHECK(hal_pin_new_real(mot_comp_id, HAL_IN, &(addr->jjog_scale), 0.0, "joint.%d.jog-scale", num)); CALL_CHECK(hal_pin_new_bool(mot_comp_id, HAL_IN, &(addr->jjog_vel_mode), 0, "joint.%d.jog-vel-mode", num)); @@ -1027,7 +1027,7 @@ static int init_threads(void) /* create HAL threads for each period */ /* only create base thread if it is faster than servo thread */ if (servo_base_ratio > 1) { - retval = hal_create_thread("base-thread", base_period_nsec, base_thread_fp); + retval = hal_create_thread("base-thread", base_period_nsec); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "MOTION: failed to create %ld nsec base thread\n", @@ -1035,7 +1035,7 @@ static int init_threads(void) return -1; } } - retval = hal_create_thread("servo-thread", servo_period_nsec, 1); + retval = hal_create_thread("servo-thread", servo_period_nsec); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "MOTION: failed to create %ld nsec servo thread\n", @@ -1044,14 +1044,14 @@ static int init_threads(void) } /* export realtime functions that do the real work */ retval = hal_export_funct("motion-controller", emcmotController, 0 /* arg - */ , 1 /* uses_fp */ , 0 /* reentrant */ , mot_comp_id); + */ , 0 /* reentrant */ , mot_comp_id); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "MOTION: failed to export controller function\n"); return -1; } retval = hal_export_funct("motion-command-handler", emcmotCommandHandler, 0 /* arg - */ , 1 /* uses_fp */ , 0 /* reentrant */ , mot_comp_id); + */ , 0 /* reentrant */ , mot_comp_id); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "MOTION: failed to export command handler function\n"); diff --git a/src/emc/motion/motion.h b/src/emc/motion/motion.h index 06ff25eb0ba..50836f0a58a 100644 --- a/src/emc/motion/motion.h +++ b/src/emc/motion/motion.h @@ -487,7 +487,7 @@ Suggestion: Split this in to an Error and a Status flag register.. double motor_offset; /* diff between internal and motor pos, used to set position to zero during homing */ - int old_jjog_counts; /* prior value, used for deltas */ + rtapi_sint old_jjog_counts; /* prior value, used for deltas */ double big_vel; /* used for "debouncing" velocity */ } emcmot_joint_t; @@ -538,7 +538,7 @@ Suggestion: Split this in to an Error and a Status flag register.. int direction; // 0 stopped, 1 forward, -1 reverse int brake; // 0 released, 1 engaged int locked; // spindle lock engaged after orient - int orient_fault; // fault code from motion.spindle-orient-fault + rtapi_sint orient_fault; // fault code from motion.spindle-orient-fault int orient_state; // orient_state_t int spindle_index_enable; /* hooked to a canon encoder index-enable */ double spindleRevs; /* position of spindle in revolutions */ diff --git a/src/emc/nml_intf/state_tag.h b/src/emc/nml_intf/state_tag.h index 91c2049c8ae..8c253460a48 100644 --- a/src/emc/nml_intf/state_tag.h +++ b/src/emc/nml_intf/state_tag.h @@ -26,6 +26,7 @@ #ifndef STATE_TAG_H #define STATE_TAG_H +#include /** * Enum to define bit names for StateTag's flags register. @@ -127,7 +128,7 @@ struct state_tag_t { // Any G / M code states that doesn't pack nicely into a single bit // These are an array mostly because it's easier to pass an // arbitrary-length array through NML than individual fields - int fields[GM_FIELD_MAX_FIELDS]; + rtapi_sint fields[GM_FIELD_MAX_FIELDS]; /** G / M mode flags for simple states like inch / mm, feedhold enable, etc. * This stores packed bits in one field (since we can't use a bitset in a diff --git a/src/emc/rs274ngc/interp_namedparams.cc b/src/emc/rs274ngc/interp_namedparams.cc index fb12f1e8d26..b20fabbda34 100644 --- a/src/emc/rs274ngc/interp_namedparams.cc +++ b/src/emc/rs274ngc/interp_namedparams.cc @@ -327,8 +327,6 @@ int Interp::fetch_hal_param( const char *nameBuf, int *status, double *value) assign: switch (type) { case HAL_BOOL: *value = (double)qval.b; break; - case HAL_U32: *value = (double)qval.u; break; - case HAL_S32: *value = (double)qval.s; break; case HAL_UINT: *value = (double)qval.u; break; case HAL_SINT: *value = (double)qval.s; break; case HAL_REAL: *value = (double)qval.r; break; diff --git a/src/emc/rs274ngc/rs274ngc_pre.cc b/src/emc/rs274ngc/rs274ngc_pre.cc index 4163dc99a7c..8585ea31b03 100644 --- a/src/emc/rs274ngc/rs274ngc_pre.cc +++ b/src/emc/rs274ngc/rs274ngc_pre.cc @@ -2274,7 +2274,7 @@ void Interp::print_state_tag(StateTag const &tag) { // Extract as-is field values directly into appropriate array // position - logStateTags("State tag (%s @ %p): fields LINE_NUMBER %d, MOTION_MODE %d " + logStateTags("State tag (%s @ %p): fields LINE_NUMBER %ld, MOTION_MODE %ld " "ORIGIN G%0.1f; flags UNITS %s, DISTANCE_MODE %s, " "SPINDLE_ON %s", tag.is_valid() ? "valid" : "invalid", diff --git a/src/emc/usr_intf/axis/scripts/axis.py b/src/emc/usr_intf/axis/scripts/axis.py index ddc37661b0a..9ece2ca9efd 100755 --- a/src/emc/usr_intf/axis/scripts/axis.py +++ b/src/emc/usr_intf/axis/scripts/axis.py @@ -4174,7 +4174,7 @@ def select_run_from(e): comp.newpin("error", hal.Type.BOOL, hal.Dir.OUT) comp.newpin("abort", hal.Type.BOOL, hal.Dir.OUT) comp.newpin('mpg-enable', hal.Type.BOOL, hal.Dir.IN) - comp.newpin('mpg-in', hal.HAL_S32, hal.Dir.IN) + comp.newpin('mpg-in', hal.Type.SINT, hal.Dir.IN) vars.has_ladder.set(hal.component_exists('classicladder_rt')) diff --git a/src/emc/usr_intf/axis/scripts/hal_manualtoolchange.py b/src/emc/usr_intf/axis/scripts/hal_manualtoolchange.py index cb4acceaff6..65ec28150ec 100644 --- a/src/emc/usr_intf/axis/scripts/hal_manualtoolchange.py +++ b/src/emc/usr_intf/axis/scripts/hal_manualtoolchange.py @@ -78,7 +78,7 @@ def get_tool_change_message(n): h = hal.component("hal_manualtoolchange") -h.newpin("number", hal.HAL_S32, hal.Dir.IN) +h.newpin("number", hal.Type.SINT, hal.Dir.IN) h.newpin("change", hal.Type.BOOL, hal.Dir.IN) h.newpin("change_button", hal.Type.BOOL, hal.Dir.IN) h.newpin("changed", hal.Type.BOOL, hal.Dir.OUT) diff --git a/src/emc/usr_intf/axis/scripts/haltest.py b/src/emc/usr_intf/axis/scripts/haltest.py deleted file mode 100644 index 4d64f3e229f..00000000000 --- a/src/emc/usr_intf/axis/scripts/haltest.py +++ /dev/null @@ -1,10 +0,0 @@ -from hal import *; import time -h = component("test"); -h.newpin("i", HAL_S32, HAL_OUT); -h.newpin("f", HAL_FLOAT, HAL_OUT); -h.newpin("u32", HAL_U32, HAL_OUT); -while 1: - h.i += 1; - h.f = h.i * .3125 - h.u32 = (7*h.i) % 256 - time.sleep(.1) diff --git a/src/emc/usr_intf/gmoccapy/gmoccapy.py b/src/emc/usr_intf/gmoccapy/gmoccapy.py index a4f2632f6e4..0fc40533026 100644 --- a/src/emc/usr_intf/gmoccapy/gmoccapy.py +++ b/src/emc/usr_intf/gmoccapy/gmoccapy.py @@ -6585,13 +6585,13 @@ def _make_hal_pins(self): hal_glib.GPin(pin).connect("value_changed", self._on_unlock_settings_changed) # generate the pins to connect encoders to the sliders - pin = self.halcomp.newpin("feed.feed-override.counts", hal.HAL_S32, hal.Dir.IN) + pin = self.halcomp.newpin("feed.feed-override.counts", hal.Type.SINT, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_counts_changed, "spc_feed") - pin = self.halcomp.newpin("spindle.spindle-override.counts", hal.HAL_S32, hal.Dir.IN) + pin = self.halcomp.newpin("spindle.spindle-override.counts", hal.Type.SINT, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_counts_changed, "spc_spindle") - pin = self.halcomp.newpin("jog.jog-velocity.counts", hal.HAL_S32, hal.Dir.IN) + pin = self.halcomp.newpin("jog.jog-velocity.counts", hal.Type.SINT, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_counts_changed, "spc_lin_jog_vel") - pin = self.halcomp.newpin("rapid.rapid-override.counts", hal.HAL_S32, hal.Dir.IN) + pin = self.halcomp.newpin("rapid.rapid-override.counts", hal.Type.SINT, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._on_counts_changed, "spc_rapid") self.halcomp.newpin("feed.feed-override.count-enable", hal.Type.BOOL, hal.Dir.IN) self.halcomp.newpin("spindle.spindle-override.count-enable", hal.Type.BOOL, hal.Dir.IN) @@ -6642,7 +6642,7 @@ def _make_hal_pins(self): hal_glib.GPin(pin).connect("value_changed", self._del_message_changed) # for manual tool change dialog - self.halcomp.newpin("toolchange-number", hal.HAL_S32, hal.Dir.IN) + self.halcomp.newpin("toolchange-number", hal.Type.SINT, hal.Dir.IN) self.halcomp.newpin("toolchange-changed", hal.Type.BOOL, hal.Dir.OUT) pin = self.halcomp.newpin('toolchange-change', hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect('value_changed', self.on_tool_change) @@ -6667,8 +6667,8 @@ def _make_hal_pins(self): self.halcomp.newpin("error", hal.Type.BOOL, hal.Dir.OUT) # make pins to indicate program progress information - self.halcomp.newpin("program.length", hal.HAL_S32, hal.Dir.OUT) - self.halcomp.newpin("program.current-line", hal.HAL_S32, hal.Dir.OUT) + self.halcomp.newpin("program.length", hal.Type.SINT, hal.Dir.OUT) + self.halcomp.newpin("program.current-line", hal.Type.SINT, hal.Dir.OUT) self.halcomp.newpin("program.progress", hal.Type.REAL, hal.Dir.OUT) # make a pin to set ignore limits @@ -6681,7 +6681,7 @@ def _make_hal_pins(self): pin = self.halcomp.newpin("blockdelete", hal.Type.BOOL, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._blockdelete) - pin = self.halcomp.newpin('mpg-in',hal.HAL_S32, hal.HAL_IN) + pin = self.halcomp.newpin('mpg-in',hal.Type.SINT, hal.Dir.IN) hal_glib.GPin(pin).connect("value_changed", self._external_mpg) ############################## diff --git a/src/emc/usr_intf/gscreen/gscreen.py b/src/emc/usr_intf/gscreen/gscreen.py index 80ae44eed34..8f86f0ace7f 100755 --- a/src/emc/usr_intf/gscreen/gscreen.py +++ b/src/emc/usr_intf/gscreen/gscreen.py @@ -1672,9 +1672,9 @@ def init_jog_pins(self): self.halcomp.newpin("jog-enable-%s-out"% (axis), hal.Type.BOOL, hal.Dir.OUT) self.halcomp.newpin("jog-enable-out", hal.Type.BOOL, hal.Dir.OUT) self.halcomp.newpin("jog-increment-out", hal.Type.REAL, hal.Dir.OUT) - #self.data['jog-increment-in'] = hal_glib.GPin(self.halcomp.newpin('jog-increment-in', hal.HAL_S32, hal.Dir.IN)) + #self.data['jog-increment-in'] = hal_glib.GPin(self.halcomp.newpin('jog-increment-in', hal.Type.SINT, hal.Dir.IN)) #self.data['jog-increment-in'].connect('value-changed', self.on_hal_jog_increments_changed) - #self.data['jog-rate-in'] = hal_glib.GPin(self.halcomp.newpin('jog-rate-in', hal.HAL_S32, hal.Dir.IN)) + #self.data['jog-rate-in'] = hal_glib.GPin(self.halcomp.newpin('jog-rate-in', hal.Type.SINT, hal.Dir.IN)) #self.data['jog-rate-in'].connect('value-changed', self.on_hal_jog_rate_changed) # pins used for selecting an encoder to adjust overrides @@ -1706,7 +1706,7 @@ def initialize_manual_toolchange(self): or the default function """ # for manual tool change dialog - self.halcomp.newpin("tool-number", hal.HAL_S32, hal.Dir.IN) + self.halcomp.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) self.halcomp.newpin("tool-changed", hal.Type.BOOL, hal.Dir.OUT) self.data['change-tool'] = hal_glib.GPin(self.halcomp.newpin('change-tool', hal.Type.BOOL, hal.Dir.IN)) # you can override manual tool change diff --git a/src/emc/usr_intf/pncconf/options.glade b/src/emc/usr_intf/pncconf/options.glade index caab2c39f70..4788efe0990 100644 --- a/src/emc/usr_intf/pncconf/options.glade +++ b/src/emc/usr_intf/pncconf/options.glade @@ -602,7 +602,7 @@ True False 5 - Number of digital (bit) in pins: + Number of digital (bool) in pins: True digitsin 0.019999999552965164 @@ -619,7 +619,7 @@ True False 3 - Number of digital (bit) out pins: + Number of digital (bool) out pins: True digitsout 0.039999999105930328 @@ -635,7 +635,7 @@ True False 6 - Number of analog (s32) in pins: + Number of analog (sint) in pins: True word-char s32in @@ -652,7 +652,7 @@ True False 5 - Number of analog (s32) out pins: + Number of analog (sint) out pins: True s32out 0 @@ -668,7 +668,7 @@ True False 5 - Number of analog (float) in pins: + Number of analog (real) in pins: True s32out 0 @@ -684,7 +684,7 @@ True False 5 - Number of analog (float) out pins: + Number of analog (real) out pins: True s32out 0 diff --git a/src/emc/usr_intf/pncconf/tests.py b/src/emc/usr_intf/pncconf/tests.py index 0b367806a35..09df67b28ed 100644 --- a/src/emc/usr_intf/pncconf/tests.py +++ b/src/emc/usr_intf/pncconf/tests.py @@ -616,7 +616,7 @@ def get_value(d): # do I/O write commands for i in write: halrun.write('%s\n'%i) - halrun.write( "newsig estop-out bit\n") + halrun.write( "newsig estop-out bool\n") halrun.write( "sets estop-out false\n") halrun.write("setp pid.0.Pgain %d\n"% ( w[axis+"P"].get_value() )) halrun.write("setp pid.0.Igain %d\n"% ( w[axis+"I"].get_value() )) @@ -973,11 +973,11 @@ def get_value(d): halrun.write( "addf charge-pump servo-thread\n") for i in write: halrun.write('%s\n'%i) - halrun.write( "newsig estop-out bit\n") + halrun.write( "newsig estop-out bool\n") halrun.write( "sets estop-out false\n") - halrun.write( "newsig enable-not bit\n") - halrun.write( "newsig dir-not bit\n") - halrun.write( "newsig dir bit\n") + halrun.write( "newsig enable-not bool\n") + halrun.write( "newsig dir-not bool\n") + halrun.write( "newsig dir bool\n") # search for pins with test signals that may be needed to enable amp self.hal_test_signals(axis) @@ -1415,7 +1415,7 @@ def update(self): def make_blank(self,container,boardnum,number): #blankname = "enc-%d" % (number) #self.data2["brd%denc%d" % (boardnum,number)]= Gtk.Button("Reset-%d"% number) - #self.hal.c.newpin(encname, hal.HAL_S32, hal.Dir.IN) + #self.hal.c.newpin(encname, hal.Type.SINT, hal.Dir.IN) label = Gtk.Label(" ") container.pack_start(label, False, False, 10) label = Gtk.Label(" ") @@ -1431,9 +1431,9 @@ def make_enc(self,container,boardnum,number): self.data2["brd%denc%dreset" % (boardnum,number)]= Gtk.Button("Reset-%d"% number) container.pack_start(self.data2["brd%denc%dreset" % (boardnum,number)], False, False, 10) encname = "brd.%d.enc.%d.count" % (boardnum,number) - print("making HAL pin enc s32 brd %d num %d"%(boardnum,number)) - self.hal.c.newpin(encname, hal.HAL_S32, hal.Dir.IN) - hal.new_sig(encname+"-signal",hal.HAL_S32) + print("making HAL pin enc sint brd %d num %d"%(boardnum,number)) + self.hal.c.newpin(encname, hal.Type.SINT, hal.Dir.IN) + hal.new_sig(encname+"-signal",hal.Type.SINT) hal.connect("testpanel."+encname,encname+"-signal") label = self.data2["brd%denc%dcount" % (boardnum,number)] = Gtk.Label("Encoder-%d"% (number)) label.set_size_request(100, -1) diff --git a/src/emc/usr_intf/pyui/_panelui.ini b/src/emc/usr_intf/pyui/_panelui.ini index 5818f15cc09..9feb5906252 100644 --- a/src/emc/usr_intf/pyui/_panelui.ini +++ b/src/emc/usr_intf/pyui/_panelui.ini @@ -1,7 +1,7 @@ [RADIO_BUTTONS] [[mpg_scale]] KEY = NONE - OUTPUT = FLOAT + OUTPUT = REAL DEFAULT = mpg_small [[[mpg_small]]] KEY = R6C2 @@ -25,20 +25,20 @@ KEY = R0C3 GROUP = mpg_scale GROUP_OUTPUT = .01 - OUTPUT = S32 + OUTPUT = SINT STATUS_PIN = True TRUE_STATE = 20 FALSE_STATE = 0 DEFAULT = false [[axis_select]] KEY = select_axis - OUTPUT = S32 + OUTPUT = SINT DEFAULT = select_x [[[select_x]]] KEY = R5C2 GROUP = axis_select GROUP_OUTPUT = 1 - OUTPUT = BIT + OUTPUT = BOOL TRUE_STATE = True FALSE_STATE = False STATUS_PIN = True @@ -47,7 +47,7 @@ KEY = R4C2 GROUP = axis_select GROUP_OUTPUT = 2 - OUTPUT = BIT + OUTPUT = BOOL TRUE_STATE = True FALSE_STATE = False STATUS_PIN = True @@ -56,7 +56,7 @@ [TOGGLE_BUTTONS] [[tool_change]] KEY = R2C5 - OUTPUT = BIT + OUTPUT = BOOL TRUE_COMMAND = NONE, NONE FALSE_COMMAND = NONE, NONE STATUS_PIN = True diff --git a/src/emc/usr_intf/pyui/panelui_spec.ini b/src/emc/usr_intf/pyui/panelui_spec.ini index de686301ce3..426e9538ef6 100644 --- a/src/emc/usr_intf/pyui/panelui_spec.ini +++ b/src/emc/usr_intf/pyui/panelui_spec.ini @@ -8,12 +8,12 @@ # Radio button need two levels of sections # The first level: [GROUP_NAME] defines the groups name # KEY=None -# OUTPUT= HAL PIN TYPE (S32 U32 or FLOAT) +# OUTPUT= HAL PIN TYPE (SINT UINT or REAL) # DEFAULT= KEYNAME of the default selected key in level two [[__many__]] KEY = string - OUTPUT = option('NONE','S32', 'U32', 'FLOAT',default='S32') + OUTPUT = option('NONE','SINT', 'UINT', 'REAL',default='SINT') DEFAULT = string # The second sections define the keys in this group @@ -21,7 +21,7 @@ KEY = string GROUP = string GROUP_OUTPUT = number() - OUTPUT = option('S32', 'U32', 'FLOAT', 'BIT','COMMAND','ZMQ','NONE',default='S32') + OUTPUT = option('SINT', 'UINT', 'REAL', 'BOOL','COMMAND','ZMQ','NONE',default='SINT') STATUS_PIN = boolean TRUE_STATE = string FALSE_STATE = string @@ -33,7 +33,7 @@ [TOGGLE_BUTTONS] [[__many__]] KEY = string - OUTPUT = option('S32', 'U32', 'FLOAT', 'BIT','COMMAND','ZMQ','NONE',default='S32') + OUTPUT = option('SINT', 'UINT', 'REAL', 'BOOL','COMMAND','ZMQ','NONE',default='SINT') STATUS_PIN = boolean TRUE_COMMAND = list(default='NONE',) FALSE_COMMAND = list(default='NONE',) @@ -46,7 +46,7 @@ [MOMENTARY_BUTTONS] [[__many__]] KEY = string - OUTPUT = option('S32', 'U32', 'FLOAT', 'BIT','COMMAND','ZMQ','NONE',default='S32') + OUTPUT = option('SINT', 'UINT', 'REAL', 'BOOL','COMMAND','ZMQ','NONE',default='SINT') STATUS_PIN = boolean TRUE_COMMAND = list(default='NONE') FALSE_COMMAND = list(default='NONE') diff --git a/src/emc/usr_intf/pyui/widgets.py b/src/emc/usr_intf/pyui/widgets.py index 53be78a0f96..751cd4809fc 100644 --- a/src/emc/usr_intf/pyui/widgets.py +++ b/src/emc/usr_intf/pyui/widgets.py @@ -29,19 +29,19 @@ def hal_init(self, master, comp, name,metadata,command,widgets,dbg): self.metadata['FALSE_STATE'] = 0 # convert and set pintype and states based on metadata types - if self.metadata['OUTPUT'] == 'S32': - self.pintype=hal.HAL_S32 + if self.metadata['OUTPUT'] in ('SINT', 'S32'): + self.pintype=hal.Type.SINT self.true_state = int(self.metadata['TRUE_STATE']) self.false_state = int(self.metadata['FALSE_STATE']) - elif self.metadata['OUTPUT'] == 'U32': - self.pintype=hal.HAL_U32 + elif self.metadata['OUTPUT'] in ('UINT', 'U32'): + self.pintype=hal.Type.UINT self.true_state = int(self.metadata['TRUE_STATE']) self.false_state = int(self.metadata['FALSE_STATE']) - elif self.metadata['OUTPUT'] == 'REAL' or self.metadata['OUTPUT'] == 'FLOAT': + elif self.metadata['OUTPUT'] in ('REAL', 'FLOAT'): self.pintype=hal.Type.REAL self.true_state = float(self.metadata['TRUE_STATE']) self.false_state = float(self.metadata['FALSE_STATE']) - elif self.metadata['OUTPUT'] == 'BOOL' or self.metadata['OUTPUT'] == 'BIT': + elif self.metadata['OUTPUT'] in ('BOOL', 'BIT'): self.pintype=hal.Type.BOOL self.true_state = True#self.metadata['TRUE_STATE'] self.false_state = False#self.metadata['FALSE_STATE'] diff --git a/src/emc/usr_intf/stepconf/options.glade b/src/emc/usr_intf/stepconf/options.glade index 95af24da530..0c2f32117a6 100644 --- a/src/emc/usr_intf/stepconf/options.glade +++ b/src/emc/usr_intf/stepconf/options.glade @@ -976,7 +976,7 @@ panel True False 6 - Number of analog (s32) in pins: + Number of analog (sint) in pins: True word-char s32in @@ -992,7 +992,7 @@ panel True False 5 - Number of analog (s32) out pins: + Number of analog (sint) out pins: True s32out 0 diff --git a/src/emc/usr_intf/touchy/hal_interface.py b/src/emc/usr_intf/touchy/hal_interface.py index 4864d2bf9f8..18802297492 100644 --- a/src/emc/usr_intf/touchy/hal_interface.py +++ b/src/emc/usr_intf/touchy/hal_interface.py @@ -82,7 +82,7 @@ def __init__(self, gui, emc_control, mdi_control, emc): self.abort = 0 self.c.newpin("single-block", hal.Type.BOOL, hal.Dir.IN) self.singleblock = 0 - self.c.newpin("wheel-counts", hal.HAL_S32, hal.Dir.IN) + self.c.newpin("wheel-counts", hal.Type.SINT, hal.Dir.IN) self.counts = 0 self.jog_velocity = 1 self.c.ready() diff --git a/src/hal/classicladder/module_hal.c b/src/hal/classicladder/module_hal.c index d3ac7495548..bb72cb84f29 100644 --- a/src/hal/classicladder/module_hal.c +++ b/src/hal/classicladder/module_hal.c @@ -178,7 +178,7 @@ int rtapi_app_main(void) { rtapi_print("creating ladder-state\n"); - result = hal_export_funct("classicladder.0.refresh",hal_task,0,1, 0, compId); + result = hal_export_funct("classicladder.0.refresh", hal_task, 0, 0, compId); if(result < 0) { error: hal_exit(compId); diff --git a/src/hal/components/.gitignore b/src/hal/components/.gitignore index 01a447a5a38..c18fb61471b 100644 --- a/src/hal/components/.gitignore +++ b/src/hal/components/.gitignore @@ -1 +1,2 @@ conv_*.comp +!conv_real_bool.comp diff --git a/src/hal/components/Submakefile b/src/hal/components/Submakefile index 62c9940cfbb..6c6ed4850de 100644 --- a/src/hal/components/Submakefile +++ b/src/hal/components/Submakefile @@ -3,35 +3,17 @@ COMPS := $(filter-out %/tpcomp.comp, $(patsubst $(BASEPWD)/%,%,$(wildcard $(BASE include $(patsubst %.comp, $(BASEPWD)/objects/%.mak, $(COMPS)) else CONVERTERS := \ - conv_bit_float.comp \ - conv_bit_s32.comp \ - conv_bit_u32.comp \ - conv_bit_s64.comp \ - conv_bit_u64.comp \ - conv_float_s32.comp \ - conv_float_u32.comp \ - conv_float_s64.comp \ - conv_float_u64.comp \ - conv_s32_bit.comp \ - conv_s32_float.comp \ - conv_s32_u32.comp \ - conv_s32_s64.comp \ - conv_s32_u64.comp \ - conv_s64_bit.comp \ - conv_s64_float.comp \ - conv_s64_s32.comp \ - conv_s64_u32.comp \ - conv_s64_u64.comp \ - conv_u32_bit.comp \ - conv_u32_float.comp \ - conv_u32_s32.comp \ - conv_u32_s64.comp \ - conv_u32_u64.comp \ - conv_u64_bit.comp \ - conv_u64_float.comp \ - conv_u64_s32.comp \ - conv_u64_u32.comp \ - conv_u64_s64.comp + conv_bool_real.comp \ + conv_bool_sint.comp \ + conv_bool_uint.comp \ + conv_real_sint.comp \ + conv_real_uint.comp \ + conv_sint_bool.comp \ + conv_sint_real.comp \ + conv_sint_uint.comp \ + conv_uint_bool.comp \ + conv_uint_real.comp \ + conv_uint_sint.comp COMPS := $(filter-out hal/components/tpcomp.comp, $(sort $(wildcard hal/components/*.comp) $(addprefix hal/components/, $(CONVERTERS)))) COMP_MANPAGES := $(patsubst hal/components/%.comp, ../docs/build/man/man9/%.9, $(COMPS)) ../docs/build/man/man9/tpcomp.9 ifeq ($(BUILD_SYS),uspace) @@ -136,118 +118,46 @@ PYFLAGS := $(PYTHON_EXTRA_LDFLAGS) $(BOOST_PYTHON_LIB) $(PYTHON_LIBS) $(PYTHON_E $(Q)$(CC) -Wl,-z,relro -o $@ $^ $(PYFLAGS) TARGETS += ../bin/panelui -hal/components/conv_float_s32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_real_sint.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh float s32 < $< > $@ + $(Q)sh hal/components/mkconv.sh real sint < $< > $@ -hal/components/conv_float_u32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_real_uint.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh float u32 < $< > $@ + $(Q)sh hal/components/mkconv.sh real uint < $< > $@ -hal/components/conv_float_s64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_bool_sint.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh float s64 < $< > $@ + $(Q)sh hal/components/mkconv.sh bool sint < $< > $@ -hal/components/conv_float_u64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_bool_uint.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh float u64 < $< > $@ + $(Q)sh hal/components/mkconv.sh bool uint < $< > $@ -hal/components/conv_bit_s32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_bool_real.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh bit s32 < $< > $@ + $(Q)sh hal/components/mkconv.sh bool real < $< > $@ -hal/components/conv_bit_u32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_sint_real.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh bit u32 < $< > $@ + $(Q)sh hal/components/mkconv.sh sint real < $< > $@ -hal/components/conv_bit_s64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_sint_bool.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh bit s64 < $< > $@ + $(Q)sh hal/components/mkconv.sh sint bool < $< > $@ -hal/components/conv_bit_u64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_sint_uint.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh bit u64 < $< > $@ + $(Q)sh hal/components/mkconv.sh sint uint < $< > $@ -hal/components/conv_bit_float.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_uint_real.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh bit float < $< > $@ + $(Q)sh hal/components/mkconv.sh uint real < $< > $@ -hal/components/conv_s32_float.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_uint_bool.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s32 float < $< > $@ + $(Q)sh hal/components/mkconv.sh uint bool < $< > $@ -hal/components/conv_s32_bit.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile +hal/components/conv_uint_sint.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s32 bit < $< > $@ - -hal/components/conv_s32_u32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s32 u32 < $< > $@ - -hal/components/conv_s32_u64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s32 u64 < $< > $@ - -hal/components/conv_s32_s64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s32 s64 < $< > $@ - -hal/components/conv_u32_float.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u32 float < $< > $@ - -hal/components/conv_u32_bit.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u32 bit < $< > $@ - -hal/components/conv_u32_s32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u32 s32 < $< > $@ - -hal/components/conv_u32_u64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u32 u64 < $< > $@ - -hal/components/conv_u32_s64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u32 s64 < $< > $@ - -hal/components/conv_s64_float.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s64 float < $< > $@ - -hal/components/conv_s64_bit.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s64 bit < $< > $@ - -hal/components/conv_s64_u32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s64 u32 < $< > $@ - -hal/components/conv_s64_s32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s64 s32 < $< > $@ - -hal/components/conv_s64_u64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh s64 u64 < $< > $@ - -hal/components/conv_u64_float.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u64 float < $< > $@ - -hal/components/conv_u64_bit.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u64 bit < $< > $@ - -hal/components/conv_u64_u32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u64 u32 < $< > $@ - -hal/components/conv_u64_s32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u64 s32 < $< > $@ - -hal/components/conv_u64_s64.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile - $(ECHO) converting conv for $(notdir $@) - $(Q)sh hal/components/mkconv.sh u64 s64 < $< > $@ + $(Q)sh hal/components/mkconv.sh uint sint < $< > $@ diff --git a/src/hal/components/abs_s32.comp b/src/hal/components/abs_s32.comp deleted file mode 100644 index 4ee33a9cf4e..00000000000 --- a/src/hal/components/abs_s32.comp +++ /dev/null @@ -1,41 +0,0 @@ -// This is a component for LinuxCNC HAL -// Copyright 2011 Sebastian Kuzminsky -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the GNU General -// Public License as published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -component abs_s32 "Compute the absolute value and sign of a integer input signal"; - -pin in si32 in "input value" ; -pin out si32 out "output value, always non-negative"; -pin out bool sign "Sign of input, false for positive, true for negative" ; -pin out bool is_positive_ "TRUE if input is positive, FALSE if input is 0 or negative"; -pin out bool is_negative_ "TRUE if input is negative, FALSE if input is 0 or positive"; - -option period no; -function _; -license "GPL"; -author "Sebastian Kuzminsky"; -;; -FUNCTION(_) { - rtapi_s32 i = in; - if ( i >= 0 ) { - sign_set(false); - out_set(i); - } else { - sign_set(true); - out_set(-i); - } - - is_positive__set(i > 0); - is_negative__set(i < 0); -} diff --git a/src/hal/components/abs_s64.comp b/src/hal/components/abs_sint.comp similarity index 94% rename from src/hal/components/abs_s64.comp rename to src/hal/components/abs_sint.comp index 012552b83c6..311030c7e5a 100644 --- a/src/hal/components/abs_s64.comp +++ b/src/hal/components/abs_sint.comp @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -component abs_s64 "Computes the absolute value and sign of a 64 bit integer input signal"; +component abs_sint "Computes the absolute value and sign of an integer input signal"; pin in sint in "input value" ; pin out sint out "output value, always non-negative"; diff --git a/src/hal/components/anglejog.comp b/src/hal/components/anglejog.comp index 876d04bf66a..23b4747bffb 100644 --- a/src/hal/components/anglejog.comp +++ b/src/hal/components/anglejog.comp @@ -21,7 +21,7 @@ is false. The value in use is output on the current-scale pin. pin is false. The value in use is output on the current-angle-degrees pin. 4. The value of the iscale-factor pin multiplies counts-in internally -to support integer (s32) calculations for counting. The current-scale-out +to support integer calculations for counting. The current-scale-out is divided by the same amount. The pin is sampled only when the enable-in pin is false. The default value should work in most applications. @@ -37,9 +37,9 @@ Simulation Config: `configs/sim/axis/anglejog/anglejog.in` """; pin in bool enable_in "enables motion (disables alteration of angle and scale)"; -pin in si32 counts_in "MPG (wheel) counts"; +pin in sint counts_in "MPG (wheel) counts"; pin in real angle_degrees_in "vector angle"; -pin in si32 iscale_factor = 10000 "integer scaling factor (>1)"; +pin in sint iscale_factor = 10000 "integer scaling factor (>1)"; pin in real scale_in "magnitude units/count (mag = counts * scale)"; pin in real max_vel "vector max velocity magnitude"; pin in real max_accel "vector max acceleration magnitude"; @@ -48,8 +48,8 @@ pin in real accel_fraction_in = 1 "acceleration fraction input"; pin out bool enable_out "to: axis.M.jog-enable AND axis.N.jog-enable"; pin out real current_scale "effective scale (informational)"; pin out real current_scale_out "to: axis.M.jog-scale AND axis.N.jog-scale"; -pin out si32 coscounts "to: axis.M.jog-counts (cosine counts)"; -pin out si32 sincounts "to: axis.N.jog-counts (sine counts)"; +pin out sint coscounts "to: axis.M.jog-counts (cosine counts)"; +pin out sint sincounts "to: axis.N.jog-counts (sine counts)"; pin out real cos_accel_fraction "to: axis.M.jog-accel-fraction"; pin out real sin_accel_fraction "to: axis.N.jog-accel-fraction"; @@ -73,14 +73,14 @@ author "Dewey Garrett"; FUNCTION(_) { static bool once = 1; static bool wait_for_count_change = 0; -static int tot_counts; -static int old_enable_in; -static int old_counts_in; -static int ifactor = 0; +static rtapi_sint tot_counts; +static rtapi_bool old_enable_in; +static rtapi_sint old_counts_in; +static rtapi_sint ifactor = 0; double max_dv, tiny_dp, mag_err, vel_req; double mag_cmd; - int delta_counts = 0; - int newcounts; + rtapi_sint delta_counts = 0; + rtapi_sint newcounts; if (once) { current_angle_degrees_set(angle_degrees_in); @@ -147,12 +147,12 @@ static int ifactor = 0; if ( iscale_factor >= MIN_ISCALE_FACTOR && iscale_factor <= MAX_ISCALE_FACTOR) { ifactor = iscale_factor; - rtapi_print("new ifactor=%d\n",ifactor); + rtapi_print("new ifactor=%ld\n",ifactor); new_ifactor = 1; gave_msg = 0; } else { if (!gave_msg) { - rtapi_print("BOGUS iscale_factor=%d (min=%d max=%d)\n" + rtapi_print("BOGUS iscale_factor=%ld (min=%d max=%d)\n" ,ifactor,MIN_ISCALE_FACTOR,MAX_ISCALE_FACTOR); gave_msg = 1; } diff --git a/src/hal/components/axistest.comp b/src/hal/components/axistest.comp index a66f091e1e3..692b158f42c 100644 --- a/src/hal/components/axistest.comp +++ b/src/hal/components/axistest.comp @@ -5,7 +5,7 @@ pin in bool jog-plus "Drive TRUE to jog the axis in its positive direction."; pin in bool run "Drive TRUE to run the axis near its current position_fb with a trapezoidal velocity profile."; pin in real maxvel "Maximum velocity"; pin in real amplitude "Approximate amplitude of positions to command during 'run'"; -pin in si32 dir "Direction from central point to test: 0 = both, 1 = positive, 2 = negative"; +pin in sint dir "Direction from central point to test: 0 = both, 1 = positive, 2 = negative"; pin in real position-fb; pin out real position-cmd; pin out bool running; @@ -13,7 +13,7 @@ pin out real run-target; pin out real run-start; pin out real run-low; pin out real run-high; -pin in si32 pause = 0 "Pause time for each end of run in seconds"; +pin in sint pause = 0 "Pause time for each end of run in seconds"; param rw real epsilon = .001; variable double timer; param r real elapsed "Current value of the internal timer"; diff --git a/src/hal/components/bin2gray.comp b/src/hal/components/bin2gray.comp index 10c47d0c90f..527b6a28bed 100644 --- a/src/hal/components/bin2gray.comp +++ b/src/hal/components/bin2gray.comp @@ -1,11 +1,11 @@ component bin2gray "convert a number to the gray-code representation"; description """Converts a number into gray-code"""; -pin in ui32 in "binary code in"; -pin out ui32 out "gray code out"; +pin in uint in "binary code in"; +pin out uint out "gray code out"; license "GPL"; author "Andy Pugh"; option period no; function _; ;; -rtapi_u32 i = in; +rtapi_uint i = in; out_set((i >> 1) ^ i); diff --git a/src/hal/components/biquad.comp b/src/hal/components/biquad.comp index 7e42ad2eaea..936a68368a4 100644 --- a/src/hal/components/biquad.comp +++ b/src/hal/components/biquad.comp @@ -48,7 +48,7 @@ coefficients to be calculated according to the current \ pin out bool valid = 0 "When false, indicates an error occurred when calculating \ filter coefficients (require 2>**Q**>0.5 and *f0*>sampleRate/2)"; -pin in ui32 type_ = 0 "Filter type determines the type of filter \ +pin in uint type_ = 0 "Filter type determines the type of filter \ coefficients calculated. When 0, coefficients must be loaded directly \ from the *n0,n1,n2,d1* params. When 1, \ a low pass filter is created specified by the *f0,Q* pins. \ diff --git a/src/hal/components/bitmerge.comp b/src/hal/components/bitmerge.comp index 11760d35ce5..16300d31489 100644 --- a/src/hal/components/bitmerge.comp +++ b/src/hal/components/bitmerge.comp @@ -1,17 +1,17 @@ -component bitmerge "Converts individual bits into an unsigned-32"; -description """This component creates a compound unsigned-32 from individual -bit-inputs for each bit of an unsigned-32 output. The number of bits can be +component bitmerge "Converts individual bits into an unsigned-64"; +description """This component creates a compound unsigned-64 from individual +bit-inputs for each bit of an unsigned-64 output. The number of bits can be limited by the "personality" modparam. The inverse process can be performed by the bitslice HAL component."""; -pin out ui32 out "The output value"; -pin in bool in-##[32:personality]; +pin out uint out "The output value"; +pin in bool in-##[64:personality]; author "Andy Pugh"; license "GPL2+"; function _; option personality yes; option period no; ;; -rtapi_u32 v = 0; +rtapi_uint v = 0; for (int i = personality; i > 0;) { v <<= 1; if (in(--i)) diff --git a/src/hal/components/bitslice.comp b/src/hal/components/bitslice.comp index 11c440aae43..a213a129a82 100644 --- a/src/hal/components/bitslice.comp +++ b/src/hal/components/bitslice.comp @@ -1,17 +1,17 @@ -component bitslice "Converts an unsigned-32 input into individual bits"; +component bitslice "Converts an unsigned-64 input into individual bits"; description """This component creates individual bit-outputs for each bit of an -unsigned-32 input. The number of bits can be limited by the "personality" +unsigned-64 input. The number of bits can be limited by the "personality" modparam. The inverse process can be performed by the bitmerge HAL component."""; -pin in ui32 in "The input value"; -pin out bool out-##[32:personality]; +pin in uint in "The input value"; +pin out bool out-##[64:personality]; author "Andy Pugh"; license "GPL2+"; function _; option personality yes; option period no; ;; -rtapi_u32 v = in; +rtapi_uint v = in; for (int i = 0; i < personality; i++) { out_set(i, v & 1); v >>= 1; diff --git a/src/hal/components/bitwise.comp b/src/hal/components/bitwise.comp index 38a0b6791be..55df2f0f77e 100644 --- a/src/hal/components/bitwise.comp +++ b/src/hal/components/bitwise.comp @@ -1,12 +1,12 @@ component bitwise "Computes various bitwise operations on the two input values"; -pin in ui32 in0 "First input value"; -pin in ui32 in1 "Second input value"; -pin out ui32 out-and "The bitwise AND of the two inputs"; -pin out ui32 out-or "The bitwise OR of the two inputs"; -pin out ui32 out-xor "The bitwise XOR of the two inputs"; -pin out ui32 out-nand "The inverse of the bitwise AND"; -pin out ui32 out-nor "The inverse of the bitwise OR"; -pin out ui32 out-xnor "The inverse of the bitwise XOR"; +pin in uint in0 "First input value"; +pin in uint in1 "Second input value"; +pin out uint out-and "The bitwise AND of the two inputs"; +pin out uint out-or "The bitwise OR of the two inputs"; +pin out uint out-xor "The bitwise XOR of the two inputs"; +pin out uint out-nand "The inverse of the bitwise AND"; +pin out uint out-nor "The inverse of the bitwise OR"; +pin out uint out-xnor "The inverse of the bitwise XOR"; author "Andy Pugh"; license "GPL 2+"; @@ -14,8 +14,8 @@ function _; option period no; ;; -rtapi_u32 i0 = in0; -rtapi_u32 i1 = in1; +rtapi_uint i0 = in0; +rtapi_uint i1 = in1; out_nand_set(~out_and_set(i0 & i1)); out_nor_set( ~out_or_set( i0 | i1)); out_xnor_set(~out_xor_set(i0 ^ i1)); diff --git a/src/hal/components/bldc.comp b/src/hal/components/bldc.comp index 438b330f9a1..0955c545332 100644 --- a/src/hal/components/bldc.comp +++ b/src/hal/components/bldc.comp @@ -25,7 +25,7 @@ pin in real frequency if (personality & 0x0F)==0 """Frequency input for motors w pin in real initvalue = 0.2 if personality & 0x04 """The current to be used for the homing sequence in applications where an incremental encoder is used with no hall-sensor feedback"""; -pin in si32 rawcounts = 0 if personality & 0x06 +pin in sint rawcounts = 0 if personality & 0x06 """Encoder counts input. This must be linked to the encoder rawcounts pin or encoder index resets will cause the motor commutation to fail."""; pin io bool index-enable if personality & 0x08 """This pin should be connected to the associated encoder index-enable pin to zero the encoder when it passes index. @@ -91,28 +91,28 @@ pin out bool out-dir pin out real out-abs "Absolute value of the input value"; -param r si32 in_type = -1 "state machine output, will probably hide after debug"; -param r si32 out_type = -1 "state machine output, will probably hide after debug"; +param r sint in_type = -1 "state machine output, will probably hide after debug"; +param r sint out_type = -1 "state machine output, will probably hide after debug"; -param rw si32 scale = 512 if personality & 0x06 +param rw sint scale = 512 if personality & 0x06 "The number of encoder counts per rotor revolution."; -param rw si32 poles = 4 if personality & 0x06 +param rw sint poles = 4 if personality & 0x06 """The number of motor poles. The encoder scale will be divided by this value to determine the number of encoder counts per electrical revolution."""; -param rw si32 encoder-offset = 0 if personality & 0x0A +param rw sint encoder-offset = 0 if personality & 0x0A """The offset, in encoder counts, between the motor electrical zero and the encoder zero modulo the number of counts per electrical revolution"""; -param r si32 offset_measured = 0 if personality & 0x04 +param r sint offset_measured = 0 if personality & 0x04 """The encoder offset measured by the homing sequence (in certain modes)"""; param rw real drive-offset = 0 """The angle, in degrees, applied to the commanded angle by the drive in degrees. This value is only used during the homing sequence of drives with incremental encoder feedback. It is used to back-calculate from commanded angle to actual phase angle. It is only relevant to drives which expect rotor-angle input rather than phase-angle demand. Should be 0 for most drives."""; -param rw ui32 output-pattern=25 if personality & 0x400 +param rw uint output-pattern=25 if personality & 0x400 """Commutation pattern to be output in Hall Signal translation mode. See the description of *pattern* for details."""; -param rw ui32 pattern=25 if personality & 0x01 +param rw uint pattern=25 if personality & 0x01 """Commutation pattern to use, from 0 to 47. Default is type 25. Every plausible combination is included. The table below shows the excitation pattern along the top, and the pattern code on the left hand side. @@ -289,11 +289,11 @@ option count_function yes; variable int old_init = 0; variable char old_ph = 000; -variable int old_pattern = -1; +variable rtapi_sint old_pattern = -1; variable double counter = 0; -variable rtapi_s64 long_rawcounts = 0; -variable rtapi_s64 old_long_rawcounts = 0; -variable rtapi_s32 old_rawcounts = 0; +variable rtapi_sint long_rawcounts = 0; +variable rtapi_sint old_long_rawcounts = 0; +variable rtapi_sint old_rawcounts = 0; variable int force_trap = 0; ;; @@ -398,6 +398,9 @@ FUNCTION(_) { if (personality & 0x06) { // Handle s32 rollover of rawcounts + // No longer necessary locally since all here are 64-bit. But we leave + // the calculation for now because the upstream connection may not be + // fixed yet. old_long_rawcounts = long_rawcounts; long_rawcounts += (rawcounts-old_rawcounts); old_rawcounts = rawcounts; @@ -431,7 +434,7 @@ FUNCTION(_) { if (pattern > 47){ rtapi_print_msg(RTAPI_MSG_ERR, "Only `Hall patterns 0-47 are allowed, you have" - " requested pattern %i\n", pattern); + " requested pattern %ld\n", pattern); pattern_set(0); return; } @@ -455,7 +458,7 @@ FUNCTION(_) { phase_angle_set(phase_angle - floor(phase_angle)); if (! (ph & old_ph)){ hall_error_set(1);} - if (pattern != (unsigned)old_pattern){hall_error_set(0);} + if (pattern != (rtapi_uint)old_pattern){hall_error_set(0);} if (force_trap) break; @@ -624,7 +627,7 @@ FUNCTION(_) { in_type_set(0x02); return; default: - rtapi_print_msg(RTAPI_MSG_ERR, "Unknown input type pattern (%X) in " + rtapi_print_msg(RTAPI_MSG_ERR, "Unknown input type pattern (%lX) in " "bldc\n", in_type); in_type_set(-2); return; @@ -781,7 +784,7 @@ FUNCTION(_) { out_type_set(0x400); return; default: - rtapi_print_msg(RTAPI_MSG_ERR, "Unsupported output type (%X) in bldc" + rtapi_print_msg(RTAPI_MSG_ERR, "Unsupported output type (%lX) in bldc" , out_type); in_type_set(-2); return; diff --git a/src/hal/components/boss_plc.c b/src/hal/components/boss_plc.c index 8b1016320b9..7098b9eb486 100644 --- a/src/hal/components/boss_plc.c +++ b/src/hal/components/boss_plc.c @@ -489,7 +489,7 @@ Plc_Export(Plc *this, int compId, int id) // Export functions. if(!error){ - error = hal_export_functf(Plc_Refresh, this, 1, 0, compId, "boss_plc.%d.refresh", id); + error = hal_export_functf(Plc_Refresh, this, 0, compId, "boss_plc.%d.refresh", id); } // Restore saved message level. diff --git a/src/hal/components/carousel.comp b/src/hal/components/carousel.comp index 354605f1d1f..5b8998dd8b3 100644 --- a/src/hal/components/carousel.comp +++ b/src/hal/components/carousel.comp @@ -101,7 +101,7 @@ at the completion of the tool search and at the same time the reverse duty/cycle velocity value will be sent to the motor-vel pin. """; -pin in si32 pocket-number """The pocket to move to when the .enable pin goes high. If the value +pin in sint pocket-number """The pocket to move to when the .enable pin goes high. If the value passed is higher than the number of pockets specified in the "pockets" modparam then modulo arithmetic is used. This is intended to allow the use of multiple tools in the same holder, as is sometimes useful with lathes."""; @@ -122,10 +122,10 @@ pin in real hold-dc "Duty cycle when carousel is in-position (to hold against s pin in real align-dc """Use this pin to set the speed of a slower alignment move once the changer is in position. Such a system almost certainly needs decel-time setting too"""; pin in real decel-time "Time to wait for carousel to stop before final alignment and position check"; -pin in si32 counts "Connect to the rawcounts of an encoder or a stepgen in 'counts' mode"; -pin in si32 scale = 100 "The number of stepgen or encoder counts between successive pockets"; -pin in si32 width = 10 "How far each side of the exact scale to signal a new pocket"; -pin in si32 home-offset = 0 "The offset (in counts) between the index and pocket 1"; +pin in sint counts "Connect to the rawcounts of an encoder or a stepgen in 'counts' mode"; +pin in sint scale = 100 "The number of stepgen or encoder counts between successive pockets"; +pin in sint width = 10 "How far each side of the exact scale to signal a new pocket"; +pin in sint home-offset = 0 "The offset (in counts) between the index and pocket 1"; pin io bool index-enable "Used to home to an encoder index"; pin in bool jog-fwd "Jog the carousel forwards one tool position"; pin in bool jog-rev """Jog the carousel in reverse (only if dir = 2). @@ -134,19 +134,19 @@ also be interlocked to only operate when the machine is idle."""; pin out bool motor-fwd "Indicates the motor should run forwards (bigger numbers)"; pin out bool motor-rev "Indicates the motor should run reverse."; pin out bool parity-error "Indicates a parity error"; -pin out si32 current-position "This pin indicates the current position feedback"; +pin out sint current-position "This pin indicates the current position feedback"; pin out real motor-vel "The duty-cycle or velocity to drive a DC motor or stepgen"; pin out bool homed = 0 "Shows that homing is complete. Only used in index and edge modes"; pin in bool unhome = 0 "Should only really be necessary for testing"; pin out real counts-target "Target position for a stepgen or external PID controller"; -param r si32 state = 0 "Current component state"; +param r sint state = 0 "Current component state"; param r bool homing = 0 "Shows that homing is in progress. Only used for index mode"; param r real timer "Shows the value of the internal timer"; -param r si32 motor-dir "Internal tag for search direction"; -param r si32 counts-offset "Internal offset of index pin"; -param rw ui32 debounce "How many thread cycles to wait for the position to stabilise"; -param r si32 target "Current target pocket, debug"; +param r sint motor-dir "Internal tag for search direction"; +param r sint counts-offset "Internal offset of index pin"; +param rw uint debounce "How many thread cycles to wait for the position to stabilise"; +param r sint target "Current target pocket, debug"; option count_function; option extra_setup; @@ -160,7 +160,7 @@ variable int inst_pockets; variable int inst_code; variable int inst_parity; variable int old_index = 0; -param r si32 base_counts = 0; +param r sint base_counts = 0; variable int old_unhome = 0; function _ ; @@ -194,11 +194,11 @@ RTAPI_MP_ARRAY_INT(parity, MAX_CHAN, "0 for even parity, 1 for odd") FUNCTION(_){ int i, d, pow; - static int deb = 0; + static rtapi_sint deb = 0; int pcalc = 0; - int mod_pocket = 0; - int new_pos = 0; - unsigned int mask; + rtapi_sint mod_pocket = 0; + rtapi_sint new_pos = 0; + rtapi_uint mask; int align_pin = 0; // used for slow align move, input depends on mode for historical reasons switch inst_code{ @@ -279,11 +279,11 @@ FUNCTION(_){ case 'C': // encoder or stepgen counts. new_pos = current_position; if (homed){ - int c; - int t; - int w = width / 2; + rtapi_sint c; + rtapi_sint t; + rtapi_sint w = width / 2; c = (counts - base_counts); - t = floor(((float)c + w) / scale); + t = floor(((rtapi_real)c + w) / scale); if (c >= (t * scale - w) && c <= (t * scale + w)) { new_pos = 1 + (t % inst_pockets); // C modulus of negative numbers is inconvenient diff --git a/src/hal/components/comp.comp b/src/hal/components/comp.comp index cf27ca469e0..8365df255fb 100644 --- a/src/hal/components/comp.comp +++ b/src/hal/components/comp.comp @@ -16,6 +16,7 @@ option period no; function _ "Update the comparator"; license "GPL"; author "Jeff Epler"; +see_also "conv_real_bool(9)."; ;; FUNCTION(_) { rtapi_real tmp = in1 - in0; diff --git a/src/hal/components/conv_real_bool.comp b/src/hal/components/conv_real_bool.comp new file mode 100644 index 00000000000..a00ee0d2dd7 --- /dev/null +++ b/src/hal/components/conv_real_bool.comp @@ -0,0 +1,23 @@ +component conv_real_bool """Convert a value from real to bool + +The output value `out` is False when `in` is within `±eps` of zero. +The `out` pin is set to True once the `in` value reaches beyond. + +* `in` < `-eps` -> `out` = True +* `in` > `+eps` -> `out` = True +* `-eps` ≤ `in` ≤ `+eps` -> `out` = False + +In effect: `out = |in| > |eps|` + +"""; +pin in real in "Input value to convert."; +pin out bool out "Output value is False when input is within ±eps."; +param rw real eps = 1e-8 "Epsilon value to determine the input to be zero."; +option period no; +function _ "Update 'out' based on 'in' to be within 'eps' or not."; +license "GPL"; +author "LinuxCNC authors"; +see_also "comp(9)."; +include ; +;; +out_set(fabs(in) > fabs(eps)); diff --git a/src/hal/components/counter.c b/src/hal/components/counter.c index d279c88db33..829d1412b89 100644 --- a/src/hal/components/counter.c +++ b/src/hal/components/counter.c @@ -147,7 +147,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("counter.update-counters", update, - counter_array, 0, 0, comp_id); + counter_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "COUNTER: ERROR: count funct export failed\n"); @@ -155,7 +155,7 @@ int rtapi_app_main(void) return -EIO; } retval = hal_export_funct("counter.capture-position", capture, - counter_array, 1, 0, comp_id); + counter_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "COUNTER: ERROR: capture funct export failed\n"); diff --git a/src/hal/components/dbounce.comp b/src/hal/components/dbounce.comp index f45355afe58..d517deacf7d 100644 --- a/src/hal/components/dbounce.comp +++ b/src/hal/components/dbounce.comp @@ -7,9 +7,9 @@ delay pins for each instance and supports *count*= or *names*= parameters pin in bool in; pin out bool out; -pin in ui32 delay = 5; +pin in uint delay = 5; -variable unsigned state; +variable rtapi_uint state; option period no; function _; license "GPL"; diff --git a/src/hal/components/debounce.c b/src/hal/components/debounce.c index 57846146861..b8fe3d0ca4f 100644 --- a/src/hal/components/debounce.c +++ b/src/hal/components/debounce.c @@ -263,7 +263,7 @@ static int export_group(int num, debounce_group_t * addr, int group_size) return retval; } /* export function */ - retval = hal_export_functf(debounce, addr, 0, 0, comp_id, "debounce.%d", num); + retval = hal_export_functf(debounce, addr, 0, comp_id, "debounce.%d", num); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "DEBOUNCE: ERROR: 'debounce.%d' funct export failed\n", num); return -1; diff --git a/src/hal/components/demux.comp b/src/hal/components/demux.comp index 7d4c8d19067..47cbd6b2f31 100644 --- a/src/hal/components/demux.comp +++ b/src/hal/components/demux.comp @@ -11,7 +11,7 @@ parameter to true, in this case all bits up to the selected bit will be set, as might be required for an LED bargraph display."""; pin in bool sel-bit-## [5] "Binary-number bit selectors"; -pin in ui32 sel-u32 "Integer selection input"; +pin in uint sel-uint "Integer selection input"; pin out bool out-## [32:personality] "The set of output bits"; option default_personality 32; @@ -29,7 +29,7 @@ function _; FUNCTION(_){ int i, bit; - bit = sel_u32 + sel_bit(0) + (sel_bit(1) << 1) + (sel_bit(2) << 2) + bit = sel_uint + sel_bit(0) + (sel_bit(1) << 1) + (sel_bit(2) << 2) + (sel_bit(3) << 3) + (sel_bit(4) << 4); if (bit >= personality) bit = personality - 1; rtapi_bool bg = bargraph; diff --git a/src/hal/components/demux_generic.c b/src/hal/components/demux_generic.c index 7ce13958b44..1f400a1537c 100644 --- a/src/hal/components/demux_generic.c +++ b/src/hal/components/demux_generic.c @@ -62,8 +62,8 @@ RTAPI_MP_ARRAY_STRING(config, MAX_CHAN, "demux specifiers inNUMout"); int rtapi_app_main(void){ int retval; int i, f; - char hal_name[HAL_NAME_LEN]; - char *types[5] = {"invalid", "bit", "float", "s32", "u32"}; + char hal_name[HAL_NAME_LEN+1]; + static const char *types[HAL_TYPE_MAX] = {"invalid", "bool", "real", "sint", "uint", "port"}; if (!config[0]) { rtapi_print_msg(RTAPI_MSG_ERR, "The demux_generic component requires at least" " one valid format string\n"); @@ -122,11 +122,11 @@ int rtapi_app_main(void){ break; case 's': case 'S': - type = HAL_S32; + type = HAL_SINT; break; case 'u': case 'U': - type = HAL_U32; + type = HAL_UINT; break; default: rtapi_print_msg(RTAPI_MSG_ERR, "demux_generic: invalid character in " @@ -168,7 +168,7 @@ int rtapi_app_main(void){ // We did away with the no-fp thread. // Always export the float case. It can do any-to-any. - retval = hal_export_functf(write_fp, inst, 1, 0, comp_id, "demux-gen.%02i", i); + retval = hal_export_functf(write_fp, inst, 0, comp_id, "demux-gen.%02i", i); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "demux_generic: ERROR: function export" " failed\n"); @@ -198,17 +198,14 @@ int rtapi_app_main(void){ goto fail0; } - retval = rtapi_snprintf(hal_name, HAL_NAME_LEN, - "demux-gen.%02i.in-%s", i, types[inst->in_type]); - if (retval >= HAL_NAME_LEN) { + retval = rtapi_snprintf(hal_name, sizeof(hal_name), + "demux-gen.%02i.in-%s", i, types[inst->in_type]); + if (retval > HAL_NAME_LEN) { goto fail0; } switch(inst->in_type) { case HAL_BOOL: retval = hal_pin_new_bool(comp_id, HAL_IN, &inst->input.b, 0, "%s", hal_name); break; case HAL_REAL: retval = hal_pin_new_real(comp_id, HAL_IN, &inst->input.r, 0, "%s", hal_name); break; - case HAL_S32: retval = hal_pin_new_si32(comp_id, HAL_IN, &inst->input.s, 0, "%s", hal_name); break; - case HAL_U32: retval = hal_pin_new_ui32(comp_id, HAL_IN, &inst->input.u, 0, "%s", hal_name); break; - // FIXME: Future...when we switch types case HAL_SINT: retval = hal_pin_new_sint(comp_id, HAL_IN, &inst->input.s, 0, "%s", hal_name); break; case HAL_UINT: retval = hal_pin_new_uint(comp_id, HAL_IN, &inst->input.u, 0, "%s", hal_name); break; default: retval = -ENOENT; break; @@ -242,17 +239,14 @@ int rtapi_app_main(void){ //output pins inst->outputs = hal_malloc(inst->size * sizeof(*inst->outputs)); for (p = 0; p < inst->size; p++) { - retval = rtapi_snprintf(hal_name, HAL_NAME_LEN, - "demux-gen.%02i.out-%s-%02i", i, types[inst->out_type], p); - if (retval >= HAL_NAME_LEN) { + retval = rtapi_snprintf(hal_name, sizeof(hal_name), + "demux-gen.%02i.out-%s-%02i", i, types[inst->out_type], p); + if (retval > HAL_NAME_LEN) { goto fail0; } switch(inst->out_type) { case HAL_BOOL: retval = hal_pin_new_bool(comp_id, HAL_OUT, &inst->outputs[p].b, 0, "%s", hal_name); break; case HAL_REAL: retval = hal_pin_new_real(comp_id, HAL_OUT, &inst->outputs[p].r, 0, "%s", hal_name); break; - case HAL_S32: retval = hal_pin_new_si32(comp_id, HAL_OUT, &inst->outputs[p].s, 0, "%s", hal_name); break; - case HAL_U32: retval = hal_pin_new_ui32(comp_id, HAL_OUT, &inst->outputs[p].u, 0, "%s", hal_name); break; - // FIXME: Future...when we switch types case HAL_SINT: retval = hal_pin_new_sint(comp_id, HAL_OUT, &inst->outputs[p].s, 0, "%s", hal_name); break; case HAL_UINT: retval = hal_pin_new_uint(comp_id, HAL_OUT, &inst->outputs[p].u, 0, "%s", hal_name); break; default: retval = -ENOENT; break; @@ -261,7 +255,6 @@ int rtapi_app_main(void){ goto fail0; } } - } hal_ready(comp_id); @@ -307,15 +300,15 @@ void write_fp(void *arg, long period) { case FT(HAL_BOOL, HAL_BOOL): hal_set_bool(inst->outputs[s].b, hal_get_bool(inst->input.b)); break; - case FT(HAL_BOOL, HAL_S32): - hal_set_si32(inst->outputs[s].s, hal_get_bool(inst->input.b)); - break; - case FT(HAL_BOOL, HAL_U32): - hal_set_ui32(inst->outputs[s].u, hal_get_bool(inst->input.b)); - break; case FT(HAL_BOOL, HAL_REAL): hal_set_real(inst->outputs[s].r, hal_get_bool(inst->input.b) ? 1.0 : 0.0); break; + case FT(HAL_BOOL, HAL_SINT): + hal_set_sint(inst->outputs[s].s, hal_get_bool(inst->input.b)); + break; + case FT(HAL_BOOL, HAL_UINT): + hal_set_uint(inst->outputs[s].u, hal_get_bool(inst->input.b)); + break; case FT(HAL_REAL, HAL_BOOL): hal_set_bool(inst->outputs[s].b, fabs(hal_get_real(inst->input.r)) > EPS); @@ -323,53 +316,53 @@ void write_fp(void *arg, long period) { case FT(HAL_REAL, HAL_REAL): hal_set_real(inst->outputs[s].r, hal_get_real(inst->input.r)); break; - case FT(HAL_REAL, HAL_S32): { + case FT(HAL_REAL, HAL_SINT): { rtapi_real v = hal_get_real(inst->input.r); - if (v > RTAPI_INT32_MAX) { - hal_set_si32(inst->outputs[s].s, RTAPI_INT32_MAX); - } else if (v < RTAPI_INT32_MIN) { - hal_set_si32(inst->outputs[s].s, RTAPI_INT32_MIN); + if (v > (rtapi_real)RTAPI_SINT_MAX) { + hal_set_sint(inst->outputs[s].s, RTAPI_SINT_MAX); + } else if (v < (rtapi_real)RTAPI_SINT_MIN) { + hal_set_sint(inst->outputs[s].s, RTAPI_SINT_MIN); } else { - hal_set_si32(inst->outputs[s].s, v); + hal_set_sint(inst->outputs[s].s, v); } break; } - case FT(HAL_REAL, HAL_U32): { + case FT(HAL_REAL, HAL_UINT): { rtapi_real v = hal_get_real(inst->input.r); - if (v > RTAPI_UINT32_MAX) { - hal_set_ui32(inst->outputs[s].u, RTAPI_UINT32_MAX); - } else if (v < 0) { - hal_set_ui32(inst->outputs[s].u, 0); + if (v > (rtapi_real)RTAPI_UINT_MAX) { + hal_set_uint(inst->outputs[s].u, RTAPI_UINT_MAX); + } else if (v < 0.0) { + hal_set_uint(inst->outputs[s].u, 0); } else { - hal_set_ui32(inst->outputs[s].u, v); + hal_set_uint(inst->outputs[s].u, v); } break; } - case FT(HAL_S32, HAL_BOOL): - hal_set_bool(inst->outputs[s].b, hal_get_si32(inst->input.s) != 0); + case FT(HAL_SINT, HAL_BOOL): + hal_set_bool(inst->outputs[s].b, hal_get_sint(inst->input.s) != 0); break; - case FT(HAL_S32, HAL_S32): - hal_set_si32(inst->outputs[s].s, hal_get_si32(inst->input.s)); + case FT(HAL_SINT, HAL_REAL): + hal_set_real(inst->outputs[s].r, hal_get_sint(inst->input.s)); break; - case FT(HAL_S32, HAL_U32): { - rtapi_s32 v = hal_get_si32(inst->input.s); - hal_set_ui32(inst->outputs[s].u, v > 0 ? v : 0); - break; } - case FT(HAL_S32, HAL_REAL): - hal_set_real(inst->outputs[s].r, hal_get_si32(inst->input.s)); + case FT(HAL_SINT, HAL_SINT): + hal_set_sint(inst->outputs[s].s, hal_get_sint(inst->input.s)); break; + case FT(HAL_SINT, HAL_UINT): { + rtapi_sint v = hal_get_sint(inst->input.s); + hal_set_uint(inst->outputs[s].u, v > 0 ? v : 0); + break; } - case FT(HAL_U32, HAL_BIT): - hal_set_bool(inst->outputs[s].b, hal_get_ui32(inst->input.u) != 0); + case FT(HAL_UINT, HAL_BOOL): + hal_set_bool(inst->outputs[s].b, hal_get_uint(inst->input.u) != 0); break; - case FT(HAL_U32, HAL_S32): { - rtapi_u32 v = hal_get_ui32(inst->input.u); - hal_set_si32(inst->outputs[s].s, v > (rtapi_u32)RTAPI_INT32_MAX ? RTAPI_INT32_MAX : (rtapi_s32)v); - break; } - case FT(HAL_U32, HAL_U32): - hal_set_ui32(inst->outputs[s].u, hal_get_ui32(inst->input.u)); + case FT(HAL_UINT, HAL_REAL): + hal_set_real(inst->outputs[s].r, hal_get_uint(inst->input.u)); break; - case FT(HAL_U32, HAL_REAL): - hal_set_real(inst->outputs[s].r, hal_get_ui32(inst->input.u)); + case FT(HAL_UINT, HAL_SINT): { + rtapi_uint v = hal_get_uint(inst->input.u); + hal_set_sint(inst->outputs[s].s, v > RTAPI_SINT_MAX ? RTAPI_SINT_MAX : v); + break; } + case FT(HAL_UINT, HAL_UINT): + hal_set_uint(inst->outputs[s].u, hal_get_uint(inst->input.u)); break; } } diff --git a/src/hal/components/edge.comp b/src/hal/components/edge.comp index 42656188be9..a2ee2156d33 100644 --- a/src/hal/components/edge.comp +++ b/src/hal/components/edge.comp @@ -22,9 +22,9 @@ pin out bool out_invert "Goes low when the desired edge is seen on 'in'"; param rw bool both=FALSE "If TRUE, selects both edges. Otherwise, selects one edge according to in-edge"; param rw bool in_edge=TRUE "If both is FALSE, selects the one desired edge: TRUE means falling, FALSE means rising"; -param rw si32 out_width_ns=0 "Time in nanoseconds of the output pulse"; +param rw sint out_width_ns=0 "Time in nanoseconds of the output pulse"; -param r si32 time_left_ns "Time left in this output pulse"; +param r sint time_left_ns "Time left in this output pulse"; param r bool last_in "Previous input value"; variable int first = 1; @@ -34,15 +34,15 @@ author "Jeff Epler"; ;; FUNCTION(_){ - int new_in = in; - rtapi_s32 tlns = time_left_ns; + rtapi_bool new_in = in; + rtapi_sint tlns = time_left_ns; if (tlns > 0) { time_left_ns_set(tlns -= period); } if ( !first ) { - int rise = new_in && !last_in; - int fall = !new_in && last_in; - int desired_edge = + rtapi_bool rise = new_in && !last_in; + rtapi_bool fall = !new_in && last_in; + rtapi_bool desired_edge = both ? rise || fall : in_edge ? fall : rise; if(desired_edge) { diff --git a/src/hal/components/encoder.c b/src/hal/components/encoder.c index 1faf2948cf1..6cb08cf12c5 100644 --- a/src/hal/components/encoder.c +++ b/src/hal/components/encoder.c @@ -291,7 +291,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("encoder.update-counters", update, - counter_array, 0, 0, comp_id); + counter_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "ENCODER: ERROR: count funct export failed\n"); @@ -299,7 +299,7 @@ int rtapi_app_main(void) return -1; } retval = hal_export_funct("encoder.capture-position", capture, - counter_array, 1, 0, comp_id); + counter_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "ENCODER: ERROR: capture funct export failed\n"); diff --git a/src/hal/components/encoder_ratio.c b/src/hal/components/encoder_ratio.c index 3adf5c0ce07..6e2b65b7bca 100644 --- a/src/hal/components/encoder_ratio.c +++ b/src/hal/components/encoder_ratio.c @@ -244,7 +244,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("encoder-ratio.sample", sample, - encoder_pair_array, 0, 0, comp_id); + encoder_pair_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "ENCODER_RATIO: ERROR: sample funct export failed\n"); @@ -252,7 +252,7 @@ int rtapi_app_main(void) return -1; } retval = hal_export_funct("encoder-ratio.update", update, - encoder_pair_array, 1, 0, comp_id); + encoder_pair_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "ENCODER_RATIO: ERROR: update funct export failed\n"); diff --git a/src/hal/components/enum.c b/src/hal/components/enum.c index e6ecf728779..9be916f291a 100644 --- a/src/hal/components/enum.c +++ b/src/hal/components/enum.c @@ -30,7 +30,7 @@ /* module information */ MODULE_AUTHOR("Andy Pugh"); -MODULE_DESCRIPTION("convert enumerated types to HAL_BIT pins"); +MODULE_DESCRIPTION("convert enumerated types to HAL_BOOL pins"); MODULE_LICENSE("GPL"); #define MAX_CHAN 256 @@ -137,10 +137,10 @@ int rtapi_app_main(void){ // create single per-instance int pin in index 0 if (inst->dir == HAL_OUT) { - retval = hal_pin_new_ui32(comp_id, HAL_IN, &(inst->hal[0].en), 0, + retval = hal_pin_new_uint(comp_id, HAL_IN, &(inst->hal[0].en), 0, "%s.input", this); } else { - retval = hal_pin_new_ui32(comp_id, HAL_OUT, &(inst->hal[0].en), 0, + retval = hal_pin_new_uint(comp_id, HAL_OUT, &(inst->hal[0].en), 0, "%s.output", this); } v = 0; @@ -153,7 +153,7 @@ int rtapi_app_main(void){ retval = hal_pin_new_bool(comp_id, inst->dir, &(inst->hal[j].bit), 0, "%s.%s-%s",this, token, (inst->dir == HAL_IN)?"in":"out"); - retval += hal_pin_new_ui32(comp_id, HAL_IN, &(inst->hal[j].en), + retval += hal_pin_new_uint(comp_id, HAL_IN, &(inst->hal[j].en), v++, "%s.%s-val",this, token); if (retval < 0){ @@ -162,9 +162,9 @@ int rtapi_app_main(void){ } } if (inst->dir == HAL_OUT){ - hal_export_funct(this, decode, inst, 0, 0, comp_id); + hal_export_funct(this, decode, inst, 0, comp_id); } else { - hal_export_funct(this, encode, inst, 0, 0, comp_id); + hal_export_funct(this, encode, inst, 0, comp_id); } if (retval < 0){ rtapi_print_msg(RTAPI_MSG_ERR, "Failed to export functions\n"); @@ -190,7 +190,7 @@ static void decode(void *v_inst, long period){ int i; enum_inst_t *inst = v_inst; for (i = 1; i <= inst->num_pins; i++){ - if (hal_get_ui32(inst->hal[0].en) == hal_get_ui32(inst->hal[i].en)){ + if (hal_get_uint(inst->hal[0].en) == hal_get_uint(inst->hal[i].en)){ hal_set_bool(inst->hal[i].bit, 1); } else { hal_set_bool(inst->hal[i].bit, 0); @@ -201,10 +201,10 @@ static void encode(void *v_inst, long period){ (void)period; int i; enum_inst_t *inst = v_inst; - hal_set_ui32(inst->hal[0].en, 0); + hal_set_uint(inst->hal[0].en, 0); for (i = 1; i <= inst->num_pins; i++){ if (hal_get_bool(inst->hal[i].bit)){ - hal_set_ui32(inst->hal[0].en, hal_get_ui32(inst->hal[i].en)); + hal_set_uint(inst->hal[0].en, hal_get_uint(inst->hal[i].en)); } } } diff --git a/src/hal/components/eoffset_per_angle.comp b/src/hal/components/eoffset_per_angle.comp index aa0922c148b..85b302955e0 100644 --- a/src/hal/components/eoffset_per_angle.comp +++ b/src/hal/components/eoffset_per_angle.comp @@ -6,9 +6,9 @@ description An offset is computed (from one of several functions) based on an input angle in degrees. The angle could be a rotary coordinate value or a spindle angle. -The computed offset is represented as an s32 *kcounts* output pin that is a +The computed offset is represented as an integer *kcounts* output pin that is a compatible input to external offset pins like *axis.L.eoffset-counts* where *L* -is the coordinate letter. Scaling of the s32 *kcounts* is controlled by the +is the coordinate letter. Scaling of the integer *kcounts* is controlled by the input (*k*) -- its reciprocal value is presented on an output pin *kreciprocal* for connection to *axis.L.eoffset-scale*. The default value for *k* should be suitable for most uses. @@ -68,20 +68,20 @@ pin in bool enable_in = 0 "Enable Input"; pin in real radius_ref = 1 "Radius reference (see notes)"; pin in real angle = 0 "Input angle (in degrees)"; pin in real start_angle = 0 "Start angle (in degrees)"; -pin in si32 fnum = 0 "Function selector (default 0)"; +pin in sint fnum = 0 "Function selector (default 0)"; pin in real rfraction = 0.1 "Offset amplitude (+/- fraction of radius_ref)"; pin in real fmult = 6 "Offset frequency multiplier"; -pin in ui32 k = 10000 "Scaling Factor (if 0, use 10000)"; +pin in uint k = 10000 "Scaling Factor (if 0, use 10000)"; pin out bool is_off "invert is_on (for convenience)"; pin out bool enable_out "To: axis.L.eoffset-enable"; pin out bool clear "To: axis.L.eoffset-clear"; -pin out si32 kcounts "To: axis.L.eoffset-counts"; +pin out sint kcounts "To: axis.L.eoffset-counts"; pin out real kreciprocal "To: axis.L.eoffset-scale (1/k)"; pin out real eoffset_dbg "offset (debug pin--use kcounts & kreciprocal)"; -pin out ui32 state_dbg "state (debug pin)"; +pin out uint state_dbg "state (debug pin)"; //--------------------------------------------------------------------- // per-instance items: @@ -147,13 +147,13 @@ FUNCTION(_) { struct ofunc_data* dptr = &data; #define STATE dptr->thestate - int kfactor; + rtapi_uint kfactor; ofunc* thefunc; run_ct++; state_dbg_set(STATE); kfactor = k; - if (k == 0) {kfactor = 10000;} + if (kfactor == 0) {kfactor = 10000;} kreciprocal_set(1/((rtapi_real)kfactor)); is_off_set(!is_on); // convenience pin @@ -272,7 +272,7 @@ FUNCTION(_) { eoffset_dbg_set(0); STATE = STOPPING; rtapi_print_msg(RTAPI_MSG_ERR, - "eoffset_per_angle stopping:func%d problem\n",fnum); + "eoffset_per_angle stopping:func%ld problem\n",fnum); return; } diff --git a/src/hal/components/gray2bin.comp b/src/hal/components/gray2bin.comp index f5590fa02cb..c2562cc193d 100644 --- a/src/hal/components/gray2bin.comp +++ b/src/hal/components/gray2bin.comp @@ -1,14 +1,14 @@ component gray2bin "convert a gray-code input to binary"; description """Converts a gray-coded number into the corresponding binary value"""; -pin in ui32 in "gray code in"; -pin out ui32 out "binary code out"; +pin in uint in "gray code in"; +pin out uint out "binary code out"; license "GPL"; author "Andy Pugh"; function _; option period no; ;; -rtapi_u32 mask; -rtapi_u32 val = in; +rtapi_uint mask; +rtapi_uint val = in; for(mask = val >> 1 ; mask != 0 ; mask = mask >> 1){ val ^= mask; } diff --git a/src/hal/components/histobins.comp b/src/hal/components/histobins.comp index 2163467490b..5f9ec2478b8 100644 --- a/src/hal/components/histobins.comp +++ b/src/hal/components/histobins.comp @@ -26,9 +26,9 @@ The input used is selected based on pintype: ^h|inputpin |0|input -|1|input-s32 -|2|input-u32 -|3|input-bit +|1|input-sint +|2|input-uint +|3|input-bool |=== Additional output statistics pins: @@ -44,18 +44,18 @@ The method input pin selects an alternate variance calculation. Maintainers note: hardcoded for MAXBINNUMBER==200 """; //" To make vim happy in syntax=c mode -pin in ui32 pintype; +pin in uint pintype; pin in real input; -pin in si32 input_s32; -pin in ui32 input_u32; -pin in bool input_bit; +pin in sint input_sint; +pin in uint input_uint; +pin in bool input_bool; -pin in ui32 nbins = 20; // must be < MAXBINNUMBER +pin in uint nbins = 20; // must be < MAXBINNUMBER pin in real binsize = 1; pin in real minvalue = 0; -pin in si32 index; // use s32 to avoid 0x hex display in hal -pin out si32 check; // use s32 to avoid 0x hex display in hal +pin in sint index; // use sint to avoid 0x hex display in hal +pin out sint check; // use sint to avoid 0x hex display in hal pin in bool reset; pin in bool method; @@ -66,19 +66,19 @@ pin out real nextra; pin out real input_min; pin out real input_max; -pin out ui32 nsamples; +pin out uint nsamples; pin out real variance; pin out real mean; // user may interrogate availablebins to determine this compiled-in limit -pin out si32 availablebins = 200; //MAXBINNUMBER +pin out sint availablebins = 200; //MAXBINNUMBER option period no; function _; -variable int bin[200]; // MAXBINNUMBER +variable rtapi_sint bin[200]; // MAXBINNUMBER variable int first = 1; -variable unsigned last_nbins = 0; +variable rtapi_uint last_nbins = 0; variable rtapi_real maxvalue; @@ -97,7 +97,7 @@ rtapi_real invalue; unsigned i; int idx; check_set(index); -if ( (nbins > (unsigned)availablebins) +if ( (nbins > (rtapi_uint)availablebins) || (nbins < 1) ) { input_error_set(1); @@ -107,12 +107,12 @@ if ( (nbins > (unsigned)availablebins) input_error_set(0); if (reset) {first = 1;} -//pintype "0:float, 1:s32, 2:u32 3:bit"; +//pintype "0:real, 1:sint, 2:uint 3:bool"; switch (pintype) { case 0: invalue = input; break; - case 1: invalue = input_s32; break; - case 2: invalue = input_u32; break; - case 3: invalue = input_bit; break; + case 1: invalue = input_sint; break; + case 2: invalue = input_uint; break; + case 3: invalue = input_bool; break; default: invalue = input; break; } @@ -152,7 +152,7 @@ check_set(index); // user should verify check==index for reading values // -1 value indicates illegal index if (index < 0) { binvalue_set(-1); -} else if (index < (int)nbins) { +} else if (index < (rtapi_sint)nbins) { binvalue_set(bin[index]); } else { binvalue_set(-1); diff --git a/src/hal/components/histobinstream.comp b/src/hal/components/histobinstream.comp index d4d682aadb8..e65230e69fd 100644 --- a/src/hal/components/histobinstream.comp +++ b/src/hal/components/histobinstream.comp @@ -19,9 +19,9 @@ The input used is selected based on pintype: ^h|inputpin |0|input -|1|input-s32 -|2|input-u32 -|3|input-bit +|1|input-sint +|2|input-uint +|3|input-bool |=== Stream format and how to obtain the histogram data: @@ -46,13 +46,13 @@ Maintainers note: hardcoded for MAXBINNUMBER==200 """; // "} make vim syntax highligting happy -pin in ui32 pintype "Select the input pin (0:input 1:input-s32 2:input-u32 3:input-bit)."; +pin in uint pintype "Select the input pin (0:input 1:input-sint 2:input-uint 3:input-bool)."; pin in real input "Floating point input value (pintype 0)."; -pin in si32 input_s32 "Signed input value (pintype 1)."; -pin in ui32 input_u32 "Unsigned input value (pintype 2)."; -pin in bool input_bit "Bit input value (pintype 3)."; +pin in sint input_sint "Signed input value (pintype 1)."; +pin in uint input_uint "Unsigned input value (pintype 2)."; +pin in bool input_bool "Bit input value (pintype 3)."; -pin in ui32 nbins = 20 "Number of active bins N (0 ... N-1)."; +pin in uint nbins = 20 "Number of active bins N (0 ... N-1)."; pin in real binsize = 1 "Width of one bin in input units."; pin in real minvalue = 0 "Lower edge of bin 0."; @@ -65,13 +65,13 @@ pin out bool input_error "Set when input rules are violated; updates are invali pin out real input_min "Minimum input value seen (latched on stream rising edge)."; pin out real input_max "Maximum input value seen (latched on stream rising edge)."; -pin out ui32 nsamples "Number of samples accumulated (latched on stream rising edge)."; +pin out uint nsamples "Number of samples accumulated (latched on stream rising edge)."; pin out real variance "Variance of the input (latched on stream rising edge)."; pin out real mean "Mean of the input (latched on stream rising edge)."; pin out sint stream_time "The time it took for the stream data to be pushed out in nanoseconds (ns)."; // user may interrogate availablebins to determine this compiled-in limit -pin out si32 availablebins = 200; //MAXBINNUMBER +pin out sint availablebins = 200; //MAXBINNUMBER option period no; function _; @@ -82,7 +82,7 @@ include ; include ; variable int first = 1; -variable unsigned last_nbins = 0; +variable rtapi_uint last_nbins = 0; variable rtapi_real last_binsize = 0; variable rtapi_real last_minvalue = 0; variable rtapi_real maxvalue = 0; @@ -91,7 +91,7 @@ variable hal_stream_data_u bins[200]; // MAXBINNUMBER variable hal_stream_data_u ptail; // count of inputs >= upper edge variable hal_stream_data_u ntail; // count of inputs < minvalue -variable rtapi_u64 run_nsamples = 0; +variable rtapi_uint run_nsamples = 0; variable rtapi_real run_min = 1e99; variable rtapi_real run_max = -1e99; variable rtapi_real run_mean = 0; @@ -134,7 +134,7 @@ FUNCTION(_) { rtapi_s64 now = rtapi_get_time(); // Cache some pins - rtapi_u32 c_nbins= nbins; + rtapi_uint c_nbins = nbins; rtapi_real c_binsize = binsize; rtapi_real c_minvalue = minvalue; @@ -142,15 +142,15 @@ FUNCTION(_) { rtapi_real invalue; switch (pintype) { case 0: invalue = input; break; - case 1: invalue = input_s32; break; - case 2: invalue = input_u32; break; - case 3: invalue = input_bit; break; + case 1: invalue = input_sint; break; + case 2: invalue = input_uint; break; + case 3: invalue = input_bool; break; default: invalue = input; break; } // Validate the requested bin geometry. binsize must be > 0 to avoid a // divide by zero and to keep the bin index monotonic. - if (c_nbins < 1 || c_nbins > (unsigned)availablebins || c_binsize <= 0.0) { + if (c_nbins < 1 || c_nbins > (rtapi_uint)availablebins || c_binsize <= 0.0) { input_error_set(1); last_stream = stream; // do not act on a stream edge while in error return; diff --git a/src/hal/components/knob2float.comp b/src/hal/components/knob2float.comp index 1e19f38503c..76d990c32d7 100644 --- a/src/hal/components/knob2float.comp +++ b/src/hal/components/knob2float.comp @@ -17,7 +17,7 @@ component knob2float "Convert counts (probably from an encoder) to a float value"; -pin in si32 counts "Counts"; +pin in sint counts "Counts"; pin in bool enable "When TRUE, output is controlled by count, when FALSE, output is fixed"; pin in real scale "Amount of output change per count"; pin out real out "Output value"; @@ -34,12 +34,12 @@ author "John Kasunich"; ;; typedef struct { - long old_counts; + rtapi_sint old_counts; rtapi_real old_out; } knob2float_data; FUNCTION(_) { - long delta_counts; + rtapi_sint delta_counts; rtapi_real tmp_out; if ( min_out > max_out ) { diff --git a/src/hal/components/latencybins.comp b/src/hal/components/latencybins.comp index 78a75e104ee..dd3cb0dec8e 100644 --- a/src/hal/components/latencybins.comp +++ b/src/hal/components/latencybins.comp @@ -34,45 +34,42 @@ The latency pin outputs the instantaneous latency. Maintainers note: hardcoded for MAXBINNUMBER==1000 """; -pin in si32 maxbinnumber = 1000; // MAXBINNUMBER -pin in si32 index; //use s32 to avoid 0x hex display in hal +pin in sint maxbinnumber = 1000; // MAXBINNUMBER +pin in sint index; //use sint to avoid 0x hex display in hal pin in bool reset; -pin in si32 nsbinsize; - -pin out si32 check; -pin out si32 latency; -pin out si32 latency_max; -pin out si32 latency_min; -pin out si32 pbinvalue; -pin out si32 nbinvalue; -pin out si32 pextra; -pin out si32 nextra; -pin out si32 variance; +pin in sint nsbinsize; + +pin out sint check; +pin out sint latency; +pin out sint latency_max; +pin out sint latency_min; +pin out sint pbinvalue; +pin out sint nbinvalue; +pin out sint pextra; +pin out sint nextra; +pin out sint variance; // user may interrogate available bins to determine this compiled-in limit -pin out si32 availablebins = 1000; // MAXBINNUMBER +pin out sint availablebins = 1000; // MAXBINNUMBER function _; -variable rtapi_s64 last_timer = 0; -variable int last_binmax = 0; +variable rtapi_sint last_timer = 0; +variable rtapi_sint last_binmax = 0; variable int first = 1; -variable int pbins[1001]; // MAXBINNUMBER+1 -variable int nbins[1001]; // MAXBINNUMBER+1 -variable int binmax = 0; +variable rtapi_sint pbins[1001]; // MAXBINNUMBER+1 +variable rtapi_sint nbins[1001]; // MAXBINNUMBER+1 +variable rtapi_sint binmax = 0; -variable rtapi_u32 nsamples; -variable rtapi_u64 sum; -variable rtapi_u64 sq_sum; +variable rtapi_uint nsamples; +variable rtapi_uint sum; +variable rtapi_uint sq_sum; license "GPL"; author "Dewey Garrett"; ;; -rtapi_s64 now = rtapi_get_time(); -rtapi_s32 lat32 = (rtapi_s32)(now - last_timer - period); - //(2^31-1)*1nS = 2.147 seconds max - -int i; +rtapi_sint now = rtapi_get_time(); +rtapi_sint lat = (rtapi_sint)(now - last_timer - period); last_timer = now; @@ -88,21 +85,21 @@ if ( first ) { first = 0; latency_set(0); - latency_min_set(0x7FFFFFFF); - latency_max_set(0x80000000); + latency_min_set(RTAPI_SINT_MAX); + latency_max_set(RTAPI_SINT_MIN); pextra_set(0); nextra_set(0); - for (i = 0; i <= binmax; i++) { + for (int i = 0; i <= binmax; i++) { pbins[i] = 0; nbins[i] = 0; } nsamples = 0; sum = 0; sq_sum = 0; } else { - latency_set(lat32); - i = lat32/nsbinsize; - if (lat32 > latency_max) latency_max_set(lat32); - if (lat32 < latency_min) latency_min_set(lat32); + latency_set(lat); + rtapi_sint i = lat/nsbinsize; + if (lat > latency_max) latency_max_set(lat); + if (lat < latency_min) latency_min_set(lat); if (i >= 0) { if (i > binmax) { pextra_set(pextra + 1); @@ -118,8 +115,8 @@ if ( first } } nsamples++; - sum += lat32; - sq_sum += lat32 * lat32; + sum += lat; + sq_sum += lat * lat; if (nsamples > 1) { // note: division required is: u64/u32 rtapi_u64 dividend; diff --git a/src/hal/components/lcd.c b/src/hal/components/lcd.c index 11db13bc279..6c07c263a01 100644 --- a/src/hal/components/lcd.c +++ b/src/hal/components/lcd.c @@ -200,7 +200,7 @@ int rtapi_app_main(void){ } } } - retval = hal_export_funct("lcd", write, lcd, 1, 0, comp_id); //needs fp? + retval = hal_export_funct("lcd", write, lcd, 0, comp_id); //needs fp? if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "LCD: ERROR: function export failed\n"); return -1; diff --git a/src/hal/components/limit3.comp b/src/hal/components/limit3.comp index c1ea302eb5e..f0d79ea02e0 100644 --- a/src/hal/components/limit3.comp +++ b/src/hal/components/limit3.comp @@ -14,7 +14,7 @@ pin in real max_=1e20; pin in real maxv=1e20; pin in real maxa=1e7 """Max Acceleration. Note that the component becomes unstable with maxa greater than about 1e7 in a 1kHz thread"""; -pin in ui32 smooth_steps=2 +pin in uint smooth_steps=2 """Smooth out acceleration this many periods before reaching input or max/min limit. Higher values avoid oscillation, but will accelerate slightly more slowly."""; diff --git a/src/hal/components/limit_axis.comp b/src/hal/components/limit_axis.comp index f2458264799..b24009455be 100644 --- a/src/hal/components/limit_axis.comp +++ b/src/hal/components/limit_axis.comp @@ -46,7 +46,7 @@ pin out bool error-no-range "error pin indicating that no range matches the fb"; pin out real min-output "Minimum limit output"; pin out real max-output "Maximum limit output"; pin in real fb "Feedback pin, the value of this pin determines which range is active"; -pin out ui32 current-range "Indicates which range is currently active"; +pin out uint current-range "Indicates which range is currently active"; pin in real min-limit-## [10:personality] "The array of minimum limits to select from"; pin in real max-limit-## [10:personality] "The array of macimum limits"; pin in real min-range-## [10:personality] "Defines the range of values with which the fb is compared to set the range"; @@ -115,7 +115,7 @@ FUNCTION(_){ min_output_set(min_limit(i)); // Found our limits, stop looking error_no_range_set(0); - if (i != (int)current_range){ + if ((rtapi_uint)i != current_range){ rtapi_print_msg(RTAPI_MSG_INFO, "limit_axis: Switching to Range %d\n", i); current_range_set(i); } diff --git a/src/hal/components/matrix_kb.c b/src/hal/components/matrix_kb.c index 25e305d1c62..1d49516ee09 100644 --- a/src/hal/components/matrix_kb.c +++ b/src/hal/components/matrix_kb.c @@ -338,7 +338,7 @@ int rtapi_app_main(void){ } } - retval = hal_export_funct(inst->name, loop, inst, 1, 0, comp_id); //needs fp? + retval = hal_export_funct(inst->name, loop, inst, 0, comp_id); //needs fp? if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "matrix_kb: ERROR: function export failed\n"); return -1; diff --git a/src/hal/components/max31855.comp b/src/hal/components/max31855.comp index 2421378072a..324b42fd0cd 100644 --- a/src/hal/components/max31855.comp +++ b/src/hal/components/max31855.comp @@ -37,7 +37,7 @@ pin out real temp_fahrenheit.# [15 : (personality & 0xf)] """Temperature in Fahr pin out real temp_kelvin.# [15 : (personality & 0xf)] """Temperature in Kelvin."""; pin out bool fault.# [15 : (personality & 0xf)] "Fault condition detected."; -pin out ui32 fault_flags.# [15 : (personality & 0xf)] "Fault flags: 0x1 = open sensor, 0x2 short to gnd, 0x3 short to vcc."; +pin out uint fault_flags.# [15 : (personality & 0xf)] "Fault flags: 0x1 = open sensor, 0x2 short to gnd, 0x3 short to vcc."; variable unsigned data_frame [15]; variable unsigned state = 1; diff --git a/src/hal/components/mesa_pktgyro_test.comp b/src/hal/components/mesa_pktgyro_test.comp index 0dffa30f172..f9c8dae103a 100644 --- a/src/hal/components/mesa_pktgyro_test.comp +++ b/src/hal/components/mesa_pktgyro_test.comp @@ -51,7 +51,7 @@ include ; include "hal/drivers/mesa-hostmot2/hostmot2.h"; -pin out si32 rxbytes "Number of Bytes received or negative Error code"; +pin out sint rxbytes "Number of Bytes received or negative Error code"; variable char *name; // PktUART name diff --git a/src/hal/components/millturn.comp b/src/hal/components/millturn.comp index d1271de882e..7bfba9ac38b 100644 --- a/src/hal/components/millturn.comp +++ b/src/hal/components/millturn.comp @@ -28,7 +28,7 @@ chapter (docs/src/motion/switchkins.txt) """; // The fpin pin is not accessible in kinematics functions. // Use the *_setup() function for pins and params used by kinematics. -pin out si32 fpin=0"pin to demonstrate use of a conventional (non-kinematics) function fdemo"; +pin out sint fpin=0"pin to demonstrate use of a conventional (non-kinematics) function fdemo"; option period no; function fdemo; license "GPL"; diff --git a/src/hal/components/mkconv.sh b/src/hal/components/mkconv.sh index b61e2f3dd2a..038aa257c81 100644 --- a/src/hal/components/mkconv.sh +++ b/src/hal/components/mkconv.sh @@ -9,12 +9,10 @@ fi # Convert the hal type into the underlying type utype() { case "$1" in - "bit") echo "rtapi_bool" ;; - "s32") echo "rtapi_s32" ;; - "u32") echo "rtapi_u32" ;; - "s64") echo "rtapi_sint" ;; - "u64") echo "rtapi_uint" ;; - "float") echo "rtapi_real" ;; + "bool") echo "rtapi_bool" ;; + "sint") echo "rtapi_sint" ;; + "uint") echo "rtapi_uint" ;; + "real") echo "rtapi_real" ;; *) echo "This_Will_Generate_An_Error" ;; esac } @@ -22,12 +20,10 @@ utype() { # Return the maximum value supported by a type maxval() { case "$1" in - "bit") echo "1" ;; - "s32") echo "RTAPI_INT32_MAX" ;; - "u32") echo "RTAPI_UINT32_MAX" ;; - "s64") echo "RTAPI_INT64_MAX" ;; - "u64") echo "RTAPI_UINT64_MAX" ;; - "float") echo "Never_Used" ;; + "bool") echo "1" ;; + "sint") echo "RTAPI_SINT_MAX" ;; + "uint") echo "RTAPI_UINT_MAX" ;; + "real") echo "Never_Used" ;; *) echo "This_Will_Generate_An_Error" ;; esac } @@ -35,12 +31,10 @@ maxval() { # Return the minimum value supported by a type minval() { case "$1" in - "bit") echo "0" ;; - "s32") echo "RTAPI_INT32_MIN" ;; - "u32") echo "0" ;; - "s64") echo "RTAPI_INT64_MIN" ;; - "u64") echo "0" ;; - "float") echo "Never_Used" ;; + "bool") echo "0" ;; + "sint") echo "RTAPI_SINT_MIN" ;; + "uint") echo "0" ;; + "real") echo "Never_Used" ;; *) echo "This_Will_Generate_An_Error" ;; esac } @@ -48,12 +42,10 @@ minval() { # New HAL types _newtype() { case "$1" in - "bit") echo "bool" ;; - "s32") echo "si32" ;; - "u32") echo "ui32" ;; - "s64") echo "sint" ;; - "u64") echo "uint" ;; - "float") echo "real" ;; + "bool") echo "bool" ;; + "sint") echo "sint" ;; + "uint") echo "uint" ;; + "real") echo "real" ;; *) echo "This_Will_Generate_An_Error" ;; esac } @@ -64,48 +56,42 @@ _newtype() { # + = max side bound needed # - = min side bound needed # (table: vertical=from ($1); horizontal=to ($2)) -# | flt | u32 | s32 | u64 | s64 | bit -# ----+-----+-----+-----+-----+-----+----- -# flt | xxx | +- | +- | +- | +- | xxx -# u32 | o | xxx | + | o | o | + -# s32 | o | - | xxx | - | o | +- -# u64 | o | + | + | xxx | + | + -# s64 | o | +- | +- | - | xxx | +- -# bit | o | o | o | o | o | xxx +# | real | uint | sint | bool +# -----+------+------+------+------ +# real | xxx | +- | +- | xxx +# uint | o | xxx | + | + +# sint | o | - | xxx | +- +# bool | o | o | o | xxx # # Boolean implementation of the above table: -# | flt | u32 | s32 | u64 | s64 | bit -# ----+-----+-----+-----+-----+-----+----- -# flt | o+- | +- | +- | +- | +- | x+- -# u32 | o | xxx | + | o | o | + -# s32 | o | - | x+x | - | o | +- -# u64 | o | + | + | x+x | + | + -# s64 | o | +- | +- | - | xx- | +- -# bit | o | o | o | o | o | o+x +# | real | uint | sint | bool +# -----+------+------+------+------ +# real | o+- | +- | +- | x+- +# uint | o | x+x | + | + +# sint | o | - | xx- | +- +# bool | o | o | o | o+x # # Enable (val > MAX) test V=1 -test "$1" = 'float' -o \ - "$2" = 'bit' -o \ - \( "$2" = 's32' -a "$1" != 'bit' \) -o \ - \( "$1" = 'u64' -a "$2" != 'float' \) -o \ - \( "$1" = 's64' -a "$2" = 'u32' \) && V=0 +test "$1" = 'real' -o \ + "$2" = 'bool' -o \ + \( "$1" = 'uint' -a "$2" != 'real' \) && V=0 MAXEN="s,@MAXEN@,$V,g" # Enable (val < MIN) test V=1 -test "$1" = 'float' -o \ - \( "$1" = 's64' -a "$2" != 'float' \) -o \ - \( "$1" = 's32' -a \( "$2" = 'u32' -o "$2" = 'u64' -o "$2" = 'bit' \) \) && V=0 +test "$1" = 'real' -o \ + \( "$1" = 'sint' -a "$2" != 'real' \) && V=0 MINEN="s,@MINEN@,$V,g" # Disable clamp code -if test "$2" = 'float' -o \ - "$1" = 'bit' -o \ - \( "$1" = 'u32' -a \( "$2" = 'u64' -o "$2" = 's64' \) \) -o \ - \( "$1" = 's32' -a "$2" = 's64' \) -then CC="s,@CC@,//,g"; else CC="s,@CC@,,g"; fi +if test "$2" = 'real' -o \ + "$1" = 'bool'; then + CC="s,@CC@,//,g" +else + CC="s,@CC@,,g" +fi XIN="s,@XIN@,${1},g" XOUT="s,@XOUT@,${2},g" diff --git a/src/hal/components/modmath.c b/src/hal/components/modmath.c index aeb089e49ad..c24ca3608e2 100644 --- a/src/hal/components/modmath.c +++ b/src/hal/components/modmath.c @@ -196,7 +196,7 @@ static int export_mod_dir(int num) CHK(hal_pin_new_bool(comp_id, HAL_IO, &(moddir->wrap), 1, "%s.wrap", base), "wrap"); /* export function */ - retval = hal_export_funct(base, mod_dir_funct, moddir, 1, 0, comp_id); + retval = hal_export_funct(base, mod_dir_funct, moddir, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "MODMATH: ERROR: '%s' funct export failed\n", base); return -1; diff --git a/src/hal/components/momentary2nist.comp b/src/hal/components/momentary2nist.comp index 420c114e481..76b408d8ea1 100644 --- a/src/hal/components/momentary2nist.comp +++ b/src/hal/components/momentary2nist.comp @@ -29,12 +29,12 @@ is-on: └─────────────────┘ pin in bool in "momentary button in"; pin in bool is_on "current state of device"; -pin in ui32 debounce = 2 "debounce delay for 'in'-pin in cycles"; -pin in ui32 max_pulse_length = 100 "max output pulse length"; +pin in uint debounce = 2 "debounce delay for 'in'-pin in cycles"; +pin in uint max_pulse_length = 100 "max output pulse length"; pin out bool on "turn device on"; pin out bool off "turn device off"; -variable unsigned debounce_cntr; -variable unsigned pulse_length; +variable rtapi_uint debounce_cntr; +variable rtapi_uint pulse_length; variable bool state; option period no; diff --git a/src/hal/components/moveoff.comp b/src/hal/components/moveoff.comp index 3f6962d3a1f..494aa30ac35 100644 --- a/src/hal/components/moveoff.comp +++ b/src/hal/components/moveoff.comp @@ -105,8 +105,8 @@ pin in real waypoint-sample-secs = 0.02 "Minimum sample interval (in seconds) f pin out bool warning "Set TRUE if apply-offsets is deasserted while offset-applied is TRUE."; pin out bool offset_applied "TRUE if one or more offsets are applied."; pin out bool waypoint-limit = 0 "Indicates waypoint limit reached (motion ceases), an enabling pin must be deasserted to initiate return to original position."; -pin out si32 waypoint-ct "Waypoint count (for debugging)"; -pin out si32 waypoint-percent-used "Percent of available waypoints used"; +pin out sint waypoint-ct "Waypoint count (for debugging)"; +pin out sint waypoint-percent-used "Percent of available waypoints used"; pin in real offset-in-#[9 : personality] "Joint offset input value"; pin in real pos-#[9 : personality] "Joint position (typ: axis.0.motor-pos-cmd)"; @@ -125,7 +125,7 @@ pin in real offset-max-#[9 : personality] = 1e20 "Maximum limit for applied off pin in bool dbg_waypoint_limit_test "Debug input to test with limited number of waypoints"; // outputs for debugging: -pin out si32 dbg_state "Debug output for current state of state machine"; +pin out sint dbg_state "Debug output for current state of state machine"; option personality; option extra_setup; diff --git a/src/hal/components/multiclick.comp b/src/hal/components/multiclick.comp index f4de1ab293e..5f2ca65b4ca 100644 --- a/src/hal/components/multiclick.comp +++ b/src/hal/components/multiclick.comp @@ -56,27 +56,27 @@ pin and no fifth click followed it."""; // for debugging -pin out si32 state; +pin out sint state; param rw bool invert_input = FALSE """If FALSE (the default), clicks start with rising edges. If TRUE, clicks start with falling edges."""; -param rw ui32 max_hold_ns = 250000000 +param rw uint max_hold_ns = 250000000 """If the input is held down longer than this, it's not part of a multi-click. (Default 250,000,000 ns, 250 ms.)"""; -param rw ui32 max_space_ns = 250000000 +param rw uint max_space_ns = 250000000 """If the input is released longer than this, it's not part of a multi-click. (Default 250,000,000 ns, 250 ms.)"""; -param rw ui32 output_hold_ns = 100000000 +param rw uint output_hold_ns = 100000000 """Positive pulses on the output pins last this long. (Default 100,000,000 ns, 100 ms.)"""; -variable int click_state = 0; // wish i could have an enum type here +variable rtapi_sint click_state = 0; // wish i could have an enum type here // @@ -88,8 +88,8 @@ variable int click_state = 0; // wish i could have an enum type here // exceeds the timeout, the state machine resets. // -variable unsigned timer; -variable unsigned timeout; +variable rtapi_uint timer; +variable rtapi_uint timeout; // @@ -104,17 +104,17 @@ variable unsigned timeout; // X+1 click). // -variable unsigned single_click_hold_timer; -variable unsigned single_click_only_hold_timer; +variable rtapi_sint single_click_hold_timer; +variable rtapi_sint single_click_only_hold_timer; -variable unsigned double_click_hold_timer; -variable unsigned double_click_only_hold_timer; +variable rtapi_sint double_click_hold_timer; +variable rtapi_sint double_click_only_hold_timer; -variable unsigned triple_click_hold_timer; -variable unsigned triple_click_only_hold_timer; +variable rtapi_sint triple_click_hold_timer; +variable rtapi_sint triple_click_only_hold_timer; -variable unsigned quadruple_click_hold_timer; -variable unsigned quadruple_click_only_hold_timer; +variable rtapi_sint quadruple_click_hold_timer; +variable rtapi_sint quadruple_click_only_hold_timer; description """A click is defined as a rising edge on the 'in' pin, diff --git a/src/hal/components/multiswitch.comp b/src/hal/components/multiswitch.comp index e1f2eae4c40..78d8b24b87f 100644 --- a/src/hal/components/multiswitch.comp +++ b/src/hal/components/multiswitch.comp @@ -25,8 +25,8 @@ component multiswitch """This component toggles between a specified nu pin in bool up = false "Receives signal to toggle up"; pin in bool down = false "Receives signal to toggle down"; -param rw ui32 top-position "Number of positions"; -param rw si32 position "Current state (may be set in the HAL)"; +param rw uint top-position "Number of positions"; +param rw sint position "Current state (may be set in the HAL)"; pin out bool bit-##[32:personality] = false "Output bits"; diff --git a/src/hal/components/mux16.comp b/src/hal/components/mux16.comp index c62392dee09..9ceb7a6b5fe 100644 --- a/src/hal/components/mux16.comp +++ b/src/hal/components/mux16.comp @@ -18,10 +18,10 @@ pin in bool sel#[4] """\ Together, these determine which **in**__N__ value is copied to *out*. """; pin out real out_f; -pin out si32 out_s """\ +pin out sint out_s """\ Follows the value of one of the **in**__N__ values according to the four *sel* values and whether use-graycode is active. -The s32 value will be trunuated and limited to the max and min values of signed values. +The integer value will be trunuated and limited to the max and min values of signed values. [cols="^1,^1,^1,^1,1"] |=== @@ -51,7 +51,7 @@ The s32 value will be trunuated and limited to the max and min values of signed """; param r real elapsed "Current value of the internal debounce timer for debugging."; -param r si32 selected "Current value of the internal selection variable after conversion for debugging"; +param r sint selected "Current value of the internal selection variable after conversion for debugging"; pin in real in##[16] "array of selectable outputs"; variable rtapi_real delaytime; variable int lastnum; diff --git a/src/hal/components/mux_generic.c b/src/hal/components/mux_generic.c index a5515e3633b..4ccab7327f5 100644 --- a/src/hal/components/mux_generic.c +++ b/src/hal/components/mux_generic.c @@ -62,8 +62,8 @@ RTAPI_MP_ARRAY_STRING(config, MAX_CHAN, "mux specifiers inNUMout"); int rtapi_app_main(void){ int retval; int i, f; - char hal_name[HAL_NAME_LEN]; - char *types[5] = {"invalid", "bit", "float", "s32", "u32"}; + char hal_name[HAL_NAME_LEN+1]; + static const char *types[HAL_TYPE_MAX] = {"invalid", "bool", "real", "sint", "uint", "port"}; if (!config[0]) { rtapi_print_msg(RTAPI_MSG_ERR, "The mux_generic component requires at least" " one valid format string\n"); @@ -122,11 +122,11 @@ int rtapi_app_main(void){ break; case 's': case 'S': - type = HAL_S32; + type = HAL_SINT; break; case 'u': case 'U': - type = HAL_U32; + type = HAL_UINT; break; default: rtapi_print_msg(RTAPI_MSG_ERR, "mux_generic: invalid character in " @@ -168,7 +168,7 @@ int rtapi_app_main(void){ // We did away with the no-fp thread. // Always export the float case. It can do any-to-any. - retval = hal_export_functf(write_fp, inst, 1, 0, comp_id, "mux-gen.%02i", i); + retval = hal_export_functf(write_fp, inst, 0, comp_id, "mux-gen.%02i", i); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "mux_generic: ERROR: function export" " failed\n"); @@ -209,9 +209,6 @@ int rtapi_app_main(void){ switch(inst->in_type) { case HAL_BOOL: retval = hal_pin_new_bool(comp_id, HAL_IN, &inst->inputs[p].b, 0, "%s", hal_name); break; case HAL_REAL: retval = hal_pin_new_real(comp_id, HAL_IN, &inst->inputs[p].r, 0, "%s", hal_name); break; - case HAL_S32: retval = hal_pin_new_si32(comp_id, HAL_IN, &inst->inputs[p].s, 0, "%s", hal_name); break; - case HAL_U32: retval = hal_pin_new_ui32(comp_id, HAL_IN, &inst->inputs[p].u, 0, "%s", hal_name); break; - // FIXME: Future...when we switch types case HAL_SINT: retval = hal_pin_new_sint(comp_id, HAL_IN, &inst->inputs[p].s, 0, "%s", hal_name); break; case HAL_UINT: retval = hal_pin_new_uint(comp_id, HAL_IN, &inst->inputs[p].u, 0, "%s", hal_name); break; default: retval = -ENOENT; break; @@ -244,17 +241,14 @@ int rtapi_app_main(void){ } //output pins - retval = rtapi_snprintf(hal_name, HAL_NAME_LEN, - "mux-gen.%02i.out-%s", i, types[inst->out_type]); - if (retval >= HAL_NAME_LEN) { + retval = rtapi_snprintf(hal_name, sizeof(hal_name), + "mux-gen.%02i.out-%s", i, types[inst->out_type]); + if (retval > HAL_NAME_LEN) { goto fail0; } switch(inst->out_type) { case HAL_BOOL: retval = hal_pin_new_bool(comp_id, HAL_OUT, &inst->output.b, 0, "%s", hal_name); break; case HAL_REAL: retval = hal_pin_new_real(comp_id, HAL_OUT, &inst->output.r, 0, "%s", hal_name); break; - case HAL_S32: retval = hal_pin_new_si32(comp_id, HAL_OUT, &inst->output.s, 0, "%s", hal_name); break; - case HAL_U32: retval = hal_pin_new_ui32(comp_id, HAL_OUT, &inst->output.u, 0, "%s", hal_name); break; - // FIXME: Future...when we switch types case HAL_SINT: retval = hal_pin_new_sint(comp_id, HAL_OUT, &inst->output.s, 0, "%s", hal_name); break; case HAL_UINT: retval = hal_pin_new_uint(comp_id, HAL_OUT, &inst->output.u, 0, "%s", hal_name); break; default: retval = -ENOENT; break; @@ -262,7 +256,6 @@ int rtapi_app_main(void){ if (retval != 0) { goto fail0; } - } hal_ready(comp_id); @@ -307,11 +300,11 @@ void write_fp(void *arg, long period) { case FT(HAL_BOOL, HAL_BOOL): hal_set_bool(inst->output.b, hal_get_bool(inst->inputs[s].b)); break; - case FT(HAL_BOOL, HAL_S32): - hal_set_si32(inst->output.s, hal_get_bool(inst->inputs[s].b)); + case FT(HAL_BOOL, HAL_SINT): + hal_set_sint(inst->output.s, hal_get_bool(inst->inputs[s].b)); break; - case FT(HAL_BOOL, HAL_U32): - hal_set_ui32(inst->output.u, hal_get_bool(inst->inputs[s].b)); + case FT(HAL_BOOL, HAL_UINT): + hal_set_uint(inst->output.u, hal_get_bool(inst->inputs[s].b)); break; case FT(HAL_BOOL, HAL_REAL): hal_set_real(inst->output.r, hal_get_bool(inst->inputs[s].b) ? 1.0 : 0.0); @@ -320,56 +313,56 @@ void write_fp(void *arg, long period) { case FT(HAL_REAL, HAL_BOOL): hal_set_bool(inst->output.b, fabs(hal_get_real(inst->inputs[s].r)) > EPS); break; - case FT(HAL_REAL, HAL_REAL): - hal_set_real(inst->output.r, hal_get_real(inst->inputs[s].r)); - break; - case FT(HAL_REAL, HAL_S32): { + case FT(HAL_REAL, HAL_SINT): { rtapi_real v = hal_get_real(inst->inputs[s].r); - if (v > RTAPI_INT32_MAX) { - hal_set_si32(inst->output.s, RTAPI_INT32_MAX); - } else if (v < RTAPI_INT32_MIN) { - hal_set_si32(inst->output.s, RTAPI_INT32_MIN); + if (v > (rtapi_real)RTAPI_SINT_MAX) { + hal_set_sint(inst->output.s, RTAPI_SINT_MAX); + } else if (v < (rtapi_real)RTAPI_SINT_MIN) { + hal_set_sint(inst->output.s, RTAPI_SINT_MIN); } else { - hal_set_si32(inst->output.s, v); + hal_set_sint(inst->output.s, v); } break; } - case FT(HAL_REAL, HAL_U32): { + case FT(HAL_REAL, HAL_UINT): { rtapi_real v = hal_get_real(inst->inputs[s].r); - if (v > RTAPI_UINT32_MAX) { - hal_set_ui32(inst->output.u, RTAPI_UINT32_MAX); - } else if (v < 0) { - hal_set_ui32(inst->output.u, 0); + if (v > (rtapi_real)RTAPI_UINT_MAX) { + hal_set_uint(inst->output.u, RTAPI_UINT_MAX); + } else if (v < 0.0) { + hal_set_uint(inst->output.u, 0); } else { - hal_set_ui32(inst->output.u, v); + hal_set_uint(inst->output.u, v); } break; } + case FT(HAL_REAL, HAL_REAL): + hal_set_real(inst->output.r, hal_get_real(inst->inputs[s].r)); + break; - case FT(HAL_S32, HAL_BOOL): - hal_set_bool(inst->output.b, hal_get_si32(inst->inputs[s].s) != 0); + case FT(HAL_SINT, HAL_BOOL): + hal_set_bool(inst->output.b, hal_get_sint(inst->inputs[s].s) != 0); break; - case FT(HAL_S32, HAL_S32): - hal_set_si32(inst->output.s, hal_get_si32(inst->inputs[s].s)); + case FT(HAL_SINT, HAL_SINT): + hal_set_sint(inst->output.s, hal_get_sint(inst->inputs[s].s)); break; - case FT(HAL_S32, HAL_U32): { - rtapi_s32 v = hal_get_si32(inst->inputs[s].s); - hal_set_ui32(inst->output.u, v >= 0 ? v : 0); + case FT(HAL_SINT, HAL_UINT): { + rtapi_sint v = hal_get_sint(inst->inputs[s].s); + hal_set_uint(inst->output.u, v >= 0 ? v : 0); break; } - case FT(HAL_S32, HAL_REAL): - hal_set_real(inst->output.r, hal_get_si32(inst->inputs[s].s)); + case FT(HAL_SINT, HAL_REAL): + hal_set_real(inst->output.r, hal_get_sint(inst->inputs[s].s)); break; - case FT(HAL_U32, HAL_BOOL): - hal_set_bool(inst->output.b, hal_get_ui32(inst->inputs[s].u) != 0); + case FT(HAL_UINT, HAL_BOOL): + hal_set_bool(inst->output.b, hal_get_uint(inst->inputs[s].u) != 0); break; - case FT(HAL_U32, HAL_S32): { - rtapi_u32 v = hal_get_ui32(inst->inputs[s].u); - hal_set_si32(inst->output.s, v > RTAPI_INT32_MAX ? RTAPI_INT32_MAX : v); + case FT(HAL_UINT, HAL_SINT): { + rtapi_uint v = hal_get_uint(inst->inputs[s].u); + hal_set_sint(inst->output.s, v > RTAPI_SINT_MAX ? RTAPI_SINT_MAX : v); break; } - case FT(HAL_U32, HAL_U32): - hal_set_ui32(inst->output.u, hal_get_ui32(inst->inputs[s].u)); + case FT(HAL_UINT, HAL_UINT): + hal_set_uint(inst->output.u, hal_get_uint(inst->inputs[s].u)); break; - case FT(HAL_U32, HAL_REAL): - hal_set_real(inst->output.r, hal_get_ui32(inst->inputs[s].u)); + case FT(HAL_UINT, HAL_REAL): + hal_set_real(inst->output.r, hal_get_uint(inst->inputs[s].u)); break; } } diff --git a/src/hal/components/orient.comp b/src/hal/components/orient.comp index 60b6bb7fbdd..514d0b52223 100644 --- a/src/hal/components/orient.comp +++ b/src/hal/components/orient.comp @@ -1,7 +1,7 @@ component orient "Provide a PID command input for orientation mode based on current spindle position, target angle and orient mode"; pin in bool enable "enable angular output for orientation mode"; -pin in si32 mode "sets rotation direction and optional preceding reset to index signal"; +pin in sint mode "sets rotation direction and optional preceding reset to index signal"; pin in real position "spindle position input, unit 1 rev"; pin in real angle "orient target position in degrees, 0 ≤ angle < 360"; pin out real command "target spindle position, input to PID command"; @@ -12,9 +12,9 @@ pin io bool index-enable "Connect to the spindle encoder counter to reset to i param r ui32 state "state machine for index homing"; -variable int last_enable = 0; +variable rtapi_bool last_enable = 0; variable int debounce = 0; // to prevent the in-position triggering with the spindle moving -variable int m = 0; +variable rtapi_sint m = 0; variable rtapi_real target_angle = 0; variable rtapi_real latched_position = 0; @@ -84,7 +84,7 @@ FUNCTION(_) { if (en && !last_enable) { // positive edge on enable m = mode; if ((0 > m) || (5 < m)) { - rtapi_print_msg(RTAPI_MSG_ERR, "orient.comp: Unhandled mode %i\n", m); + rtapi_print_msg(RTAPI_MSG_ERR, "orient.comp: Unhandled mode %ld\n", m); } if (m < 3){ state_set(1); diff --git a/src/hal/components/pid.c b/src/hal/components/pid.c index b35b11a8173..fb0b7c87f61 100644 --- a/src/hal/components/pid.c +++ b/src/hal/components/pid.c @@ -787,7 +787,7 @@ static int export_pid(hal_pid_t * addr, char * prefix) addr->state = STATE_PID; #endif /* AUTO_TUNER */ /* export function for this loop */ - retval = hal_export_functf(calc_pid, addr, 1, 0, comp_id, "%s.do-pid-calcs", prefix); + retval = hal_export_functf(calc_pid, addr, 0, comp_id, "%s.do-pid-calcs", prefix); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, NAME ": ERROR: do_pid_calcs funct export failed\n"); hal_exit(comp_id); diff --git a/src/hal/components/plasmac.comp b/src/hal/components/plasmac.comp index 92a9ba5b432..b7146429cd6 100644 --- a/src/hal/components/plasmac.comp +++ b/src/hal/components/plasmac.comp @@ -30,7 +30,7 @@ pin in real arc_lost_delay "arc lost delay during a cut (second pin in real arc_ok_high "maximum voltage level for Arc OK signal [mode 0] (volts)"; pin in bool arc_ok_in "external arc ok input signal [mode 1 & mode 2]"; pin in real arc_ok_low "minimum voltage level for Arc OK signal [mode 0] (volts)"; -pin in si32 arc_max_starts "maximum attempts at starting the arc"; +pin in sint arc_max_starts "maximum attempts at starting the arc"; pin in real arc_voltage_in "arc voltage input [mode 0 & mode 1] see Notes above"; pin in real arc_voltage_offset "offset to set arc voltage to 0 at 0 volts"; pin in real arc_voltage_scale "scale to convert arc_voltage input to actual volts"; @@ -69,7 +69,7 @@ pin in bool ignore_arc_ok_0 "Do not require arc ok for start or pin in bool ignore_arc_ok_1 "Do not require arc ok for start or cutting."; pin in real kerf_width "placeholder for better G-code portability between GUIs"; pin in bool laser_mode "laser mode for fiber lasers"; -pin in si32 laser_recovery_start "start laser offset for cut recovery"; +pin in sint laser_recovery_start "start laser offset for cut recovery"; pin in si32 laser_x_offset "alignment laser x axis offset (scaled units)"; pin in si32 laser_y_offset "alignment laser y axis offset (scaled units)"; pin in real lowpass_frequency "lowpass cutoff frequency for arc voltage output"; @@ -78,8 +78,8 @@ pin in real material_thickness "material thickness (machine units)" pin in si32 max_offset = 5 "maximum height offset (mm)"; pin in bool mesh_arc_ok = FALSE "Do not require arc ok for mesh mode."; pin in bool mesh_enable "enable mesh cutting mode"; -pin in si32 mode "operating mode"; -pin in si32 motion_type "motion type, connect to motion.motion-type"; +pin in sint mode "operating mode"; +pin in sint motion_type "motion type, connect to motion.motion-type"; pin in bool move_down "external thc down switch [mode 2]"; pin in bool move_up "external thc up switch [mode 2]"; pin in bool multi_tool = 1 "allows the use of multiple tools"; @@ -91,7 +91,7 @@ pin in bool offset_set_probe "deploy probe for setting offsets"; pin in bool offset_set_scribe "deploy scribe for setting offsets"; pin in bool offsets_active "offsets are active, connect to motion.eoffset-active"; pin in bool offsets_limited "offsets are limited, connect to motion.eoffset-limited"; -pin in si32 ohmic_max_attempts "maximum ohmic probe attempts before fallback to float switch"; +pin in sint ohmic_max_attempts "maximum ohmic probe attempts before fallback to float switch"; pin in bool ohmic_probe "ohmic probe input, from ohmic-sense-out or external component/pin"; pin in bool ohmic_probe_enable "enable ohmic probe"; pin in real ohmic_probe_offset "Z axis offset for ohmic probe (machine units)"; @@ -183,7 +183,7 @@ pin out real cut_time "cut time of current job"; pin out bool cutting_stop "stop manual cut, connect to halui.spindle.0.stop"; pin out bool feed_hold "feed hold, connect to motion.feed-hold"; pin out bool jog_inhibit "jog inhibit, connect to motion.jog-inhibit"; -pin out si32 laser_recovery_state "laser recovery status"; +pin out sint laser_recovery_state "laser recovery status"; pin out bool led_down "thc move down indicator"; pin out bool led_up "thc move up indicator"; pin out real offset_scale "offset scale, connect to axis..eoffset-scale"; @@ -191,7 +191,7 @@ pin out bool ohmic_enable "on only while probing"; pin out bool ohmic_sense_out "ohmic sense output state"; pin out bool paused_motion "paused motion flag, true when paused motion is active"; pin out real paused_time "paused time during current job"; -pin out si32 pierce_count "number of pierce attempts (torch starts)"; +pin out sint pierce_count "number of pierce attempts (torch starts)"; pin out bool probe_out "probe for tube cutting, connect to motion.probe-input"; pin out bool probe_test_error "minimum limit reached while probe testing"; pin out real probe_time "probe time of current job"; @@ -206,8 +206,8 @@ pin out bool safe_height_is_limited "safe height is limited indicator"; pin out bool sensor_active "one of float, ohmic, or breakaway is detected"; pin out bool scribe_arm "arm the scribe"; pin out bool scribe_on "turn scribe on"; -pin out si32 state_out "current state"; -pin out si32 stop_type_out "current stop type"; +pin out sint state_out "current state"; +pin out sint stop_type_out "current stop type"; pin out bool thc_active "thc status output"; pin out bool thc_enabled "thc is enabled"; pin out bool torch_on "turn torch on, connect to your torch on input"; @@ -1503,13 +1503,13 @@ FUNCTION(_) { cutting_stop_set(1); state = MAX_HEIGHT; if (!error_message){ - rtapi_print_msg(RTAPI_MSG_ERR,"no arc detected after %d start attempts\nmanual cut is stopped.\n", arc_max_starts); + rtapi_print_msg(RTAPI_MSG_ERR,"no arc detected after %ld start attempts\nmanual cut is stopped.\n", arc_max_starts); error_message = 1; } }else{ program_pause_set(TRUE); if (!error_message){ - rtapi_print_msg(RTAPI_MSG_ERR,"no arc detected after %d start attempts\nprogram is paused.\n", arc_max_starts); + rtapi_print_msg(RTAPI_MSG_ERR,"no arc detected after %ld start attempts\nprogram is paused.\n", arc_max_starts); error_message = 1; } } diff --git a/src/hal/components/pushmsg.comp b/src/hal/components/pushmsg.comp index adbe0e8e306..ef1f3f5288d 100644 --- a/src/hal/components/pushmsg.comp +++ b/src/hal/components/pushmsg.comp @@ -30,12 +30,10 @@ following syntax: + Each placeholder creates a typed input pin *pushmsg*.____.____ that the user wires up to the source signal. The type letter in the placeholder selects the pin type: - * `b` - bit - * `s` - s32 - * `u` - u32 - * `l` - s64 - * `k` - u64 - * `f` - float + * `b` - bool + * `s`,`l` - sint + * `u`,`k` - uint + * `f`,`r` - real Each message line is limited to 128 characters in length. The length count includes the `level` indicator, `pinname`, `message` text and the `|` separator @@ -284,32 +282,25 @@ static int setup_message(const char *pfx, int idx, const char *msg, msg_slot_t * return rv; break; case 's': case 'S': - slot->substtype[subst] = HAL_S32; - if ((rv = hal_pin_new_si32(comp_id, HAL_IN, &pin->substs[subst].s, 0, "%s.%s", pinname, cptr)) < 0) - return rv; - break; - case 'u': case 'U': - slot->substtype[subst] = HAL_U32; - if ((rv = hal_pin_new_ui32(comp_id, HAL_IN, &pin->substs[subst].u, 0, "%s.%s", pinname, cptr)) < 0) - return rv; - break; case 'l': case 'L': slot->substtype[subst] = HAL_SINT; if ((rv = hal_pin_new_sint(comp_id, HAL_IN, &pin->substs[subst].s, 0, "%s.%s", pinname, cptr)) < 0) return rv; break; + case 'u': case 'U': case 'k': case 'K': slot->substtype[subst] = HAL_UINT; if ((rv = hal_pin_new_uint(comp_id, HAL_IN, &pin->substs[subst].u, 0, "%s.%s", pinname, cptr)) < 0) return rv; break; case 'f': case 'F': + case 'r': case 'R': slot->substtype[subst] = HAL_REAL; if ((rv = hal_pin_new_real(comp_id, HAL_IN, &pin->substs[subst].r, 0.0, "%s.%s", pinname, cptr)) < 0) return rv; break; default: - rtapi_print_msg(RTAPI_MSG_ERR, "%s: Message %d bad substitution type '%c', expected one of {b,f,s,u,k,l}\n", + rtapi_print_msg(RTAPI_MSG_ERR, "%s: Message %d bad substitution type '%c', expected one of {b,f,r,s,u,k,l}\n", pfx, idx, printable(tchar)); return -EBADMSG; } @@ -390,12 +381,6 @@ static void print_slot(int s) case HAL_BOOL: n = rtapi_snprintf(end, left, "%d%s", (int)hal_get_bool(pins[s].substs[i].b), slots[s].parts[i]); break; - case HAL_S32: - n = rtapi_snprintf(end, left, "%d%s", (int)hal_get_si32(pins[s].substs[i].s), slots[s].parts[i]); - break; - case HAL_U32: - n = rtapi_snprintf(end, left, "%u%s", (unsigned)hal_get_ui32(pins[s].substs[i].u), slots[s].parts[i]); - break; case HAL_SINT: n = rtapi_snprintf(end, left, "%ld%s", (long)hal_get_sint(pins[s].substs[i].s), slots[s].parts[i]); break; diff --git a/src/hal/components/pwmgen.c b/src/hal/components/pwmgen.c index 4575748f56d..76582636bb0 100644 --- a/src/hal/components/pwmgen.c +++ b/src/hal/components/pwmgen.c @@ -192,7 +192,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("pwmgen.make-pulses", make_pulses, - pwmgen_array, 0, 0, comp_id); + pwmgen_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PWMGEN: ERROR: makepulses funct export failed\n"); @@ -200,7 +200,7 @@ int rtapi_app_main(void) return -1; } retval = hal_export_funct("pwmgen.update", update, - pwmgen_array, 1, 0, comp_id); + pwmgen_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PWMGEN: ERROR: update funct export failed\n"); diff --git a/src/hal/components/radiobutton.comp b/src/hal/components/radiobutton.comp index c3938516abb..52bc2aaaa20 100644 --- a/src/hal/components/radiobutton.comp +++ b/src/hal/components/radiobutton.comp @@ -1,17 +1,17 @@ component radiobutton "Select one from several outputs with momentary switches"; -description """This component creates \\fBpersonality\\fR inputs to select -one of several outputs. When \\fBsel-N\\fR is momentarily set high then the -corresponding bit output \\fBout-N\\fR will be set high and other outputs will -be set low. Simultaneously the value on the pin \\fBinput-N\\fR will be copied -to the \\fBvalue\\fR pin. -The \\fBselected\\fR pin will indicate which set of outputs is currently +description """This component creates *personality* inputs to select +one of several outputs. When *sel-N* is momentarily set high then the +corresponding bit output *out-N* will be set high and other outputs will +be set low. Simultaneously the value on the pin *input-N* will be copied +to the *value* pin. +The *selected* pin will indicate which set of outputs is currently active. Note that channel-0 should be used to provide the default values."""; pin in bool sel-##[32:personality] "Inputs to select a channel"; pin out bool out-##[32:personality] "output selected"; -pin out si32 selected = 0 "indicates which output is currently active"; +pin out sint selected = 0 "indicates which output is currently active"; pin in real input-##[32:personality] "Possible output values"; pin out real value "currently-selected output value"; @@ -23,7 +23,7 @@ author "Andy Pugh"; ;; FUNCTION(_){ - rtapi_s32 s = selected; + rtapi_sint s = selected; for(int i = 0; i < personality; i++){ if(sel(i) !=0){ s = selected_set(i); diff --git a/src/hal/components/raster.comp b/src/hal/components/raster.comp index 553c6df9515..e89a71cbe86 100644 --- a/src/hal/components/raster.comp +++ b/src/hal/components/raster.comp @@ -7,17 +7,17 @@ pin in bool run "starts the raster"; pin out bool enabled = 0 "When a valid raster program is running."; pin out real output = -1 "current output level command"; pin out bool fault = 0 "If error has occurred"; -pin out si32 fault_code = 0 "Code of fault"; -pin out si32 state = 0 "current state"; +pin out sint fault_code = 0 "Code of fault"; +pin out sint state = 0 "current state"; pin out real program_position = 0.0 "base position of program at run start"; pin out real program_offset = 0.0 "offset to start of pixel data"; -pin out si32 bpp = 0 "bits per pixel."; +pin out sint bpp = 0 "bits per pixel."; pin out real ppu = 0.0 "pixels per unit"; -pin out si32 count = 0 "pixel count"; +pin out sint count = 0 "pixel count"; pin out real bitmap_position = 0.0 "calculated position in bitmap"; pin out real current_pixel_value = -1.0 "current loaded pixel value"; pin out real previous_pixel_value = -1.0 "previously loaded pixel value"; -pin out si32 current_pixel_index = -1 "currently loaded pixel index"; +pin out sint current_pixel_index = -1 "currently loaded pixel index"; pin out real fraction = 0.0; description """ @@ -95,7 +95,7 @@ static bool float_eq(rtapi_real a, rtapi_real b) { return fabs(a-b) < epsilon; } -static bool read_float(const hal_port_t *port, hal_real_t value) { +static bool read_float(const hal_port_t port, hal_real_t value) { char data[32]; int available = hal_port_readable(port); char* pos; @@ -119,7 +119,7 @@ static bool read_float(const hal_port_t *port, hal_real_t value) { return true; } -static bool read_int(const hal_port_t *port, hal_sint_t value) { +static bool read_int(const hal_port_t port, hal_sint_t value) { char data[10]; long val; int available = hal_port_readable(port); @@ -143,7 +143,7 @@ static bool read_int(const hal_port_t *port, hal_sint_t value) { return false; } - hal_set_si32(value, val); + hal_set_sint(value, val); hal_port_peek_commit(port, pos - data + 1); @@ -157,7 +157,7 @@ static bool read_int(const hal_port_t *port, hal_sint_t value) { pixels bpp must be defined in increments of 4. a pixel value with all 1 bits is a special value considered "off" for the raster and no power will be output */ -static bool read_pixel_data(const hal_port_t *port, int bits_per_pixel, hal_real_t power) { +static bool read_pixel_data(const hal_port_t port, int bits_per_pixel, hal_real_t power) { char data[8]; long value = 0; unsigned int off = 0xFFFFFFFF >> (32 - bits_per_pixel); @@ -223,7 +223,7 @@ FUNCTION(_) { } else if(!read_int(program_ptr, count_ptr) || (count < 2)) { state_set(FAULT); fault_code_set(ERROR_INVALID_COUNT); - } else if((int)hal_port_readable(program_ptr) != ((bpp / 4) * count)) { + } else if((rtapi_sint)hal_port_readable(program_ptr) != ((bpp / 4) * count)) { state_set(FAULT); fault_code_set(ERROR_PROGWRONGSIZE); } else { @@ -241,7 +241,7 @@ FUNCTION(_) { enabled_set(1); //consume pixel data as needed from programming port - while((current_pixel_index < (((int)count)-1)) && ((rtapi_real)current_pixel_index < bitmap_position)) { + while((current_pixel_index < (count-1)) && ((rtapi_real)current_pixel_index < bitmap_position)) { current_pixel_index_set(current_pixel_index+1); previous_pixel_value_set(current_pixel_value); diff --git a/src/hal/components/reset.comp b/src/hal/components/reset.comp index fb198026d80..4d5b26b053b 100644 --- a/src/hal/components/reset.comp +++ b/src/hal/components/reset.comp @@ -37,15 +37,15 @@ ******************************************************************************/ component reset "Resets an IO signal"; -pin in bool trigger "Trigger input"; -pin io ui32 out_u32 = 0 "Unsigned 32 bit integer output value"; -pin in ui32 reset_u32 = 0 "Unsigned 32 bit integer reset value"; -pin io si32 out_s32 = 0 "Signed 32 bit integer output value"; -pin in si32 reset_s32 = 0 "Signed 32 bit integer reset value"; -pin io real out_float = 0.0 "Float output value"; -pin in real reset_float = 0.0 "Float reset value"; -pin io bool out_bit = false "Bit integer output value"; -pin in bool reset_bit = false "Bit reset value"; +pin in bool trigger "Trigger input"; +pin io uint out_uint = 0 "Unsigned integer output value"; +pin in uint reset_uint = 0 "Unsigned integer reset value"; +pin io sint out_sint = 0 "Signed integer output value"; +pin in sint reset_sint = 0 "Signed integer reset value"; +pin io real out_real = 0.0 "Float output value"; +pin in real reset_real = 0.0 "Float reset value"; +pin io bool out_bool = false "Bit integer output value"; +pin in bool reset_bool = false "Bit reset value"; pin in bool retriggerable = true "Allow additional edges to reset"; pin in bool rising = true "Trigger on rising edge"; pin in bool falling = false "Trigger on falling edge"; @@ -54,10 +54,10 @@ function _ "Update the output value"; description """ Component to reset IO signals. -This function works like a conditional sets - it is fed with a float -and/or bit/s32/u32 pins that are I/O, but are save the value only if +This function works like a conditional sets - it is fed with a real +and/or bool/sint/uint pins that are I/O, but are save the value only if the *trigger* pin is set. The values assigned to those signals are -passed via the input pins reset_float/s32/u32/bit. +passed via the input pins reset_real/sint/uint/bool. """; license "GPL"; author "Alexander Rössler"; @@ -67,10 +67,10 @@ FUNCTION(_) { rtapi_bool new_trigger = trigger; if ((new_trigger != last_trigger) && ((rising && (new_trigger)) || (falling && (!new_trigger)))) { - out_u32_set(reset_u32); - out_s32_set(reset_s32); - out_float_set(reset_float); - out_bit_set(reset_bit); + out_uint_set(reset_uint); + out_sint_set(reset_sint); + out_real_set(reset_real); + out_bool_set(reset_bool); } last_trigger = new_trigger; } diff --git a/src/hal/components/safety_latch.comp b/src/hal/components/safety_latch.comp index 6c30637b27e..6785247e54c 100644 --- a/src/hal/components/safety_latch.comp +++ b/src/hal/components/safety_latch.comp @@ -53,15 +53,15 @@ The inputs pin min and max clamp the error count value to a specified range. """; pin in bool error_in = false "Error Input"; -pin in si32 heal = 1 "Heal when ok per tick"; -pin in si32 harm = 1 "Harm when error per tick"; +pin in sint heal = 1 "Heal when ok per tick"; +pin in sint harm = 1 "Harm when error per tick"; pin in bool latching = true "If a reset is necessary to heal an error"; pin in bool reset = false "Reset input"; -pin in si32 threshold = 100 "Error output threshold"; -pin in si32 min_ = 0 "Minimum count"; -pin in si32 max_ = 1000 "Maximum count"; +pin in sint threshold = 100 "Error output threshold"; +pin in sint min_ = 0 "Minimum count"; +pin in sint max_ = 1000 "Maximum count"; pin in bool enable = true "If not enabled the error count is passed to the output"; -pin out si32 count = 0 "Current count"; +pin out sint count = 0 "Current count"; pin out bool error_out = false "Error output"; pin out bool ok_out = true "Ok output"; diff --git a/src/hal/components/sample_hold.comp b/src/hal/components/sample_hold.comp index bf64254c20b..4f9c2525eed 100644 --- a/src/hal/components/sample_hold.comp +++ b/src/hal/components/sample_hold.comp @@ -1,7 +1,7 @@ component sample_hold "Sample and Hold"; -pin in si32 in; +pin in sint in; pin in bool hold; -pin out si32 out; +pin out sint out; option period no; function _; see_also "*tristate*(9)"; diff --git a/src/hal/components/sampler.c b/src/hal/components/sampler.c index 996091c7de7..9d273a4993f 100644 --- a/src/hal/components/sampler.c +++ b/src/hal/components/sampler.c @@ -168,8 +168,6 @@ static void sample(void *arg, long period) for (int n = 0; n < num_pins; n++) { switch (hal_stream_element_type(&samp->fifo, n)) { case HAL_REAL: data[n].f = hal_get_real(samp->pins[n].r); break; - case HAL_S32: data[n].s = hal_get_si32(samp->pins[n].s); break; - case HAL_U32: data[n].u = hal_get_ui32(samp->pins[n].u); break; case HAL_SINT: data[n].l = hal_get_sint(samp->pins[n].s); break; case HAL_UINT: data[n].k = hal_get_uint(samp->pins[n].u); break; case HAL_BOOL: data[n].b = hal_get_bool(samp->pins[n].b); break; @@ -231,8 +229,6 @@ static int init_sampler(int num, sampler_t *str) int type; switch(type = hal_stream_element_type(&str->fifo, n)) { case HAL_REAL: retval = hal_pin_new_real(comp_id, HAL_IN, &str->pins[n].r, 0.0, pstr, num, n); break; - case HAL_S32: retval = hal_pin_new_si32(comp_id, HAL_IN, &str->pins[n].s, 0, pstr, num, n); break; - case HAL_U32: retval = hal_pin_new_ui32(comp_id, HAL_IN, &str->pins[n].u, 0, pstr, num, n); break; case HAL_SINT: retval = hal_pin_new_sint(comp_id, HAL_IN, &str->pins[n].s, 0, pstr, num, n); break; case HAL_UINT: retval = hal_pin_new_uint(comp_id, HAL_IN, &str->pins[n].u, 0, pstr, num, n); break; case HAL_BOOL: retval = hal_pin_new_bool(comp_id, HAL_IN, &str->pins[n].b, 0, pstr, num, n); break; @@ -246,7 +242,7 @@ static int init_sampler(int num, sampler_t *str) } } /* export update function */ - retval = hal_export_functf(sample, str, 1, 0, comp_id, "%s%d", strbase, num); + retval = hal_export_functf(sample, str, 0, comp_id, "%s%d", strbase, num); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "SAMPLER: ERROR: function export failed\n"); return retval; diff --git a/src/hal/components/sampler_usr.c b/src/hal/components/sampler_usr.c index ab4cd207640..71d2abeaa9e 100644 --- a/src/hal/components/sampler_usr.c +++ b/src/hal/components/sampler_usr.c @@ -220,12 +220,6 @@ int main(int argc, char **argv) printf ( "0 " ); } break; - case HAL_U32: - printf ( "%lu ", (unsigned long)buf[n].u); - break; - case HAL_S32: - printf ( "%ld ", (long)buf[n].s); - break; case HAL_UINT: printf ( "%llu ", (unsigned long long)buf[n].k); break; diff --git a/src/hal/components/scaled_s32_sums.comp b/src/hal/components/scaled_sint_sums.comp similarity index 72% rename from src/hal/components/scaled_s32_sums.comp rename to src/hal/components/scaled_sint_sums.comp index 86e4f611c75..f60f7250580 100644 --- a/src/hal/components/scaled_s32_sums.comp +++ b/src/hal/components/scaled_sint_sums.comp @@ -1,14 +1,14 @@ -component scaled_s32_sums "Sum of four inputs (each with a scale)"; +component scaled_sint_sums "Sum of four inputs (each with a scale)"; see_also "sum2(9), weighted_sum(9)"; -pin in si32 in0; -pin in si32 in1; -pin in si32 in2; -pin in si32 in3; +pin in sint in0; +pin in sint in1; +pin in sint in2; +pin in sint in3; pin in real scale0 = 1.0; pin in real scale1 = 1.0; pin in real scale2 = 1.0; pin in real scale3 = 1.0; -pin out si32 out_s; +pin out sint out_s; pin out real out_f "out-s = out-f = (in0 * scale0) + (in1 * scale1) + (in2 * scale2) + (in3 * scale3)"; option period no; function _; diff --git a/src/hal/components/select8.comp b/src/hal/components/select8.comp index da4c0e5bc70..135d7bce44c 100644 --- a/src/hal/components/select8.comp +++ b/src/hal/components/select8.comp @@ -1,6 +1,6 @@ component select8 "8-bit binary match detector"; pin in bool enable = TRUE "Set enable to FALSE to cause all outputs to be set FALSE."; -pin in si32 sel "The number of the output to set TRUE. All other outputs well be set FALSE."; +pin in sint sel "The number of the output to set TRUE. All other outputs well be set FALSE."; pin out bool out#[8] "Output bits. If enable is set and the sel input is between 0 and 7, then the corresponding output bit will be set true."; option period no; function _; @@ -9,7 +9,7 @@ license "GPL"; author "Stephen Wille Padnos"; ;; FUNCTION(_) { - rtapi_s32 temp_sel = sel; + rtapi_sint temp_sel = sel; rtapi_bool temp_enable = enable; for (int i=0;i<8;i++) { if (!temp_enable || temp_sel!=i) diff --git a/src/hal/components/siggen.c b/src/hal/components/siggen.c index b1c84d6560c..c92c2b8fc4b 100644 --- a/src/hal/components/siggen.c +++ b/src/hal/components/siggen.c @@ -335,7 +335,7 @@ static int export_siggen(int num, hal_siggen_t * addr,char* prefix) addr->index = 0.0; /* export function for this loop */ retval = - hal_export_functf(calc_siggen, &(siggen_array[num]), 1, 0, + hal_export_functf(calc_siggen, &(siggen_array[num]), 0, comp_id, "%s.update", prefix); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, diff --git a/src/hal/components/sim_encoder.c b/src/hal/components/sim_encoder.c index 0351b835ece..1e02030b178 100644 --- a/src/hal/components/sim_encoder.c +++ b/src/hal/components/sim_encoder.c @@ -197,7 +197,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("sim-encoder.make-pulses", make_pulses, - sim_enc_array, 0, 0, comp_id); + sim_enc_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "SIM_ENCODER: ERROR: makepulses funct export failed\n"); @@ -205,7 +205,7 @@ int rtapi_app_main(void) return -1; } retval = hal_export_funct("sim-encoder.update-speed", update_speed, - sim_enc_array, 1, 0, comp_id); + sim_enc_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "SIM_ENCODER: ERROR: speed update funct export failed\n"); diff --git a/src/hal/components/sim_matrix_kb.comp b/src/hal/components/sim_matrix_kb.comp index aabe7915b4f..ed4b79e3b0f 100644 --- a/src/hal/components/sim_matrix_kb.comp +++ b/src/hal/components/sim_matrix_kb.comp @@ -1,6 +1,6 @@ component sim_matrix_kb "convert HAL pin inputs to keycodes"; -pin out ui32 out "pin that outputs the Keycode"; +pin out uint out "pin that outputs the Keycode"; pin in bool button.c00.r##[8] "array of inputs"; pin in bool button.c01.r##[8] "array of inputs"; diff --git a/src/hal/components/sphereprobe.comp b/src/hal/components/sphereprobe.comp index 1b20485857b..d10d5422536 100644 --- a/src/hal/components/sphereprobe.comp +++ b/src/hal/components/sphereprobe.comp @@ -2,27 +2,28 @@ component sphereprobe "Probe a pretend hemisphere"; author "Jeff Epler"; license "GPL"; -pin in si32 px; -pin in si32 py; -pin in si32 pz "*rawcounts* position from software encoder"; +pin in sint px; +pin in sint py; +pin in sint pz "*rawcounts* position from software encoder"; -pin in si32 cx; -pin in si32 cy; -pin in si32 cz "Center of sphere in counts"; -pin in si32 r "Radius of hemisphere in counts"; +pin in sint cx; +pin in sint cy; +pin in sint cz "Center of sphere in counts"; +pin in sint r "Radius of hemisphere in counts"; pin out bool probe-out; option period no; function _ "update probe-out based on inputs"; ;; -#undef abs -int abs(int x) { if(x < 0) return -x; else return x; } +static inline rtapi_uint myabs(rtapi_sint x) { return x < 0 ? -x : x; } FUNCTION(_) { - rtapi_u64 dx = abs(px-cx), dy=abs(py-cy), dz=abs(pz-cz); - rtapi_u64 d2 = dx*dx + dy*dy; - rtapi_u64 r2 = (rtapi_s64)r*(rtapi_s64)r; + rtapi_uint dx = myabs(px-cx); + rtapi_uint dy = myabs(py-cy); + rtapi_uint dz = myabs(pz-cz); + rtapi_uint d2 = dx*dx + dy*dy; + rtapi_uint r2 = r*r; if(d2 > r2) { probe_out_set(pz < cz); } else { diff --git a/src/hal/components/spindle.comp b/src/hal/components/spindle.comp index 11cc86faa9e..687c340a761 100644 --- a/src/hal/components/spindle.comp +++ b/src/hal/components/spindle.comp @@ -50,7 +50,7 @@ Each gear has individual control of speeds, acceleration, driver gain and direct see_also "*motion*(9)"; -pin in ui32 select-gear +pin in uint select-gear """Select a gear. Must be in the range 0 -> number of available gears -1. If you use this, do not use the select.x input pins."""; pin in real commanded-speed "Commanded spindle speed (in RPM)"; @@ -66,7 +66,7 @@ Uses the encoder input if available. If not, uses a simulated encoder speed."""; pin out real spindle-rpm-abs "Absolute spindle speed in RPM. Useful for spindle speed displays."; pin out real output "Scaled output"; -pin out ui32 current-gear "Currently selected gear."; +pin out uint current-gear "Currently selected gear."; pin out bool at-speed "TRUE when the spindle is at speed"; pin out bool forward "TRUE for forward rotation"; @@ -119,7 +119,7 @@ Selects this gear. If no select inputs are active, gear 0 is selected. If multiple select inputs are active then the highest is selected. """; -variable float ngears; +variable int ngears; variable gear_t gears[16]; function _; diff --git a/src/hal/components/spindle_monitor.comp b/src/hal/components/spindle_monitor.comp index bfa65e98acb..28423cce9d1 100644 --- a/src/hal/components/spindle_monitor.comp +++ b/src/hal/components/spindle_monitor.comp @@ -6,7 +6,7 @@ pin in real spindle-feedback; pin out bool spindle-at-speed; pin out bool spindle-underspeed; -param rw ui32 level "state machine state"; +param rw uint level "state machine state"; param rw real threshold; option period no; diff --git a/src/hal/components/stepgen.c b/src/hal/components/stepgen.c index f10612c2581..81c71551d20 100644 --- a/src/hal/components/stepgen.c +++ b/src/hal/components/stepgen.c @@ -331,9 +331,9 @@ RTAPI_MP_ARRAY_INT(user_step_type, MAX_CYCLE, typedef struct { /* stuff that is both read and written by makepulses */ - unsigned int timer1; /* times out when step pulse should end */ - unsigned int timer2; /* times out when safe to change dir */ - unsigned int timer3; /* times out when safe to step in new dir */ + rtapi_uint timer1; /* times out when step pulse should end */ + rtapi_uint timer2; /* times out when safe to change dir */ + rtapi_uint timer3; /* times out when safe to step in new dir */ int hold_dds; /* prevents accumulator from updating */ long addval; /* actual frequency generator add value */ volatile long long accum; /* frequency generator accumulator */ @@ -366,10 +366,10 @@ typedef struct { hal_real_t freq; /* param: frequency command */ hal_real_t maxvel; /* param: max velocity, (pos units/sec) */ hal_real_t maxaccel; /* param: max accel (pos units/sec^2) */ - rtapi_u32 old_step_len; /* used to detect parameter changes */ - rtapi_u32 old_step_space; - rtapi_u32 old_dir_hold_dly; - rtapi_u32 old_dir_setup; + rtapi_uint old_step_len; /* used to detect parameter changes */ + rtapi_uint old_step_space; + rtapi_uint old_dir_hold_dly; + rtapi_uint old_dir_setup; int printed_error; /* flag to avoid repeated printing */ } stepgen_t; @@ -512,7 +512,7 @@ int rtapi_app_main(void) } /* export functions */ retval = hal_export_funct("stepgen.make-pulses", make_pulses, - stepgen_array, 0, 0, comp_id); + stepgen_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STEPGEN: ERROR: makepulses funct export failed\n"); @@ -520,7 +520,7 @@ int rtapi_app_main(void) return -1; } retval = hal_export_funct("stepgen.update-freq", update_freq, - stepgen_array, 1, 0, comp_id); + stepgen_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STEPGEN: ERROR: freq update funct export failed\n"); @@ -528,7 +528,7 @@ int rtapi_app_main(void) return -1; } retval = hal_export_funct("stepgen.capture-position", update_pos, - stepgen_array, 1, 0, comp_id); + stepgen_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STEPGEN: ERROR: pos update funct export failed\n"); @@ -570,21 +570,21 @@ static void make_pulses(void *arg, long period) for (n = 0; n < num_chan; n++) { /* decrement "timing constraint" timers */ if ( stepgen->timer1 > 0 ) { - if ( stepgen->timer1 > periodns ) { + if ( stepgen->timer1 > (rtapi_uint)periodns ) { stepgen->timer1 -= periodns; } else { stepgen->timer1 = 0; } } if ( stepgen->timer2 > 0 ) { - if ( stepgen->timer2 > periodns ) { + if ( stepgen->timer2 > (rtapi_uint)periodns ) { stepgen->timer2 -= periodns; } else { stepgen->timer2 = 0; } } if ( stepgen->timer3 > 0 ) { - if ( stepgen->timer3 > periodns ) { + if ( stepgen->timer3 > (rtapi_uint)periodns ) { stepgen->timer3 -= periodns; } else { stepgen->timer3 = 0; @@ -635,7 +635,7 @@ static void make_pulses(void *arg, long period) /* we only care about the pickoff bit */ step_now &= (1L << PICKOFF); /* update rawcounts parameter */ - hal_set_si32(stepgen->rawcount, stepgen->accum >> PICKOFF); + hal_set_sint(stepgen->rawcount, stepgen->accum >> PICKOFF); } else { /* DDS is in hold, no steps */ step_now = 0; @@ -651,11 +651,11 @@ static void make_pulses(void *arg, long period) if ( step_now ) { /* (re)start various timers */ /* timer 1 = time till end of step pulse */ - stepgen->timer1 = hal_get_ui32(stepgen->step_len); + stepgen->timer1 = hal_get_uint(stepgen->step_len); /* timer 2 = time till allowed to change dir pin */ - stepgen->timer2 = stepgen->timer1 + hal_get_ui32(stepgen->dir_hold_dly); + stepgen->timer2 = stepgen->timer1 + hal_get_uint(stepgen->dir_hold_dly); /* timer 3 = time till allowed to step the other way */ - stepgen->timer3 = stepgen->timer2 + hal_get_ui32(stepgen->dir_setup); + stepgen->timer3 = stepgen->timer2 + hal_get_uint(stepgen->dir_setup); if ( stepgen->step_type >= 2 ) { /* update state */ stepgen->state += stepgen->curr_dir; @@ -721,7 +721,7 @@ static void update_pos(void *arg, long period) accum_b = stepgen->accum; } while ( accum_a != accum_b ); /* compute integer counts */ - hal_set_si32(stepgen->count, accum_a >> PICKOFF); + hal_set_sint(stepgen->count, accum_a >> PICKOFF); /* check for change in scale value */ rtapi_real pos_scale = hal_get_real(stepgen->pos_scale); if (pos_scale != stepgen->old_scale) { @@ -760,7 +760,7 @@ static void update_freq(void *arg, long period) { stepgen_t *stepgen; int n, newperiod; - long min_step_period; + rtapi_sint min_step_period; long long int accum_a, accum_b; double pos_cmd, vel_cmd, curr_pos, curr_vel, avg_v, max_freq, max_ac; double match_ac, match_time, est_out, est_cmd, est_err, dp, dv, new_vel; @@ -825,34 +825,34 @@ static void update_freq(void *arg, long period) stepgen->old_dir_setup = ~0; } /* process timing parameters */ - if ( hal_get_ui32(stepgen->step_len) != stepgen->old_step_len ) { + if ( hal_get_uint(stepgen->step_len) != stepgen->old_step_len ) { /* must be non-zero */ - if ( hal_get_ui32(stepgen->step_len) == 0 ) { - hal_set_ui32(stepgen->step_len, 1); + if ( hal_get_uint(stepgen->step_len) == 0 ) { + hal_set_uint(stepgen->step_len, 1); } /* make integer multiple of periodns */ - stepgen->old_step_len = ulceil(hal_get_ui32(stepgen->step_len), periodns); - hal_set_ui32(stepgen->step_len, stepgen->old_step_len); + stepgen->old_step_len = ulceil(hal_get_uint(stepgen->step_len), periodns); + hal_set_uint(stepgen->step_len, stepgen->old_step_len); } - if ( hal_get_ui32(stepgen->step_space) != stepgen->old_step_space ) { + if ( hal_get_uint(stepgen->step_space) != stepgen->old_step_space ) { /* make integer multiple of periodns */ - stepgen->old_step_space = ulceil(hal_get_ui32(stepgen->step_space), periodns); - hal_set_ui32(stepgen->step_space, stepgen->old_step_space); + stepgen->old_step_space = ulceil(hal_get_uint(stepgen->step_space), periodns); + hal_set_uint(stepgen->step_space, stepgen->old_step_space); } - if ( hal_get_ui32(stepgen->dir_setup) != stepgen->old_dir_setup ) { + if ( hal_get_uint(stepgen->dir_setup) != stepgen->old_dir_setup ) { /* make integer multiple of periodns */ - stepgen->old_dir_setup = ulceil(hal_get_ui32(stepgen->dir_setup), periodns); - hal_set_ui32(stepgen->dir_setup, stepgen->old_dir_setup); + stepgen->old_dir_setup = ulceil(hal_get_uint(stepgen->dir_setup), periodns); + hal_set_uint(stepgen->dir_setup, stepgen->old_dir_setup); } - if ( hal_get_ui32(stepgen->dir_hold_dly) != stepgen->old_dir_hold_dly ) { - if ( (hal_get_ui32(stepgen->dir_hold_dly) + hal_get_ui32(stepgen->dir_setup)) == 0 ) { + if ( hal_get_uint(stepgen->dir_hold_dly) != stepgen->old_dir_hold_dly ) { + if ( (hal_get_uint(stepgen->dir_hold_dly) + hal_get_uint(stepgen->dir_setup)) == 0 ) { /* dirdelay must be non-zero step types 0 and 1 */ if ( stepgen->step_type < 2 ) { - hal_set_ui32(stepgen->dir_hold_dly, 1); + hal_set_uint(stepgen->dir_hold_dly, 1); } } - stepgen->old_dir_hold_dly = ulceil(hal_get_ui32(stepgen->dir_hold_dly), periodns); - hal_set_ui32(stepgen->dir_hold_dly, stepgen->old_dir_hold_dly); + stepgen->old_dir_hold_dly = ulceil(hal_get_uint(stepgen->dir_hold_dly), periodns); + hal_set_uint(stepgen->dir_hold_dly, stepgen->old_dir_hold_dly); } /* test for disabled stepgen */ if (hal_get_bool(stepgen->enable) == 0) { @@ -869,7 +869,7 @@ static void update_freq(void *arg, long period) continue; } /* calculate frequency limit */ - min_step_period = hal_get_ui32(stepgen->step_len) + hal_get_ui32(stepgen->step_space); + min_step_period = hal_get_uint(stepgen->step_len) + hal_get_uint(stepgen->step_space); max_freq = 1.0 / (min_step_period * 0.000000001); /* check for user specified frequency limit parameter */ if (hal_get_real(stepgen->maxvel) <= 0.0) { @@ -1036,11 +1036,11 @@ static int export_stepgen(int num, stepgen_t * addr, int step_type, int pos_mode rtapi_set_msg_level(RTAPI_MSG_WARN); /* export param variable for raw counts */ - retval = hal_param_new_si32(comp_id, HAL_RO, &(addr->rawcount), 0, + retval = hal_param_new_sint(comp_id, HAL_RO, &(addr->rawcount), 0, "stepgen.%d.rawcounts", num); if (retval != 0) { return retval; } /* export pin for counts captured by update() */ - retval = hal_pin_new_si32(comp_id, HAL_OUT, &(addr->count), 0, + retval = hal_pin_new_sint(comp_id, HAL_OUT, &(addr->count), 0, "stepgen.%d.counts", num); if (retval != 0) { return retval; } /* export parameter for position scaling */ @@ -1077,12 +1077,12 @@ static int export_stepgen(int num, stepgen_t * addr, int step_type, int pos_mode "stepgen.%d.maxaccel", num); if (retval != 0) { return retval; } /* every step type uses steplen */ - retval = hal_param_new_ui32(comp_id, HAL_RW, &(addr->step_len), 1, + retval = hal_param_new_uint(comp_id, HAL_RW, &(addr->step_len), 1, "stepgen.%d.steplen", num); if (retval != 0) { return retval; } if (step_type < 2) { /* step/dir and up/down use 'stepspace' */ - retval = hal_param_new_ui32(comp_id, HAL_RW, &(addr->step_space), + retval = hal_param_new_uint(comp_id, HAL_RW, &(addr->step_space), 1, "stepgen.%d.stepspace", num); if (retval != 0) { return retval; } } else { @@ -1092,10 +1092,10 @@ static int export_stepgen(int num, stepgen_t * addr, int step_type, int pos_mode } if ( step_type == 0 ) { /* step/dir is the only one that uses dirsetup and dirhold */ - retval = hal_param_new_ui32(comp_id, HAL_RW, &(addr->dir_setup), + retval = hal_param_new_uint(comp_id, HAL_RW, &(addr->dir_setup), 1, "stepgen.%d.dirsetup", num); if (retval != 0) { return retval; } - retval = hal_param_new_ui32(comp_id, HAL_RW, &(addr->dir_hold_dly), + retval = hal_param_new_uint(comp_id, HAL_RW, &(addr->dir_hold_dly), 1, "stepgen.%d.dirhold", num); if (retval != 0) { return retval; } } else { @@ -1103,7 +1103,7 @@ static int export_stepgen(int num, stepgen_t * addr, int step_type, int pos_mode retval = hal_param_new_fake(comp_id, (hal_refs_u *)&(addr->dir_setup)); if (retval != 0) { return retval; } /* the others use dirdelay */ - retval = hal_param_new_ui32(comp_id, HAL_RW, &(addr->dir_hold_dly), + retval = hal_param_new_uint(comp_id, HAL_RW, &(addr->dir_hold_dly), 1, "stepgen.%d.dirdelay", num); if (retval != 0) { return retval; } } diff --git a/src/hal/components/steptest.comp b/src/hal/components/steptest.comp index 422b4e1a45c..be7d12f3d2f 100644 --- a/src/hal/components/steptest.comp +++ b/src/hal/components/steptest.comp @@ -6,7 +6,7 @@ pin in bool run "Drive TRUE to run the axis near its current position_fb with a pin in real maxvel "Maximum velocity"; pin in real maxaccel "Permitted Acceleration"; pin in real amplitude "Approximate amplitude of positions to command during 'run'"; -pin in si32 dir "Direction from central point to test: 0 = both, 1 = positive, 2 = negative"; +pin in sint dir "Direction from central point to test: 0 = both, 1 = positive, 2 = negative"; pin out real position-cmd; pin in real position-fb; pin out bool running; @@ -14,11 +14,11 @@ pin out real run-target; pin out real run-start; pin out real run-low; pin out real run-high; -pin in si32 pause = 0 "pause time for each end of run in seconds"; +pin in sint pause = 0 "pause time for each end of run in seconds"; param rw real epsilon = .001; variable rtapi_real timer; param r real elapsed "Current value of the internal timer"; -variable int timer_on; +variable rtapi_sint timer_on; function _; license "GPL"; author "Jeff Epler"; diff --git a/src/hal/components/streamer.c b/src/hal/components/streamer.c index 7c1d7714f52..12b2d363abf 100644 --- a/src/hal/components/streamer.c +++ b/src/hal/components/streamer.c @@ -224,8 +224,6 @@ static void update(void *arg, long period) for (int n = 0; n < num_pins; n++) { switch ( hal_stream_element_type(&str->fifo, n) ) { case HAL_REAL: hal_set_real(str->pins[n].r, data[n].f); break; - case HAL_S32: hal_set_si32(str->pins[n].s, data[n].s); break; - case HAL_U32: hal_set_ui32(str->pins[n].u, data[n].u); break; case HAL_SINT: hal_set_sint(str->pins[n].s, data[n].l); break; case HAL_UINT: hal_set_uint(str->pins[n].u, data[n].k); break; case HAL_BOOL: hal_set_bool(str->pins[n].b, data[n].b); break; @@ -277,8 +275,6 @@ static int init_streamer(int num, streamer_t *str) int type; switch(type = hal_stream_element_type(&str->fifo, n)) { case HAL_REAL: retval = hal_pin_new_real(comp_id, HAL_OUT, &str->pins[n].r, 0.0, pstr, num, n); break; - case HAL_S32: retval = hal_pin_new_si32(comp_id, HAL_OUT, &str->pins[n].s, 0, pstr, num, n); break; - case HAL_U32: retval = hal_pin_new_ui32(comp_id, HAL_OUT, &str->pins[n].u, 0, pstr, num, n); break; case HAL_SINT: retval = hal_pin_new_sint(comp_id, HAL_OUT, &str->pins[n].s, 0, pstr, num, n); break; case HAL_UINT: retval = hal_pin_new_uint(comp_id, HAL_OUT, &str->pins[n].u, 0, pstr, num, n); break; case HAL_BOOL: retval = hal_pin_new_bool(comp_id, HAL_OUT, &str->pins[n].b, 0, pstr, num, n); break; @@ -292,7 +288,7 @@ static int init_streamer(int num, streamer_t *str) } } /* export update function */ - retval = hal_export_functf(update, str, 1, 0, comp_id, "%s%d", strbase, num); + retval = hal_export_functf(update, str, 0, comp_id, "%s%d", strbase, num); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "STREAMER: ERROR: function export failed\n"); return retval; diff --git a/src/hal/components/streamer_usr.c b/src/hal/components/streamer_usr.c index bbbf632b1b6..2ba5d9168f1 100644 --- a/src/hal/components/streamer_usr.c +++ b/src/hal/components/streamer_usr.c @@ -201,12 +201,6 @@ int main(int argc, char **argv) cp2 = cp; } break; - case HAL_U32: - dptr->u = strtoul(cp, &cp2, 10); - break; - case HAL_S32: - dptr->s = strtol(cp, &cp2, 10); - break; case HAL_UINT: dptr->k = strtoull(cp, &cp2, 10); break; diff --git a/src/hal/components/sum2.comp b/src/hal/components/sum2.comp index 387ac548572..25fbf4588f3 100644 --- a/src/hal/components/sum2.comp +++ b/src/hal/components/sum2.comp @@ -1,5 +1,5 @@ component sum2 "Sum of two inputs (each with a gain) and an offset"; -see_also "scaled_s32_sums(9), weighted_sum(9)"; +see_also "scaled_sint_sums(9), weighted_sum(9)"; pin in real in0; pin in real in1; param rw real gain0 = 1.0; diff --git a/src/hal/components/supply.c b/src/hal/components/supply.c index 8591cbe865f..5412225f67e 100644 --- a/src/hal/components/supply.c +++ b/src/hal/components/supply.c @@ -190,7 +190,7 @@ static int export_supply(int num, hal_supply_t * addr) } /* export function for this loop */ retval = - hal_export_functf(update_supply, &(supply_array[num]), 1, 0, + hal_export_functf(update_supply, &(supply_array[num]), 0, comp_id, "supply.%d.update", num); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, diff --git a/src/hal/components/threads.c b/src/hal/components/threads.c index f5b58a83569..1ca51f190f9 100644 --- a/src/hal/components/threads.c +++ b/src/hal/components/threads.c @@ -107,7 +107,7 @@ int rtapi_app_main(void) /* was 'period' specified in the insmod command? */ if ((period1 > 0) && (name1 != NULL) && (*name1 != '\0')) { /* create a thread */ - thread1_id = hal_create_thread(name1, period1, 1); + thread1_id = hal_create_thread(name1, period1); if (thread1_id < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "THREADS: ERROR: could not create thread '%s'\n", name1); @@ -119,7 +119,7 @@ int rtapi_app_main(void) } if ((period2 > 0) && (name2 != NULL) && (*name2 != '\0')) { /* create a thread */ - thread2_id = hal_create_thread(name2, period2, 1); + thread2_id = hal_create_thread(name2, period2); if (thread2_id < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "THREADS: ERROR: could not create thread '%s'\n", name2); @@ -132,7 +132,7 @@ int rtapi_app_main(void) } if ((period3 > 0) && (name3 != NULL) && (*name3 != '\0')) { /* create a thread */ - thread3_id = hal_create_thread(name3, period3, 1); + thread3_id = hal_create_thread(name3, period3); if (thread3_id < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "THREADS: ERROR: could not create thread '%s'\n", name3); diff --git a/src/hal/components/threadtest.comp b/src/hal/components/threadtest.comp index 50c20772ca6..79b523f18c7 100644 --- a/src/hal/components/threadtest.comp +++ b/src/hal/components/threadtest.comp @@ -1,5 +1,5 @@ component threadtest "LinuxCNC HAL component for testing thread behavior"; -pin out ui32 count; +pin out uint count; option period no; function increment; function reset; diff --git a/src/hal/components/time.comp b/src/hal/components/time.comp index 2aa4061c5c3..096d3f56b5f 100644 --- a/src/hal/components/time.comp +++ b/src/hal/components/time.comp @@ -24,29 +24,29 @@ Sample PyVCP code to display the hours:minutes:seconds. "Cycle Time" ("Helvetica",14) - + "time-hours" ("Helvetica",14) "2d" - + - + "time-minutes" ("Helvetica",14) "2d" - + - + "time-seconds" ("Helvetica",14) "2d" - + ---- @@ -104,13 +104,13 @@ pin in bool start "Timer On"; pin in bool pause = 0 "Pause"; // Output Pins -pin out ui32 seconds "Seconds"; -pin out ui32 minutes "Minutes"; -pin out ui32 hours "Hours"; +pin out uint seconds "Seconds"; +pin out uint minutes "Minutes"; +pin out uint hours "Hours"; // Global Variables variable rtapi_real totalnsec; -variable int old_start; +variable rtapi_bool old_start; function _; @@ -118,8 +118,8 @@ function _; FUNCTION(_) { - rtapi_u32 totalseconds; - int running = start || pause; + rtapi_uint totalseconds; + rtapi_bool running = start || pause; if(running && !old_start) totalnsec = 0; if(start && !pause){ diff --git a/src/hal/components/timedelta.comp b/src/hal/components/timedelta.comp index c43fcc58b18..027f3d7abdb 100644 --- a/src/hal/components/timedelta.comp +++ b/src/hal/components/timedelta.comp @@ -1,20 +1,20 @@ component timedelta "LinuxCNC HAL component that measures thread scheduling timing behavior"; -pin out si32 jitter=0 "Worst-case scheduling error (in ns). This is the largest discrepancy between ideal thread period, and actual time between sequential runs of this component. This uses the absolute value of the error, so 'got run too early' and 'got run too late' both show up as positive jitter."; +pin out sint jitter=0 "Worst-case scheduling error (in ns). This is the largest discrepancy between ideal thread period, and actual time between sequential runs of this component. This uses the absolute value of the error, so 'got run too early' and 'got run too late' both show up as positive jitter."; -pin out si32 current_jitter=0 "Scheduling error (in ns) of the current invocation. This is the discrepancy between ideal thread period, and actual time since the previous run of this component. This uses the absolute value of the error, so 'got run too early' and 'got run too late' both show up as positive jitter."; +pin out sint current_jitter=0 "Scheduling error (in ns) of the current invocation. This is the discrepancy between ideal thread period, and actual time since the previous run of this component. This uses the absolute value of the error, so 'got run too early' and 'got run too late' both show up as positive jitter."; -pin out si32 current_error=0 "Scheduling error (in ns) of the current invocation. This is the discrepancy between ideal thread period, and actual time since the previous run of this component. This does not use the absolute value of the error, so 'got run too early' shows up as negative error and 'got run too late' shows up as positive error."; +pin out sint current_error=0 "Scheduling error (in ns) of the current invocation. This is the discrepancy between ideal thread period, and actual time since the previous run of this component. This does not use the absolute value of the error, so 'got run too early' shows up as negative error and 'got run too late' shows up as positive error."; -pin out si32 min_=0 "Minimum time (in ns) between sequential runs of this component."; +pin out sint min_=0 "Minimum time (in ns) between sequential runs of this component."; -pin out si32 max_=0 "Maximum time (in ns) between sequential runs of this component."; +pin out sint max_=0 "Maximum time (in ns) between sequential runs of this component."; pin in bool reset "Set this pin to True, then back to False, to reset some of the statistics."; -pin out si32 out "Time (in ns) since the previous run of this component. This should ideally be equal to the thread period."; +pin out sint out "Time (in ns) since the previous run of this component. This should ideally be equal to the thread period."; -pin out si32 err=0 "Cumulative time error (in ns). Probably not useful."; +pin out sint err=0 "Cumulative time error (in ns). Probably not useful."; pin out real avg_err=0 "The average scheduling error (in ns)."; diff --git a/src/hal/components/toggle.comp b/src/hal/components/toggle.comp index f8dbb86628c..083556dfe8a 100644 --- a/src/hal/components/toggle.comp +++ b/src/hal/components/toggle.comp @@ -14,7 +14,7 @@ out: └─────┘           └───── pin in bool in "button input"; pin io bool out "on/off output"; -param rw ui32 debounce = 2 "debounce delay in periods"; +param rw uint debounce = 2 "debounce delay in periods"; option data toggle_data; option period no; @@ -29,7 +29,7 @@ typedef struct { } toggle_data; FUNCTION(_) { - rtapi_u32 deb = debounce; + rtapi_uint deb = debounce; if (( deb < 1 ) || ( deb > 10000 )) { /* set a sane value, we don't want 2 million second delays */ debounce_set(deb = 2); diff --git a/src/hal/components/toggle2nist.comp b/src/hal/components/toggle2nist.comp index 9c164425f21..a8605314899 100644 --- a/src/hal/components/toggle2nist.comp +++ b/src/hal/components/toggle2nist.comp @@ -30,12 +30,12 @@ is-on: └─────────────────┘        pin in bool in "toggle button in"; pin in bool is_on "current state of device"; -pin in ui32 debounce = 2 "debounce delay for 'in'-pin in cycles"; -pin in ui32 max_pulse_length = 100 "max output pulse length"; +pin in uint debounce = 2 "debounce delay for 'in'-pin in cycles"; +pin in uint max_pulse_length = 100 "max output pulse length"; pin out bool on "turn device on"; pin out bool off "turn device off"; -variable unsigned debounce_cntr; -variable unsigned pulse_length; +variable rtapi_uint debounce_cntr; +variable rtapi_uint pulse_length; variable bool state; option period no; diff --git a/src/hal/components/updown.comp b/src/hal/components/updown.comp index 51bea6764be..9d6a1633648 100644 --- a/src/hal/components/updown.comp +++ b/src/hal/components/updown.comp @@ -2,11 +2,11 @@ component updown "Counts up or down, with optional limits and wraparound behavio pin in bool countup "Increment count when this pin goes from 0 to 1"; pin in bool countdown "Decrement count when this pin goes from 0 to 1"; pin in bool reset "Reset count when this pin goes from 0 to 1"; -pin out si32 count "The current count"; +pin out sint count "The current count"; param rw bool clamp_ "If TRUE, then clamp the output to the min and max parameters."; param rw bool wrap "If TRUE, then wrap around when the count goes above or below the min and max parameters. Note that wrap implies (and overrides) clamp."; -param rw si32 max_ = 0x7FFFFFFF "If clamp or wrap is set, count will never exceed this number"; -param rw si32 min_ "If clamp or wrap is set, count will never be less than this number"; +param rw sint max_ = 0x7FFFFFFF "If clamp or wrap is set, count will never exceed this number"; +param rw sint min_ "If clamp or wrap is set, count will never be less than this number"; variable int oldup; variable int olddown; variable int first = 1; @@ -18,7 +18,7 @@ author "Stephen Wille Padnos"; ;; FUNCTION(_) { - rtapi_s32 temp_count = count; + rtapi_sint temp_count = count; if (first) { oldup=countup; olddown=countdown; diff --git a/src/hal/components/userkins.comp b/src/hal/components/userkins.comp index a2a25d88c29..5ecf3f2ff20 100644 --- a/src/hal/components/userkins.comp +++ b/src/hal/components/userkins.comp @@ -59,7 +59,7 @@ change all instances of `userkins` to `mykins`. """; // The fpin pin is not accessible in kinematics functions. // Use the *_setup() function for pins and params used by kinematics. -pin out si32 fpin=0"pin to demonstrate use of a conventional (non-kinematics) function fdemo"; +pin out sint fpin=0"pin to demonstrate use of a conventional (non-kinematics) function fdemo"; option period no; function fdemo; license "GPL"; diff --git a/src/hal/components/watchdog.c b/src/hal/components/watchdog.c index 13184352209..4bb7553b3f0 100644 --- a/src/hal/components/watchdog.c +++ b/src/hal/components/watchdog.c @@ -148,14 +148,14 @@ int rtapi_app_main(void) } /* export functions */ - retval = hal_export_funct("watchdog.process", process, inputs, 0, 0, comp_id); + retval = hal_export_funct("watchdog.process", process, inputs, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "WATCHDOG: ERROR: process funct export failed\n"); goto err; } - retval = hal_export_funct("watchdog.set-timeouts", set_timeouts, inputs, 1, 0, comp_id); + retval = hal_export_funct("watchdog.set-timeouts", set_timeouts, inputs, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "WATCHDOG: ERROR: set_timeouts funct export failed\n"); diff --git a/src/hal/components/weighted_sum.c b/src/hal/components/weighted_sum.c index d28b2aa0a26..d5ee724846a 100644 --- a/src/hal/components/weighted_sum.c +++ b/src/hal/components/weighted_sum.c @@ -5,9 +5,9 @@ * See the "Users Manual" at emc2/docs/Hal_Introduction.pdf * * This component is a "weighted summer". It has a (user specified) -* number of HAL_BIT input pins, and a HAL_S32 parameter corresponding +* number of HAL_BOOL input pins, and a HAL_SINT parameter corresponding * to each bit input. -* There is one HAL_S32 output. The output value is the sum of the +* There is one HAL_SINT output. The output value is the sum of the * parameters for which the corresponding bit input is true. * * The default value for the parameters is 2^n, where n is the bit number. @@ -144,7 +144,7 @@ int rtapi_app_main(void) } /* export update function */ - retval = hal_export_funct("process_wsums", process_wsums, wsum_array, 1, 0, comp_id); + retval = hal_export_funct("process_wsums", process_wsums, wsum_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "WEIGHTED_SUM: ERROR: process_wsums funct export failed\n"); @@ -182,14 +182,14 @@ static void process_wsums(void *arg, long period) thissum = &(wsums[n]); if (hal_get_bool(thissum->hold)) continue; else { - running_total = hal_get_si32(thissum->offset); + running_total = hal_get_sint(thissum->offset); for (b=0 ; bnum_bits ; b++) { if (hal_get_bool(thissum->bits[b].bit)) { - running_total += hal_get_si32(thissum->bits[b].weight); + running_total += hal_get_sint(thissum->bits[b].weight); } } } - hal_set_si32(thissum->sum, running_total); + hal_set_sint(thissum->sum, running_total); } } @@ -204,14 +204,14 @@ static int export_wsum(int num, int num_bits, wsum_t *addr, wsum_bit_t *bitaddr) /* export pin for offset (input) */ rtapi_snprintf(base, sizeof(base), "wsum.%d", num); - retval = hal_pin_new_si32(comp_id, HAL_IO, &(addr->offset), 0, "%s.offset", base); + retval = hal_pin_new_sint(comp_id, HAL_IO, &(addr->offset), 0, "%s.offset", base); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "WEIGHTED_SUM: ERROR: '%s.offset' param export failed\n", base); return retval; } /* export pin for output sum */ - retval = hal_pin_new_si32(comp_id, HAL_OUT, &(addr->sum), 0, "%s.sum", base); + retval = hal_pin_new_sint(comp_id, HAL_OUT, &(addr->sum), 0, "%s.sum", base); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "WEIGHTED_SUM: ERROR: '%s.sum' pin export failed\n", base); return retval; @@ -234,7 +234,7 @@ static int export_wsum(int num, int num_bits, wsum_t *addr, wsum_bit_t *bitaddr) rtapi_print_msg(RTAPI_MSG_ERR, "WEIGHTED_SUM: ERROR: '%s.bit.%d.in' pin export failed\n", base, i); return retval; } - retval = hal_pin_new_si32(comp_id, HAL_IO, &(addr->bits[i].weight), w, "%s.bit.%d.weight", base, i); + retval = hal_pin_new_sint(comp_id, HAL_IO, &(addr->bits[i].weight), w, "%s.bit.%d.weight", base, i); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "WEIGHTED_SUM: ERROR: '%s.bit.%d.weight' param export failed\n", base, i); return retval; diff --git a/src/hal/components/xhc_hb04_util.comp b/src/hal/components/xhc_hb04_util.comp index f52a4d04d73..673fb4f11a6 100644 --- a/src/hal/components/xhc_hb04_util.comp +++ b/src/hal/components/xhc_hb04_util.comp @@ -17,14 +17,14 @@ pin out bool resume; pin out bool run; // integer low pass filters (see ilowpass.comp) -pin in si32 in0; -pin in si32 in1; -pin in si32 in2; -pin in si32 in3; -pin out si32 out0; -pin out si32 out1; -pin out si32 out2; -pin out si32 out3; +pin in sint in0; +pin in sint in1; +pin in sint in2; +pin in sint in3; +pin out sint out0; +pin out sint out1; +pin out sint out2; +pin out sint out3; pin in real scale0 = 1.0; pin in real scale1 = 1.0; pin in real scale2 = 1.0; diff --git a/src/hal/components/xyzab_tdr_kins.comp b/src/hal/components/xyzab_tdr_kins.comp index b059f32c103..954a4f30642 100644 --- a/src/hal/components/xyzab_tdr_kins.comp +++ b/src/hal/components/xyzab_tdr_kins.comp @@ -30,7 +30,7 @@ chapter (docs/src/motion/switchkins.txt) """; -pin out si32 dummy=0"one pin needed to satisfy halcompile requirement"; +pin out sint dummy=0"one pin needed to satisfy halcompile requirement"; license "GPL"; author "David Mueller"; diff --git a/src/hal/components/xyzacb_trsrn.comp b/src/hal/components/xyzacb_trsrn.comp index 321d45584e5..456491b7466 100644 --- a/src/hal/components/xyzacb_trsrn.comp +++ b/src/hal/components/xyzacb_trsrn.comp @@ -5,7 +5,7 @@ description FIXME """; -pin out si32 dummy=0 "dummy pin to satisfy halcompile"; +pin out sint dummy=0 "dummy pin to satisfy halcompile"; option period no; option extra_setup; diff --git a/src/hal/components/xyzbca_trsrn.comp b/src/hal/components/xyzbca_trsrn.comp index 371349d2365..869734c9502 100644 --- a/src/hal/components/xyzbca_trsrn.comp +++ b/src/hal/components/xyzbca_trsrn.comp @@ -5,7 +5,7 @@ description FIXME """; -pin out si32 dummy=0 "dummy pin to satisfy halcompile"; +pin out sint dummy=0 "dummy pin to satisfy halcompile"; option period no; option extra_setup; diff --git a/src/hal/drivers/hal_bb_gpio.c b/src/hal/drivers/hal_bb_gpio.c index e1a23f3a5e9..d59e78cd306 100644 --- a/src/hal/drivers/hal_bb_gpio.c +++ b/src/hal/drivers/hal_bb_gpio.c @@ -345,14 +345,14 @@ int rtapi_app_main(void) { // export functions - retval = hal_export_funct("bb_gpio.write", write_port, port_data, 0, 0, comp_id); + retval = hal_export_funct("bb_gpio.write", write_port, port_data, 0, comp_id); if(retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "%s: ERROR: port %d write funct export failed\n", modname, n); hal_exit(comp_id); return -1; } - retval = hal_export_funct("bb_gpio.read", read_port, port_data, 0, 0, comp_id); + retval = hal_export_funct("bb_gpio.read", read_port, port_data, 0, comp_id); if(retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "%s: ERROR: port %d read funct export failed\n", modname, n); hal_exit(comp_id); diff --git a/src/hal/drivers/hal_gm.c b/src/hal/drivers/hal_gm.c index 5940aa3bc85..0e7b02ccffb 100644 --- a/src/hal/drivers/hal_gm.c +++ b/src/hal/drivers/hal_gm.c @@ -1072,16 +1072,16 @@ static int ExportFunctions(void *arg, int comp_id, int boardId) int error; gm_device_t *device = (gm_device_t *)arg; - error = hal_export_functf(write, device, 1, 0, comp_id, "gm.%d.write", boardId); + error = hal_export_functf(write, device, 0, comp_id, "gm.%d.write", boardId); if(error == 0) { - error = hal_export_functf(read, device, 1, 0, comp_id, "gm.%d.read", boardId); + error = hal_export_functf(read, device, 0, comp_id, "gm.%d.read", boardId); } if(error == 0) { - error = hal_export_functf(RS485, device, 1, 0, comp_id, "gm.%d.RS485", boardId); + error = hal_export_functf(RS485, device, 0, comp_id, "gm.%d.RS485", boardId); } return error; diff --git a/src/hal/drivers/hal_gpio.c b/src/hal/drivers/hal_gpio.c index bcac7c27c02..12e742c908c 100644 --- a/src/hal/drivers/hal_gpio.c +++ b/src/hal/drivers/hal_gpio.c @@ -446,15 +446,15 @@ rtapi_print_msg(RTAPI_MSG_INFO, "Libgpiod is %i\n", LIBGPIOD_VER); } rtapi_snprintf(hal_name, HAL_NAME_LEN, "hal_gpio.read"); - retval += hal_export_funct(hal_name, hal_gpio_read, gpio, 0, 0, comp_id); + retval += hal_export_funct(hal_name, hal_gpio_read, gpio, 0, comp_id); rtapi_snprintf(hal_name, HAL_NAME_LEN, "hal_gpio.write"); - retval += hal_export_funct(hal_name, hal_gpio_write, gpio, 0, 0, comp_id); + retval += hal_export_funct(hal_name, hal_gpio_write, gpio, 0, comp_id); if (reset_active){ gpio->reset_ns = hal_malloc(sizeof(*gpio->reset_ns)); rtapi_snprintf(hal_name, HAL_NAME_LEN, "hal_gpio.reset"); retval += hal_param_new_ui32(comp_id, HAL_RW, gpio->reset_ns, 0, "hal_gpio.reset_ns"); - retval += hal_export_funct(hal_name, hal_gpio_reset, gpio, 0, 0, comp_id); + retval += hal_export_funct(hal_name, hal_gpio_reset, gpio, 0, comp_id); } if (retval < 0){ rtapi_print_msg(RTAPI_MSG_ERR, "hal_gpio: failed to export functions\n"); diff --git a/src/hal/drivers/hal_parport.c b/src/hal/drivers/hal_parport.c index 3e4c43f4ca4..9a84f4376ef 100644 --- a/src/hal/drivers/hal_parport.c +++ b/src/hal/drivers/hal_parport.c @@ -239,7 +239,7 @@ rtapi_print ( "config string '%s'\n", cfg ); for (n = 0; n < num_ports; n++) { /* export read function */ retval = hal_export_functf(read_port, &(port_data_array[n]), - 0, 0, comp_id, "parport.%d.read", n); + 0, comp_id, "parport.%d.read", n); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PARPORT: ERROR: port %d read funct export failed\n", n); @@ -248,7 +248,7 @@ rtapi_print ( "config string '%s'\n", cfg ); } /* export write function */ retval = hal_export_functf(write_port, &(port_data_array[n]), - 0, 0, comp_id, "parport.%d.write", n); + 0, comp_id, "parport.%d.write", n); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PARPORT: ERROR: port %d write funct export failed\n", n); @@ -257,7 +257,7 @@ rtapi_print ( "config string '%s'\n", cfg ); } /* export write function */ retval = hal_export_functf(reset_port, &(port_data_array[n]), - 0, 0, comp_id, "parport.%d.reset", n); + 0, comp_id, "parport.%d.reset", n); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PARPORT: ERROR: port %d reset funct export failed\n", n); @@ -267,7 +267,7 @@ rtapi_print ( "config string '%s'\n", cfg ); } /* export functions that read and write all ports */ retval = hal_export_funct("parport.read-all", read_all, - port_data_array, 0, 0, comp_id); + port_data_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PARPORT: ERROR: read all funct export failed\n"); @@ -275,7 +275,7 @@ rtapi_print ( "config string '%s'\n", cfg ); return -1; } retval = hal_export_funct("parport.write-all", write_all, - port_data_array, 0, 0, comp_id); + port_data_array, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PARPORT: ERROR: write all funct export failed\n"); @@ -350,10 +350,10 @@ static void reset_port(void *arg, long period) { long long deadline; unsigned char outdata = (unsigned char)((port->outdata&~port->reset_mask) ^ port->reset_val); - if(hal_get_ui32(port->reset_time) > period/4) hal_set_ui32(port->reset_time, period/4); + if((rtapi_sint)hal_get_uint(port->reset_time) > period/4) hal_set_uint(port->reset_time, period/4); if(outdata != port->outdata) { - deadline = port->write_time + hal_get_ui32(port->reset_time); + deadline = port->write_time + hal_get_uint(port->reset_time); while(rtapi_get_time() < deadline) {} rtapi_outb(outdata, port->base_addr); port->outdata = outdata; @@ -362,7 +362,7 @@ static void reset_port(void *arg, long period) { outdata = (unsigned char)((port->outdata_ctrl&~port->reset_mask_ctrl)^port->reset_val_ctrl); if(outdata != port->outdata_ctrl) { - deadline = port->write_time_ctrl + hal_get_ui32(port->reset_time); + deadline = port->write_time_ctrl + hal_get_uint(port->reset_time); while(rtapi_get_time() < deadline) {} /* correct for hardware inverters on pins 1, 14, & 17 */ rtapi_outb(outdata ^ 0x0B, port->base_addr + 2); @@ -689,11 +689,11 @@ static int export_port(int portnum, parport_t * port) port->data_out, port->data_inv, port->data_reset, 6); retval += export_output_pin(portnum, 9, port->data_out, port->data_inv, port->data_reset, 7); - retval += hal_param_new_ui32(comp_id, HAL_RW, &port->reset_time, 0, + retval += hal_param_new_uint(comp_id, HAL_RW, &port->reset_time, 0, "parport.%d.reset-time", portnum); - retval += hal_param_new_ui32(comp_id, HAL_RW, &port->debug1, 0, + retval += hal_param_new_uint(comp_id, HAL_RW, &port->debug1, 0, "parport.%d.debug1", portnum); - retval += hal_param_new_ui32(comp_id, HAL_RW, &port->debug2, 0, + retval += hal_param_new_uint(comp_id, HAL_RW, &port->debug2, 0, "parport.%d.debug2", portnum); port->write_time = 0; } diff --git a/src/hal/drivers/hal_pi_gpio.c b/src/hal/drivers/hal_pi_gpio.c index 3c4abeb3c53..10e6071ab78 100644 --- a/src/hal/drivers/hal_pi_gpio.c +++ b/src/hal/drivers/hal_pi_gpio.c @@ -330,16 +330,14 @@ int rtapi_app_main(void) return -1; } - retval = hal_export_funct("hal_pi_gpio.write", write_port, 0, - 0, 0, comp_id); + retval = hal_export_funct("hal_pi_gpio.write", write_port, 0, 0, comp_id); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "HAL_PI_GPIO: ERROR: write funct export failed\n"); hal_exit(comp_id); return -1; } - retval = hal_export_funct("hal_pi_gpio.read", read_port, 0, - 0, 0, comp_id); + retval = hal_export_funct("hal_pi_gpio.read", read_port, 0, 0, comp_id); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "HAL_PI_GPIO: ERROR: read funct export failed\n"); diff --git a/src/hal/drivers/hal_ppmc.c b/src/hal/drivers/hal_ppmc.c index 89b3a259753..3d3e9981ade 100644 --- a/src/hal/drivers/hal_ppmc.c +++ b/src/hal/drivers/hal_ppmc.c @@ -732,7 +732,7 @@ int rtapi_app_main(void) } /* export functions */ rv1 = hal_export_functf(read_all, &(bus_array[busnum]), - 1, 0, comp_id, "ppmc.%d.read", busnum); + 0, comp_id, "ppmc.%d.read", busnum); if (rv1 != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PPMC: ERROR: read funct export failed\n"); @@ -741,7 +741,7 @@ int rtapi_app_main(void) continue; } rv1 = hal_export_functf(write_all, &(bus_array[busnum]), - 1, 0, comp_id, "ppmc.%d.write", busnum); + 0, comp_id, "ppmc.%d.write", busnum); if (rv1 != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "PPMC: ERROR: write funct export failed\n"); diff --git a/src/hal/drivers/hal_speaker.c b/src/hal/drivers/hal_speaker.c index c4e30db1abd..d649cf1fddb 100644 --- a/src/hal/drivers/hal_speaker.c +++ b/src/hal/drivers/hal_speaker.c @@ -194,7 +194,7 @@ int rtapi_app_main(void) /* STEP 4: export write function */ retval = - hal_export_functf(write_port, &(port_data_array[n]), 0, 0, + hal_export_functf(write_port, &(port_data_array[n]), 0, comp_id, "speaker.%d.write", n); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, diff --git a/src/hal/drivers/mesa-hostmot2/abs_encoder.c b/src/hal/drivers/mesa-hostmot2/abs_encoder.c index 73ded3dab18..5b7b954bbb9 100644 --- a/src/hal/drivers/mesa-hostmot2/abs_encoder.c +++ b/src/hal/drivers/mesa-hostmot2/abs_encoder.c @@ -126,7 +126,7 @@ int hm2_absenc_register_tram(hostmot2_t *hm2){ if (hm2->config.num_dplls == 0){ hal_export_functf(hm2_absenc_trigger, - hm2, 0, 0,hm2->llio->comp_id, "%s.trigger-encoders", hm2->llio->name); + hm2, 0, hm2->llio->comp_id, "%s.trigger-encoders", hm2->llio->name); funct_flag = true; } diff --git a/src/hal/drivers/mesa-hostmot2/hm2_eth.c b/src/hal/drivers/mesa-hostmot2/hm2_eth.c index 5dbf3cfae9a..76766382041 100644 --- a/src/hal/drivers/mesa-hostmot2/hm2_eth.c +++ b/src/hal/drivers/mesa-hostmot2/hm2_eth.c @@ -1712,7 +1712,7 @@ int rtapi_app_main(void) { *added = 1; } - hal_export_functf(init_board_realtime_all, 0, 0, 0, comp_id, "%s.realtime-init", HM2_LLIO_NAME); + hal_export_functf(init_board_realtime_all, 0, 0, comp_id, "%s.realtime-init", HM2_LLIO_NAME); hal_ready(comp_id); diff --git a/src/hal/drivers/mesa-hostmot2/hm2_modbus.c b/src/hal/drivers/mesa-hostmot2/hm2_modbus.c index 251bfef219d..01b982cc5e9 100644 --- a/src/hal/drivers/mesa-hostmot2/hm2_modbus.c +++ b/src/hal/drivers/mesa-hostmot2/hm2_modbus.c @@ -1459,13 +1459,6 @@ static int build_data_frame(hm2_modbus_inst_t *inst) case HAL_BOOL: CHK_RV(map_u(cc, hal_get_bool(hal->pins[p].pin.b) ? 1 : 0, 0)); break; - case HAL_U32: - switch(mtypetype(cc->typeptr[0].mtype)) { - case MBT_U: CHK_RV(map_u(cc, hal_get_ui32(hal->pins[p].pin.u), 0)); break; - case MBT_S: CHK_RV(map_s(cc, map_us(hal_get_ui32(hal->pins[p].pin.u)), 0)); break; - case MBT_F: CHK_RV(map_f(cc, map_uf(hal_get_ui32(hal->pins[p].pin.u)), 0)); break; - } - break; case HAL_UINT: switch(mtypetype(cc->typeptr[0].mtype)) { case MBT_U: CHK_RV(map_u(cc, hal_get_uint(hal->pins[p].pin.u), 0)); break; @@ -1473,22 +1466,6 @@ static int build_data_frame(hm2_modbus_inst_t *inst) case MBT_F: CHK_RV(map_f(cc, map_uf(hal_get_uint(hal->pins[p].pin.u)), 0)); break; } break; - case HAL_S32: - if(!haspinscale(&cc->typeptr[0])) { - switch(mtypetype(cc->typeptr[0].mtype)) { - case MBT_U: CHK_RV(map_u(cc, map_su(hal_get_si32(hal->pins[p].pin.s)), 0)); break; - case MBT_S: CHK_RV(map_s(cc, hal_get_si32(hal->pins[p].pin.s), 0)); break; - case MBT_F: CHK_RV(map_f(cc, map_sf(hal_get_si32(hal->pins[p].pin.s)), 0)); break; - } - } else { - val64.f = (rtapi_real)((rtapi_s64)hal_get_si32(hal->pins[p].pin.s) - hal_get_si32(hal->pins[p].offset.s)) * hal_get_real(hal->pins[p].scale); - switch(mtypetype(cc->typeptr[0].mtype)) { - case MBT_U: CHK_RV(map_u(cc, map_fu(val64.f), 0)); break; - case MBT_S: CHK_RV(map_s(cc, map_fs(val64.f), 0)); break; - case MBT_F: CHK_RV(map_f(cc, val64.f, 0)); break; - } - } - break; case HAL_SINT: if(!haspinscale(&cc->typeptr[0])) { switch(mtypetype(cc->typeptr[0].mtype)) { @@ -1555,13 +1532,6 @@ static int build_data_frame(hm2_modbus_inst_t *inst) case HAL_BOOL: CHK_RV(map_u(cc, hal_get_bool(hal->pins[p].pin.b) ? 1 : 0, i)); break; - case HAL_U32: - switch(mtypetype(cc->typeptr[i].mtype)) { - case MBT_U: CHK_RV(map_u(cc, hal_get_ui32(hal->pins[p].pin.u), i)); break; - case MBT_S: CHK_RV(map_s(cc, map_us(hal_get_ui32(hal->pins[p].pin.u)), i)); break; - case MBT_F: CHK_RV(map_f(cc, map_uf(hal_get_ui32(hal->pins[p].pin.u)), i)); break; - } - break; case HAL_UINT: switch(mtypetype(cc->typeptr[i].mtype)) { case MBT_U: CHK_RV(map_u(cc, hal_get_uint(hal->pins[p].pin.u), i)); break; @@ -1569,22 +1539,6 @@ static int build_data_frame(hm2_modbus_inst_t *inst) case MBT_F: CHK_RV(map_f(cc, map_uf(hal_get_uint(hal->pins[p].pin.u)), i)); break; } break; - case HAL_S32: - if(!haspinscale(&cc->typeptr[i])) { - switch(mtypetype(cc->typeptr[i].mtype)) { - case MBT_U: CHK_RV(map_u(cc, map_su(hal_get_si32(hal->pins[p].pin.s)), i)); break; - case MBT_S: CHK_RV(map_s(cc, hal_get_si32(hal->pins[p].pin.s), i)); break; - case MBT_F: CHK_RV(map_f(cc, map_sf(hal_get_si32(hal->pins[p].pin.s)), i)); break; - } - } else { - val64.f = (rtapi_real)((rtapi_s64)hal_get_si32(hal->pins[p].pin.s) - hal_get_si32(hal->pins[p].offset.s)) * hal_get_real(hal->pins[p].scale); - switch(mtypetype(cc->typeptr[i].mtype)) { - case MBT_U: CHK_RV(map_u(cc, map_fu(val64.f), i)); break; - case MBT_S: CHK_RV(map_s(cc, map_fs(val64.f), i)); break; - case MBT_F: CHK_RV(map_f(cc, val64.f, i)); break; - } - } - break; case HAL_SINT: if(!haspinscale(&cc->typeptr[i])) { switch(mtypetype(cc->typeptr[i].mtype)) { @@ -1700,56 +1654,6 @@ static inline rtapi_u64 mask_mbtsize(unsigned mtype, rtapi_u64 v) } } -static inline rtapi_u32 unmap32_uu(const hm2_modbus_cmd_t *cc, rtapi_u64 v, unsigned tidx) -{ - if(haspinclamp(&cc->typeptr[tidx]) && v > RTAPI_UINT32_MAX) - return RTAPI_UINT32_MAX; - return (rtapi_u32)v; -} - -static inline rtapi_u32 unmap32_us(const hm2_modbus_cmd_t *cc, rtapi_s64 v, unsigned tidx) -{ - if(haspinclamp(&cc->typeptr[tidx])) { - if(v > RTAPI_INT32_MAX) return RTAPI_INT32_MAX; - if(v < 0) return 0; - } - return (rtapi_u32)v; -} - -static inline rtapi_u32 unmap32_uf(const hm2_modbus_cmd_t *cc, double v, unsigned tidx) -{ - if(haspinclamp(&cc->typeptr[tidx])) { - if(v > (double)RTAPI_INT32_MAX) return RTAPI_INT32_MAX; - if(v < 0.0) return 0; - } - return (rtapi_u32)v; -} - -static inline rtapi_s32 unmap32_su(const hm2_modbus_cmd_t *cc, rtapi_u64 v, unsigned tidx) -{ - if(haspinclamp(&cc->typeptr[tidx]) && v > (rtapi_u64)RTAPI_INT32_MAX) - return RTAPI_INT32_MAX; - return (rtapi_s32)v; -} - -static inline rtapi_s32 unmap32_ss(const hm2_modbus_cmd_t *cc, rtapi_s64 v, unsigned tidx) -{ - if(haspinclamp(&cc->typeptr[tidx])) { - if(v > (rtapi_s64)RTAPI_INT32_MAX) return RTAPI_INT32_MAX; - if(v < (rtapi_s64)RTAPI_INT32_MIN) return RTAPI_INT32_MIN; - } - return (rtapi_s32)v; -} - -static inline rtapi_s32 unmap32_sf(const hm2_modbus_cmd_t *cc, double v, unsigned tidx) -{ - if(haspinclamp(&cc->typeptr[tidx])) { - if(v > (double)RTAPI_INT32_MAX) return RTAPI_INT32_MAX; - if(v < (double)RTAPI_INT32_MIN) return RTAPI_INT32_MIN; - } - return (rtapi_s32)v; -} - static inline rtapi_u64 unmap64_us(const hm2_modbus_cmd_t *cc, rtapi_s64 v, unsigned tidx) { if(haspinclamp(&cc->typeptr[tidx]) && v < 0) @@ -1973,27 +1877,6 @@ static int parse_data_frame(hm2_modbus_inst_t *inst) case HAL_BOOL: hal_set_bool(hal->pins[p].pin.b, 0 != val64.u); // Zero maps to false, anything else to true break; - case HAL_U32: - switch(mtypetype(cc->typeptr[i].mtype)) { - case MBT_U: hal_set_ui32(hal->pins[p].pin.u, unmap32_uu(cc, val64.u, i)); break; - case MBT_S: hal_set_ui32(hal->pins[p].pin.u, unmap32_us(cc, val64.s, i)); break; - case MBT_F: hal_set_ui32(hal->pins[p].pin.u, unmap32_uf(cc, val64.f, i)); break; - } - break; - case HAL_S32: - switch(mtypetype(cc->typeptr[i].mtype)) { - case MBT_U: hal_set_si32(hal->pins[p].pin.s, unmap32_su(cc, val64.u, i)); break; - case MBT_S: hal_set_si32(hal->pins[p].pin.s, unmap32_ss(cc, val64.s, i)); break; - case MBT_F: hal_set_si32(hal->pins[p].pin.s, unmap32_sf(cc, val64.f, i)); break; - } - if(haspinscale(&cc->typeptr[i])) { - switch(mtypetype(cc->typeptr[i].mtype)) { - case MBT_U: hal_set_real(hal->pins[p].scaled, (rtapi_real)(rtapi_s64)(val64.u - hal_get_uint(hal->pins[p].offset.u)) * hal_get_real(hal->pins[p].scale)); break; - case MBT_S: hal_set_real(hal->pins[p].scaled, (rtapi_real)(val64.s - hal_get_sint(hal->pins[p].offset.s)) * hal_get_real(hal->pins[p].scale)); break; - case MBT_F: hal_set_real(hal->pins[p].scaled, (val64.f - hal_get_real(hal->pins[p].offset.r)) * hal_get_real(hal->pins[p].scale)); break; - } - } - break; case HAL_UINT: switch(mtypetype(cc->typeptr[i].mtype)) { case MBT_U: hal_set_uint(hal->pins[p].pin.u, val64.u); break; @@ -2260,8 +2143,6 @@ static int check_htype(unsigned type) { switch(type) { case HAL_BOOL: // not valid in register read/write - case HAL_U32: - case HAL_S32: case HAL_UINT: case HAL_SINT: case HAL_REAL: @@ -2289,13 +2170,13 @@ static int load_mbccb(hm2_modbus_inst_t *inst, const char *fname) } // Done reading, now test format - static const rtapi_u8 signature[8] = {'M','e','s','a','M','B','0','1'}; + static const rtapi_u8 signature[8] = {'M','e','s','a','M','B','0','2'}; if(memcmp(signature, mbccb->sig, sizeof(signature))) { char buf[sizeof(mbccb->sig)+1]; for(unsigned i = 0; i < sizeof(mbccb->sig); i++) buf[i] = isprint(mbccb->sig[i]) ? mbccb->sig[i] : '?'; buf[sizeof(mbccb->sig)] = 0; - MSG_ERR("%s: error: Invalid signature in mbccb file: '%s' (expected 'MesaMB01')\n", inst->name, buf); + MSG_ERR("%s: error: Invalid signature in mbccb file: '%s' (expected 'MesaMB02')\n", inst->name, buf); MSG_ERR("%s: error: Have you compiled the mbccs source into a binary mbccb file using mesambccc?\n", inst->name); goto errout; } @@ -2805,7 +2686,7 @@ int rtapi_app_main(void) inst->cmds = inst->ninit ? inst->_init : inst->_cmds; // Export the HAL process function - if((retval = hal_export_functf(process, inst, 1, 0, comp_id, COMP_NAME".%d.process", i)) < 0) { + if((retval = hal_export_functf(process, inst, 0, comp_id, COMP_NAME".%d.process", i)) < 0) { MSG_ERR("%s: error: Function export failed\n", inst->name); goto errout; } @@ -2997,46 +2878,11 @@ int rtapi_app_main(void) 0, "%s.%s", inst->name, CPTR(dptr))); break; - case HAL_U32: - CHECK(hal_pin_new_ui32(comp_id, dir, &(inst->hal->pins[p++].pin.u), - 0, "%s.%s", inst->name, CPTR(dptr))); - break; - case HAL_UINT: CHECK(hal_pin_new_uint(comp_id, dir, &(inst->hal->pins[p++].pin.u), 0, "%s.%s", inst->name, CPTR(dptr))); break; - case HAL_S32: - CHECK(hal_pin_new_si32(comp_id, dir, &(inst->hal->pins[p].pin.s), - 0, "%s.%s", inst->name, CPTR(dptr))); - if(haspinscale(&cc->typeptr[j])) { - CHECK(hal_pin_new_real(comp_id, HAL_IN, &(inst->hal->pins[p].scale), - 1.0, "%s.%s.scale", inst->name, CPTR(dptr))); - if(HAL_OUT == dir) { - CHECK(hal_pin_new_real(comp_id, HAL_OUT, &(inst->hal->pins[p].scaled), - 0.0, "%s.%s.scaled", inst->name, CPTR(dptr))); - switch(mtypetype(cc->typeptr[j].mtype)) { - case MBT_U: - CHECK(hal_pin_new_uint(comp_id, HAL_IN, &(inst->hal->pins[p].offset.u), - 0, "%s.%s.offset", inst->name, CPTR(dptr))); - break; - case MBT_S: - CHECK(hal_pin_new_sint(comp_id, HAL_IN, &(inst->hal->pins[p].offset.s), - 0, "%s.%s.offset", inst->name, CPTR(dptr))); - break; - case MBT_F: - CHECK(hal_pin_new_real(comp_id, HAL_IN, &(inst->hal->pins[p].offset.r), - 0.0, "%s.%s.offset", inst->name, CPTR(dptr))); - break; - } - } else { - CHECK(hal_pin_new_si32(comp_id, HAL_IN, &(inst->hal->pins[p].offset.s), - 0, "%s.%s.offset", inst->name, CPTR(dptr))); - } - } - p++; - break; case HAL_SINT: CHECK(hal_pin_new_sint(comp_id, dir, &(inst->hal->pins[p].pin.s), 0, "%s.%s", inst->name, CPTR(dptr))); diff --git a/src/hal/drivers/mesa-hostmot2/hostmot2.c b/src/hal/drivers/mesa-hostmot2/hostmot2.c index 488f5e3cdc8..f83e48fad84 100644 --- a/src/hal/drivers/mesa-hostmot2/hostmot2.c +++ b/src/hal/drivers/mesa-hostmot2/hostmot2.c @@ -1694,21 +1694,21 @@ int hm2_register(hm2_lowlevel_io_t *llio, char *config_string) { { if(hm2->llio->split_read) { - r = hal_export_functf(hm2_read_request, hm2, 1, 0, hm2->llio->comp_id, "%s.read-request", hm2->llio->name); + r = hal_export_functf(hm2_read_request, hm2, 0, hm2->llio->comp_id, "%s.read-request", hm2->llio->name); if (r != 0) { HM2_ERR("error %d exporting read function %s.read-request\n", r, hm2->llio->name); r = -EINVAL; goto fail1; } } - r = hal_export_functf(hm2_read, hm2, 1, 0, hm2->llio->comp_id, "%s.read", hm2->llio->name); + r = hal_export_functf(hm2_read, hm2, 0, hm2->llio->comp_id, "%s.read", hm2->llio->name); if (r != 0) { HM2_ERR("error %d exporting read function %s.read\n", r, hm2->llio->name); r = -EINVAL; goto fail1; } - r = hal_export_functf(hm2_write, hm2, 1, 0, hm2->llio->comp_id, "%s.write", hm2->llio->name); + r = hal_export_functf(hm2_write, hm2, 0, hm2->llio->comp_id, "%s.write", hm2->llio->name); if (r != 0) { HM2_ERR("error %d exporting write function %s.write\n", r, hm2->llio->name); r = -EINVAL; @@ -1722,14 +1722,14 @@ int hm2_register(hm2_lowlevel_io_t *llio, char *config_string) { // if (hm2->llio->threadsafe) { - r = hal_export_functf(hm2_read_gpio, hm2, 1, 0, hm2->llio->comp_id, "%s.read_gpio", hm2->llio->name); + r = hal_export_functf(hm2_read_gpio, hm2, 0, hm2->llio->comp_id, "%s.read_gpio", hm2->llio->name); if (r != 0) { HM2_ERR("error %d exporting gpio_read function %s.read_gpio\n", r, hm2->llio->name); r = -EINVAL; goto fail1; } - r = hal_export_functf(hm2_write_gpio, hm2, 1, 0, hm2->llio->comp_id, "%s.write_gpio", hm2->llio->name); + r = hal_export_functf(hm2_write_gpio, hm2, 0, hm2->llio->comp_id, "%s.write_gpio", hm2->llio->name); if (r != 0) { HM2_ERR("error %d exporting gpio_write function %s.write_gpio\n", r, hm2->llio->name); r = -EINVAL; diff --git a/src/hal/drivers/mesa-hostmot2/mesambccc.py b/src/hal/drivers/mesa-hostmot2/mesambccc.py index e03dfbca16f..3bfacd91333 100644 --- a/src/hal/drivers/mesa-hostmot2/mesambccc.py +++ b/src/hal/drivers/mesa-hostmot2/mesambccc.py @@ -57,6 +57,7 @@ import xml.parsers.expat as XP import re import struct +import hal # HAL names are a bit picky # The following allows, for example, device names "xyz" but also "xyz.0" and @@ -131,14 +132,11 @@ 'writeflush': [0, 1], 'timeout' : [10000, 10000000] } # 10 milliseconds to 10 seconds (can override in ) -# XXX: Keep in sync with hal.h -HAL_BIT = 1 -HAL_FLT = 2 # HAL_FLOAT -HAL_S32 = 3 -HAL_U32 = 4 -HAL_PRT = 5 # HAL_PORT, unused -HAL_S64 = 6 -HAL_U64 = 7 +# Kept in sync with hal.h via halmodule's IntEnum +HAL_BOOL = hal.Type.BOOL +HAL_REAL = hal.Type.REAL +HAL_SINT = hal.Type.SINT +HAL_UINT = hal.Type.UINT # XXX: Keep in sync with hm2_modbus.c MBT_AB = 0x00 @@ -199,18 +197,23 @@ def mbtType(mtype): F_DCBA = MBT_F | MBT_DCBA # Possible values of the 'haltype' attribute -HALTYPES = { 'HAL_BIT': HAL_BIT, 'HAL_FLOAT': HAL_FLT, 'HAL_FLT': HAL_FLT, - 'HAL_S32': HAL_S32, 'HAL_U32': HAL_U32, - 'HAL_S64': HAL_S64, 'HAL_U64': HAL_U64, +HALTYPES = { 'HAL_BOOL':HAL_BOOL, 'HAL_REAL': HAL_REAL, + 'HAL_SINT':HAL_SINT, 'HAL_UINT': HAL_UINT, + 'HAL_BIT': HAL_BOOL, 'HAL_FLOAT': HAL_REAL, 'HAL_FLT': HAL_REAL, + 'HAL_S32': HAL_SINT, 'HAL_U32': HAL_UINT, + 'HAL_S64': HAL_SINT, 'HAL_U64': HAL_UINT, # Be nice, allow types without useless prefix - 'BIT': HAL_BIT, 'FLOAT': HAL_FLT, 'FLT': HAL_FLT, - 'S32': HAL_S32, 'U32': HAL_U32, - 'S64': HAL_S64, 'U64': HAL_U64 } + 'BOOL': HAL_BOOL, 'REAL': HAL_REAL, + 'SINT': HAL_SINT, 'UINT': HAL_UINT, + 'BIT': HAL_BOOL, 'FLOAT': HAL_REAL, 'FLT': HAL_REAL, + 'S32': HAL_SINT, 'U32': HAL_UINT, + 'S64': HAL_SINT, 'U64': HAL_UINT } + +HALTYPES32 = ['HAL_S32', 'HAL_U32', 'S32', 'U32'] # Reverse map of HALTYPES -HALNAMES = { HAL_BIT: 'HAL_BIT', HAL_FLT: 'HAL_FLOAT', - HAL_S32: 'HAL_S32', HAL_U32: 'HAL_U32', - HAL_S64: 'HAL_S64', HAL_U64: 'HAL_U64' } +HALNAMES = { HAL_BOOL: 'HAL_BOOL', HAL_REAL: 'HAL_REAL', + HAL_SINT: 'HAL_SINT', HAL_UINT: 'HAL_UINT' } # Possible values of the 'modbustype' attribute # [typeId, maxCount, nWords] @@ -288,7 +291,7 @@ def mbtType(mtype): WRITEFUNCTIONS = [ W_COIL, W_REGISTER, W_COILS, W_REGISTERS ] -# These functions always use HAL_BIT +# These functions always use HAL_BOOL # Also, the function is a register function if /not/ in this set BITFUNCTIONS = [R_COILS, R_INPUTS, W_COIL, W_COILS] REGFUNCTIONS = [R_REGISTERS, R_INPUTREGS, W_REGISTER, W_REGISTERS] @@ -469,11 +472,11 @@ def mangle64(d, mtype): def getBoolean(attrib, name): if name not in attrib: return None + BOOLMAP = {'T': True, 'TRUE': True, '1': True, 'ON': True, 'YES': True, + 'F': False, 'FALSE': False, '0': False, 'OFF': False, 'NO': False } a = attrib[name].upper() - if 'T' == a or 'TRUE' == a or '1' == a: - return True - if 'F' == a or 'FALSE' == a or '0' == a: - return False + if a in BOOLMAP: + return BOOLMAP[a] perr("Expected boolean value in '{}' attribute, not '{}'".format(name, attrib[name])) return None @@ -1076,6 +1079,8 @@ def getHalType(tag, ers): if ht not in HALTYPES: perr("Invalid haltype '{}' in {}".format(tag.attrib['haltype'], ers)) return None + if ht in HALTYPES32: + pwarn(f"32-bit haltype '{ht}' will still create 64-bit pins, please update your mbccs file.") return HALTYPES[ht]; # @@ -1154,13 +1159,13 @@ def handleCommands(commands): count = 0 if function in BITFUNCTIONS: - # Coils and inputs are binary and always map to HAL_BIT + # Coils and inputs are binary and always map to HAL_BOOL if 'modbustype' in cmd.attrib: pwarn("Attribute 'modbustype' ignored for bit functions in {}".format(lcl)) if 'haltype' in cmd.attrib: - pwarn("Attribute 'haltype' ignored for bit functions (always HAL_BIT) in {}".format(lcl)) + pwarn("Attribute 'haltype' ignored for bit functions (always HAL_BOOL) in {}".format(lcl)) defmtype = [-1, 2000, 1] # fake mtype - defhtype = HAL_BIT + defhtype = HAL_BOOL else: # These are defaults for R_REGISTERS, R_INPUTREGS, W_REGISTER and W_REGISTERS defmtype = getModbusType(cmd, lcl) @@ -1176,7 +1181,7 @@ def handleCommands(commands): # clamp is default on all pins # writeflush depends on global setting defcflag = MBCCB_CMDF_WFLUSH if configparams['writeflush'] else 0 - defpflag = MBCCB_PINF_SCALE if defhtype == HAL_FLT else 0 + defpflag = MBCCB_PINF_SCALE if defhtype == HAL_REAL else 0 defpflag |= MBCCB_PINF_CLAMP if function in REGFUNCTIONS else 0 cflags, pflags = parseOptFlags(device, cmd.attrib, defcflag, defpflag, lcl) if 0 != cflags & ~MBCCB_CMDF_MASK: @@ -1184,20 +1189,16 @@ def handleCommands(commands): if 0 != pflags & ~MBCCB_PINF_MASK: pwarn("Additional pin flags '0x{:04x}' (allowed=0x{:04x}) in {}".format(pflags, MBCCB_PINF_MASK, lcl)) - if (pflags & MBCCB_PINF_SCALE) and defhtype in [HAL_U32, HAL_U64]: + if (pflags & MBCCB_PINF_SCALE) and defhtype in [HAL_UINT]: pwarn("Unsigned hal types cannot be scaled, disabling in {}".format(lcl)) pflags &= ~MBCCB_PINF_SCALE & 0xffff if None != defmtype and ((0 == (pflags & MBCCB_PINF_SCALE)) and - ((MBT_S == mbtType(defmtype[0]) and defhtype in [HAL_U32, HAL_U64]) - or (MBT_U == mbtType(defmtype[0]) and defhtype in [HAL_S32, HAL_S64]))): + ((MBT_S == mbtType(defmtype[0]) and defhtype in [HAL_UINT]) + or (MBT_U == mbtType(defmtype[0]) and defhtype in [HAL_SINT]))): pwarn("Signedness mismatch between haltype={} and modbustype={} may give wrong results in {}" .format(HALNAMES[defhtype], MBNAMES[defmtype[0]], lcl)) - if None != defmtype and mbtOrderSize(defmtype[0]) == 8 and defhtype in [HAL_U32, HAL_S32]: - pwarn("Haltype destination '{}' is smaller than Modbus source type {} in {}" - .format(HALNAMES[defhtype], MBNAMES[defmtype[0]], lcl)) - if (cflags & MBCCB_CMDF_RESEND) and interval == 0xffffffff: perr("Interval 'once' and 'resend' are mutually exclusive in {}".format(lcl)) continue @@ -1278,7 +1279,7 @@ def handleCommands(commands): pwarn("Attribute 'modbustype' ignored for bit functions in {}".format(lpl)) if 'haltype' in pin.attrib: pwarn("Attribute 'haltype' ignored for bit functions in {}".format(lpl)) - pinlist.append({'pin': pintag, 'mtype': 0, 'htype': HAL_BIT, 'flags': 0, 'regofs': regofs}) + pinlist.append({'pin': pintag, 'mtype': 0, 'htype': HAL_BOOL, 'flags': 0, 'regofs': regofs}) pinlistall.append(pintag) regofs += 1 continue @@ -1301,25 +1302,22 @@ def handleCommands(commands): assert pmtype != None # Must have hal and modbus types assert phtype != None # W_REGISTER(S), R_REGISTERS and R_INPUTREGS can have special - if HAL_BIT == phtype and MBT_U != mbtType(pmtype): - perr("Haltype HAL_BIT with register function must use unsigned modbustype in {}".format(lpl)) + if HAL_BOOL == phtype and MBT_U != mbtType(pmtype): + perr("Haltype HAL_BOOL with register function must use unsigned modbustype in {}".format(lpl)) err = True break # scale and clamp flags cf, pf = parseOptFlags(device, pin.attrib, 0, pflags, lpl) - if (pf & MBCCB_PINF_SCALE) and phtype in [HAL_U32, HAL_U64]: + if (pf & MBCCB_PINF_SCALE) and phtype in [HAL_UINT]: pwarn("Unsigned hal types cannot be scaled, disabling in {}".format(lpl)) pf &= ~MBCCB_PINF_SCALE msz = mbtOrderSize(pmtype[0]) - hsz = 4 if phtype in [HAL_U32, HAL_S32] else 8 + hsz = 8 if ((0 == (pf & MBCCB_PINF_SCALE)) and msz >= hsz and - ((MBT_S == mbtType(pmtype[0]) and phtype in [HAL_U32, HAL_U64]) - or (MBT_U == mbtType(pmtype[0]) and phtype in [HAL_S32, HAL_S64]))): + ((MBT_S == mbtType(pmtype[0]) and phtype in [HAL_UINT]) + or (MBT_U == mbtType(pmtype[0]) and phtype in [HAL_SINT]))): pwarn("Signedness mismatch between haltype={} and modbustype={} may give wrong results in {}" .format(HALNAMES[phtype], MBNAMES[pmtype[0]], lpl)) - if (mbtOrderSize(pmtype[0])) == 8 and phtype in [HAL_U32, HAL_S32]: - pwarn("Haltype destination '{}' is smaller than Modbus source type {} in {}" - .format(HALNAMES[phtype], MBNAMES[pmtype[0]], lpl)) if ((mbtOrderSize(pmtype[0]) == 4 and 0 != ((address + regofs) & 1)) or (mbtOrderSize(pmtype[0]) == 8 and 0 != ((address + regofs) & 3))): @@ -1368,7 +1366,7 @@ def handleCommands(commands): err = True break if function in BITFUNCTIONS: - pinlist.append({'pin': pintag, 'mtype': 0, 'htype': HAL_BIT, 'flags': 0, 'regofs': regofs}) + pinlist.append({'pin': pintag, 'mtype': 0, 'htype': HAL_BOOL, 'flags': 0, 'regofs': regofs}) regofs += 1 else: pinlist.append({'pin': pintag, 'mtype': defmtype[0], 'htype': defhtype, 'flags': pflags, 'regofs': regofs}) @@ -1404,8 +1402,8 @@ def handleCommands(commands): io = "in " if function in WRITEFUNCTIONS else "out" for p in range(len(pinlist)): pin = pinlist[p] - if HAL_BIT == pin['htype']: - mbn = 'HAL_BIT<=>BIT' + if HAL_BOOL == pin['htype']: + mbn = 'HAL_BOOL<=>BIT' else: mbn = '{}<=>{}'.format(HALNAMES[pin['htype']], MBNAMES[pin['mtype']]) print(" pin {:2} ({}): {:24} {} flags={} addr=0x{:04x}".format(p+1, io, pin['pin'], @@ -1414,11 +1412,11 @@ def handleCommands(commands): if function in WRITEFUNCTIONS: pt = HALNAMES[pin['htype']] else: - pt = {MBT_U: "HAL_U64", MBT_S: "HAL_S64", MBT_F: "HAL_FLOAT"}[mbtType(pin['mtype'])] + pt = {MBT_U: "HAL_UINT", MBT_S: "HAL_SINT", MBT_F: "HAL_REAL"}[mbtType(pin['mtype'])] print(" (in ): {:24} {}".format(pin['pin']+".offset", pt)) - print(" (in ): {:24} HAL_FLOAT".format(pin['pin']+".scale")) + print(" (in ): {:24} HAL_REAL".format(pin['pin']+".scale")) if function not in WRITEFUNCTIONS: - print(" (out): {:24} HAL_FLOAT".format(pin['pin']+".scaled")) + print(" (out): {:24} HAL_REAL".format(pin['pin']+".scaled")) # end for cmd in commands: return cmdlist @@ -1685,7 +1683,7 @@ def main(): typeptr, i['interval'], i['timeout'], pinptr)) # typedef struct { - # rtapi_u8 sig[8]; // Signature and version {'M','e','s','a','M','B','0','1'} + # rtapi_u8 sig[8]; // Signature and version {'M','e','s','a','M','B','0','2'} # rtapi_u32 baudrate; # rtapi_u16 format; // Parity and stopbits # rtapi_u16 txdelay; // Tx t3.5 @@ -1704,7 +1702,7 @@ def main(): flg |= MBCCB_FORMAT_DUPLEX if configparams['duplex'] else 0 flg |= MBCCB_FORMAT_SUSPEND if configparams['suspend'] else 0 header = (struct.pack(">8sIHHHHHHIIIIIIIIII", - b'MesaMB01', + b'MesaMB02', configparams['baudrate'], par[configparams['parity']] | flg, configparams['txdelay'], diff --git a/src/hal/drivers/mesa_uart.comp b/src/hal/drivers/mesa_uart.comp index b62d5b84d54..816d2f99d45 100644 --- a/src/hal/drivers/mesa_uart.comp +++ b/src/hal/drivers/mesa_uart.comp @@ -41,10 +41,10 @@ license "GPL"; include ; -pin in ui32 tx-data-##[16] "Data to be transmitted"; -pin out ui32 rx-data-##[16] "Data received"; -pin in si32 tx-bytes "Number of bytes to transmit"; -pin out si32 rx-bytes "Number of Bytes received"; +pin in uint tx-data-##[16] "Data to be transmitted"; +pin out uint rx-data-##[16] "Data received"; +pin in sint tx-bytes "Number of bytes to transmit"; +pin out sint rx-bytes "Number of Bytes received"; variable char *name; // UART name diff --git a/src/hal/drivers/serport.comp b/src/hal/drivers/serport.comp index bee4bab7f82..e6510814b65 100644 --- a/src/hal/drivers/serport.comp +++ b/src/hal/drivers/serport.comp @@ -36,7 +36,7 @@ pin in bool pin_7_out "Also called RTS (request to send); pin 4 on the 25-pin s param rw bool pin_3_out_invert; param rw bool pin_4_out_invert; param rw bool pin_7_out_invert; -param r ui32 ioaddr; +param r uint ioaddr; option count_function; option extra_setup; diff --git a/src/hal/hal.h b/src/hal/hal.h index 02139799cdb..fee5f98ae32 100644 --- a/src/hal/hal.h +++ b/src/hal/hal.h @@ -127,10 +127,44 @@ */ +// +// The HAL_API_VERSION define can be used to determine what features are +// available in the HAL library API. It can be used to make code build on both +// old and new LinuxCNC versions if you need to keep everything in one +// source-tree. +// Currently only two versions are possible: +// a) No define present +// The HAL API is for LinuxCNC up to and including version 2.9. The integer +// pins and params are 32-bit only. +// +// b) HAL_API_VERSION == 1 +// The HAL API if for LinuxCNC 2.10 and later. It supports the getter, +// setter and query API. Any access to the underlying data or HAL's private +// inners is not allowed. HAL pins and params are opaque structures. The +// underlying data size of integers is 64-bit. +// +#define HAL_API_VERSION 1 + +// +// HAL_STATIC_ASSERT wrapper for compile time asserts +// +#if __STDC_VERSION__ >= 202311L || defined(__cplusplus) +#define HAL_STATIC_ASSERT(expr, msg) static_assert((expr), msg) +#else +// _Static_assert: GCC extension, in C standard since C11, deprecated +// in favour of static_assert (like C++) from C23 onwards. +#define HAL_STATIC_ASSERT(expr, msg) _Static_assert((expr), msg) +#endif + +// Some useful defines +#define __HAL_DEPRECATED(msg) __attribute__((deprecated(msg))) +#define __HAL_ALWAYS_INLINE __attribute__((always_inline)) +#define __HAL_PFMT(a,b) __attribute__((format(printf,a,b))) + #include "rtapi.h" RTAPI_BEGIN_DECLS -#if ( !defined RTAPI ) && ( !defined ULAPI ) +#if !defined(RTAPI) && !defined(ULAPI) #error HAL needs RTAPI/ULAPI, check makefile and flags #endif @@ -214,7 +248,7 @@ void hal_lib_exit(void); Call only from within user space or init/cleanup code, not from realtime code. */ -extern int hal_init(const char *name); +int hal_init(const char *name); /** 'hal_exit()' must be called before a HAL component exits, to free resources associated with the component. @@ -233,7 +267,7 @@ extern int hal_init(const char *name); On success, hal_exit() returns 0, on failure it returns a negative error code. */ -extern int hal_exit(int comp_id); +int hal_exit(int comp_id); /** hal_malloc() allocates a block of memory from the main HAL shared memory area. It should be used by all components to @@ -252,13 +286,13 @@ extern int hal_exit(int comp_id); all components completely clears memory and you start fresh. */ -extern void *hal_malloc(long int size); +void *hal_malloc(long int size); /** hal_ready() indicates that this component is ready. This allows halcmd 'loadusr -W hal_example' to wait until the userspace component 'hal_example' is ready before continuing. */ -extern int hal_ready(int comp_id); +int hal_ready(int comp_id); /** hal_set_unready() sets a component state to unready so additional pins can be added. A subsequent call to @@ -266,13 +300,13 @@ extern int hal_ready(int comp_id); again. Kinematics modules created with halcompile use this function to add pins to a parent component. */ -extern int hal_set_unready(int comp_id); +int hal_set_unready(int comp_id); /** hal_unready() indicates that this component is ready. This allows halcmd 'loadusr -W hal_example' to wait until the userspace component 'hal_example' is ready before continuing. */ -extern int hal_unready(int comp_id); +int hal_unready(int comp_id); // hal_strerror() returns a brief textual description string about the error // identified. The argument should be the negative errno value, as returned by @@ -282,12 +316,12 @@ const char *hal_strerror(int err); /** hal_comp_name() returns the name of the given component, or NULL if comp_id is not a loaded component */ -extern char* hal_comp_name(int comp_id); +const char *hal_comp_name(int comp_id); /** hal_get_realtime_type() returns the type of the running real time */ typedef rtapi_realtime_type_t hal_realtime_type_t; -extern hal_realtime_type_t hal_get_realtime_type(void); +hal_realtime_type_t hal_get_realtime_type(void); /** The HAL maintains lists of variables, functions, and so on in a central database, located in shared memory so all components @@ -327,20 +361,20 @@ extern hal_realtime_type_t hal_get_realtime_type(void); typedef enum { HAL_TYPE_UNSPECIFIED = -1, HAL_TYPE_UNINITIALIZED = 0, - HAL_BIT = 1, - HAL_FLOAT = 2, - HAL_S32 = 3, - HAL_U32 = 4, + HAL_BOOL = 1, + HAL_REAL = 2, + HAL_SINT = 3, + HAL_UINT = 4, HAL_PORT = 5, - HAL_S64 = 6, - HAL_U64 = 7, HAL_TYPE_MAX, -} hal_type_t; -#define HAL_BOOL HAL_BIT -#define HAL_REAL HAL_FLOAT -#define HAL_SINT HAL_S64 -#define HAL_UINT HAL_U64 + HAL_S32 __HAL_DEPRECATED("No longer supported. Please migrate to HAL_SINT") = HAL_SINT, + HAL_U32 __HAL_DEPRECATED("No longer supported. Please migrate to HAL_UINT") = HAL_UINT, + HAL_S64 __HAL_DEPRECATED("Please rename to HAL_SINT") = HAL_SINT, + HAL_U64 __HAL_DEPRECATED("Please rename to HAL_UINT") = HAL_UINT, + HAL_FLOAT __HAL_DEPRECATED("Please rename to HAL_REAL") = HAL_REAL, + HAL_BIT __HAL_DEPRECATED("Please rename to HAL_BOOL") = HAL_BOOL, +} hal_type_t; // // hal_pdir_t - Unified HAL pin/param direction type. Specifies the direction @@ -370,11 +404,8 @@ typedef enum { // Map both old direction types to the new combined type // FIXME: These should be retired at some point -typedef hal_pdir_t hal_pin_dir_t; -typedef hal_pdir_t hal_param_dir_t; - -#define __HAL_DEPRECATED(msg) __attribute__((deprecated(msg))) -#define __HAL_ALWAYS_INLINE __attribute__((always_inline)) +typedef hal_pdir_t hal_pin_dir_t __HAL_DEPRECATED("Please use hal_pdir_t"); +typedef hal_pdir_t hal_param_dir_t __HAL_DEPRECATED("Please use hal_pdir_t"); // // bool hal_pdir_is_pin(hal_pdir_t) @@ -396,37 +427,6 @@ static inline __HAL_ALWAYS_INLINE bool hal_pdir_is_neither(hal_pdir_t v) { return (0 != (v & ~(HAL_IO|HAL_RW))) || (0 == (v & (HAL_IO|HAL_RW))); } -// FIXME: These alignment attributes should be removed. -// HAL now allocates on an 8-byte boundary and the rest should be left to the -// compiler. -// ==> Remove when we get rid of old hal_*_t typedefs. <== -typedef rtapi_real real_t; -typedef rtapi_u64 ireal_t __attribute__((aligned(8))) __attribute__((deprecated)); // integral type as wide as real_t / hal_float_t - -typedef volatile bool hal_bit_t __HAL_DEPRECATED("Use getter/setter API"); -typedef volatile rtapi_u32 hal_u32_t __HAL_DEPRECATED("Use getter/setter API"); -typedef volatile rtapi_s32 hal_s32_t __HAL_DEPRECATED("Use getter/setter API"); -typedef volatile rtapi_u64 hal_u64_t __HAL_DEPRECATED("Use getter/setter API"); -typedef volatile rtapi_s64 hal_s64_t __HAL_DEPRECATED("Use getter/setter API"); -typedef volatile rtapi_real hal_float_t __HAL_DEPRECATED("Use getter/setter API"); -typedef volatile int hal_port_t; - -/** HAL "data union" structure - ** This structure may hold any type of hal data -*/ -typedef union { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - hal_bit_t b; - hal_s32_t s; - hal_u32_t u; - hal_float_t f; - hal_port_t p; - hal_s64_t ls; - hal_u64_t lu; -#pragma GCC diagnostic pop -} hal_data_u __HAL_DEPRECATED("Use getter/setter API"); - // Fake forward declarations so we can make opaque pointers struct __hal_stype_bool_t; struct __hal_stype_sint_t; @@ -438,14 +438,14 @@ typedef struct __hal_stype_bool_t *hal_bool_t; typedef struct __hal_stype_sint_t *hal_sint_t; typedef struct __hal_stype_uint_t *hal_uint_t; typedef struct __hal_stype_real_t *hal_real_t; -//typedef struct __hal_stype_port_t *hal_port_t; +typedef struct __hal_stype_port_t *hal_port_t; typedef union { hal_bool_t b; hal_sint_t s; hal_uint_t u; hal_real_t r; - //hal_port_t p; + hal_port_t p; } hal_refs_u; // We rely on little-endian memory layout in the union where the smaller @@ -461,35 +461,29 @@ typedef union { // This is a define so we don't export it to other code. // It is undef'ed after we're done with it. -// FIXME: Get rid of the 32-bit types when we have upgraded everything using -// getter/setter access only so we have guaranteed content. #define __HAL_MAPPED_TYPE union __hal_mapped_type { \ volatile rtapi_bool _b; \ - volatile rtapi_s32 _ss; \ - volatile rtapi_u32 _su; \ volatile rtapi_sint _s; \ volatile rtapi_uint _u; \ volatile rtapi_real _r; \ + volatile rtapi_port _p; \ } -#if 0 -// The port change must be done later -// A 'hal_port_t' is a pin/param reference which content represents +// A 'hal_port_t' is a pin reference which content represents // the integer offset in the HAL shared memory segment to a // hal_port_shm_t structure. -static inline __HAL_ALWAYS_INLINE rtapi_sint hal_get_port(hal_port_t ref) { +static inline __HAL_ALWAYS_INLINE rtapi_port hal_get_port(hal_port_t ref) { __HAL_MAPPED_TYPE; // cppcheck-suppress dangerousTypeCast - return ((union __hal_mapped_type *)ref)->_s; + return ((union __hal_mapped_type *)ref)->_p; } -static inline __HAL_ALWAYS_INLINE rtapi_sint hal_set_port(hal_port_t ref, rtapi_sint val) { +static inline __HAL_ALWAYS_INLINE rtapi_port hal_set_port(hal_port_t ref, rtapi_port val) { __HAL_MAPPED_TYPE; // cppcheck-suppress dangerousTypeCast - ((union __hal_mapped_type *)ref)->_s = val; // Store in the larger type + ((union __hal_mapped_type *)ref)->_p = val; return val; } -#endif // // The hal_{get,set}_si32() and hal_{get,set}_ui32() are only present for // compatibility. They may be removed when all the remaining code has been @@ -511,7 +505,7 @@ static inline __HAL_ALWAYS_INLINE rtapi_s32 hal_get_si32(const hal_sint_t ref) { __HAL_MAPPED_TYPE; // Implicitly Truncated from the larger type // cppcheck-suppress dangerousTypeCast - return ((union __hal_mapped_type *)ref)->_ss; + return (rtapi_s32)((union __hal_mapped_type *)ref)->_s; } static inline __HAL_ALWAYS_INLINE rtapi_s32 hal_set_si32(hal_sint_t ref, rtapi_s32 val) { __HAL_MAPPED_TYPE; @@ -531,7 +525,7 @@ static inline __HAL_ALWAYS_INLINE rtapi_u32 hal_get_ui32(const hal_uint_t ref) { __HAL_MAPPED_TYPE; // Implicitly Truncated from the larger type // cppcheck-suppress dangerousTypeCast - return ((union __hal_mapped_type *)ref)->_su; + return (rtapi_u32)((union __hal_mapped_type *)ref)->_u; } static inline __HAL_ALWAYS_INLINE rtapi_u32 hal_set_ui32(hal_uint_t ref, rtapi_u32 val) { __HAL_MAPPED_TYPE; @@ -586,31 +580,8 @@ static inline __HAL_ALWAYS_INLINE rtapi_bool hal_set_bool(hal_bool_t ref, rtapi_ ((union __hal_mapped_type *)ref)->_u = val; return val; } -#undef __HAL_ALWAYS_INLINE #undef __HAL_MAPPED_TYPE -#define __HAL_PFMT(a,b) __attribute__((format(printf,a,b))) -int hal_pin_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_pin_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_pin_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_pin_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_pin_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_pin_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real def, const char *fmt, ...) __HAL_PFMT(5,6); -// Note: port has no initial default as it is an 'internal' reference -//int hal_pin_new_port(int compid, hal_pin_dir_t dir, hal_port_t *ref, const char *fmt, ...) __HAL_PFMT(4,5); -// FIXME: This needs to change into hal_port_t argument when we break the API -// It is here so we may add halmodule without too much trouble until then. -int hal_pin_new_port(int compid, hal_pin_dir_t dir, hal_sint_t *ref, const char *fmt, ...) __HAL_PFMT(4,5); - -int hal_param_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_param_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_param_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_param_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_param_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_param_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real def, const char *fmt, ...) __HAL_PFMT(5,6); -int hal_param_new_fake(int compid, hal_refs_u *refs); -#undef __HAL_PFMT - /*********************************************************************** * "LOCKING" FUNCTIONS * ************************************************************************/ @@ -620,7 +591,7 @@ int hal_param_new_fake(int compid, hal_refs_u *refs); HAL_LOCK_* - intermediate locking levels HAL_LOCK_ALL - locks everything */ -extern int hal_set_lock(unsigned char lock_type); +int hal_set_lock(unsigned char lock_type); /** The 'hal_get_lock()' function returns the current locking level locking types defined in hal.h @@ -629,105 +600,51 @@ extern int hal_set_lock(unsigned char lock_type); HAL_LOCK_ALL - locks everything */ -extern unsigned char hal_get_lock(void); +unsigned char hal_get_lock(void); /*********************************************************************** * "PIN" FUNCTIONS * ************************************************************************/ -/** The 'hal_pin_xxx_new()' functions create a new 'pin' object. - Once a pin has been created, it can be linked to a signal object - using hal_link(). A pin contains a pointer, and the component - that owns the pin can dereference the pointer to access whatever - signal is linked to the pin. (If no signal is linked, it points - to a dummy signal.) - There are eight functions, one for each of the data types that - the HAL supports. Pins may only be linked to signals of the same - type. - 'name' is the name of the new pin. It must be no longer than HAL_NAME_LEN. - If there is already a pin with the same name the call will fail. - 'dir' is the pin direction. It indicates whether the pin is - an input or output from the component. - 'data_ptr_addr' is the address of the pointer that the component - will use for the pin. When the pin is linked to a signal, the - pointer at 'data_ptr_addr' will be changed to point to the signal - data location. 'data_ptr_addr' must point to memory allocated by - hal_malloc(). Typically the component allocates space for a data - structure with hal_malloc(), and 'data_ptr_addr' is the address - of a member of that structure. - 'comp_id' is the ID of the component that will 'own' the - variable. Normally it should be the ID of the caller, but in - some cases, a user mode component may be doing setup for a - realtime component, so the ID should be that of the realtime - component that will actually be using the pin. - If successful, the hal_pin_xxx_new() functions return 0. - On failure they return a negative error code. -*/ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -extern int hal_pin_bit_new(const char *name, hal_pin_dir_t dir, - hal_bit_t ** data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_bool()"); -extern int hal_pin_float_new(const char *name, hal_pin_dir_t dir, - hal_float_t ** data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_real()"); -extern int hal_pin_u32_new(const char *name, hal_pin_dir_t dir, - hal_u32_t ** data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_ui32()"); -extern int hal_pin_s32_new(const char *name, hal_pin_dir_t dir, - hal_s32_t ** data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_si32()"); -extern int hal_pin_u64_new(const char *name, hal_pin_dir_t dir, - hal_u64_t ** data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_uint()"); -extern int hal_pin_s64_new(const char *name, hal_pin_dir_t dir, - hal_s64_t ** data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_sint()"); -extern int hal_pin_port_new(const char *name, hal_pin_dir_t dir, - hal_port_t ** data_ptr_addr, int comp_id); - - -/** The hal_pin_XXX_newf family of functions are similar to - hal_pin_XXX_new except that they also do printf-style formatting to compute - the pin name - If successful, the hal_pin_xxx_newf() functions return 0. - On failure they return a negative error code. -*/ -extern int hal_pin_bit_newf(hal_pin_dir_t dir, - hal_bit_t ** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_pin_new_bool()"); -extern int hal_pin_float_newf(hal_pin_dir_t dir, - hal_float_t ** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_pin_new_real()"); -extern int hal_pin_u32_newf(hal_pin_dir_t dir, - hal_u32_t ** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_pin_new_ui32()"); -extern int hal_pin_s32_newf(hal_pin_dir_t dir, - hal_s32_t ** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_pin_new_si32()"); -extern int hal_pin_u64_newf(hal_pin_dir_t dir, - hal_u64_t ** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_pin_new_uint()"); -extern int hal_pin_s64_newf(hal_pin_dir_t dir, - hal_s64_t ** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_pin_new_sint()"); -extern int hal_pin_port_newf(hal_pin_dir_t dir, - hal_port_t** data_ptr_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))); -#pragma GCC diagnostic pop - - -/** 'hal_pin_new()' creates a new 'pin' object. It is a generic - version of the eight functions above. It is provided ONLY for - those special cases where a generic function is needed. It is - STRONGLY recommended that the functions above be used instead, - because they check the type of 'data_ptr_addr' against the pin - type at compile time. Using this function requires a cast of - the 'data_ptr_addr' argument that defeats type checking and can - cause subtle bugs. - 'name', 'dir', 'data_ptr_addr' and 'comp_id' are the same as in - the functions above. - 'type' is the hal type of the new pin - the type of data that - will be passed in/out of the component through the new pin. - If successful, hal_pin_new() returns 0. On failure - it returns a negative error code. -*/ -extern int hal_pin_new(const char *name, hal_type_t type, hal_pin_dir_t dir, - void **data_ptr_addr, int comp_id) __HAL_DEPRECATED("Use hal_pin_new_XXXX()"); +// +// The 'hal_pin_new_xxxx()' functions create a new 'pin' object. +// +// Once a pin has been created, it can be linked to a signal object using +// hal_link(). A pin contains a pointer, and the component that owns the pin +// can dereference the pointer to access whatever signal is linked to the pin. +// (If no signal is linked, it points to a dummy signal.) +// +// There are seven (five) functions, one for each of the data types that the +// HAL supports. Pins may only be linked to signals of the same type. +// +// - 'comp_id' is the ID of the component that will 'own' the variable. +// Normally it should be the ID of the caller, but in some cases, a user +// mode component may be doing setup for a realtime component, so the ID +// should be that of the realtime component that will actually be using the +// pin. +// - 'dir' is the pin direction. It indicates whether the pin is an input or +// output from the component. +// - 'ref' is the address of the pointer that the component will use for the +// pin. When the pin is linked to a signal, the pointer at 'data_ptr_addr' +// will be changed to point to the signal data location. The 'ref' must +// point to memory allocated by hal_malloc(). Typically the component +// allocates space for a data structure with hal_malloc(), and 'ref' is the +// address of a member of that structure. +// - 'def' is the default value of the pin. The unconnected pin's value (any +// direction) will be set to the value 'def'. +// - 'fmt' is the name of the new pin. It must be no longer than HAL_NAME_LEN. +// If there is already a pin with the same name the call will fail. +// +// If successful, the hal_pin_xxx_new() functions return zero (0). On failure +// they return a negative error code. +// +int hal_pin_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_pin_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_pin_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_pin_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_pin_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_pin_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_pin_new_port(int compid, hal_pdir_t dir, hal_port_t *ref, const char *fmt, ...) __HAL_PFMT(4,5); /** There is no 'hal_pin_delete()' function. Once a component has created a pin, that pin remains as long as the component exists. @@ -740,7 +657,7 @@ extern int hal_pin_new(const char *name, hal_type_t type, hal_pin_dir_t dir, original name or the alias. Calling this function with 'alias' set to NULL will remove any existing alias. */ -extern int hal_pin_alias(const char *pin_name, const char *alias); +int hal_pin_alias(const char *pin_name, const char *alias); /*********************************************************************** @@ -764,7 +681,7 @@ extern int hal_pin_alias(const char *pin_name, const char *alias); If successful, 'hal_signal_new() returns 0. On failure it returns a negative error code. */ -extern int hal_signal_new(const char *name, hal_type_t type); +int hal_signal_new(const char *name, hal_type_t type); /** 'hal_signal_delete()' deletes a signal object. Any pins linked to the object are unlinked. @@ -772,7 +689,7 @@ extern int hal_signal_new(const char *name, hal_type_t type); If successful, 'hal_signal_delete()' returns 0. On failure, it returns a negative error code. */ -extern int hal_signal_delete(const char *name); +int hal_signal_delete(const char *name); /** 'hal_link()' links a pin to a signal. 'pin_name' and 'sig_name' are strings containing the pin and signal names. If the pin is already @@ -785,109 +702,61 @@ extern int hal_signal_delete(const char *name); On success, hal_link() returns 0, on failure it returns a negative error code. */ -extern int hal_link(const char *pin_name, const char *sig_name); +int hal_link(const char *pin_name, const char *sig_name); /** 'hal_unlink()' unlinks any signal from the specified pin. 'pin_name' is a string containing the pin name. On success, hal_unlink() returns 0, on failure it returns a negative error code. */ -extern int hal_unlink(const char *pin_name); +int hal_unlink(const char *pin_name); /*********************************************************************** * "PARAMETER" FUNCTIONS * ************************************************************************/ - -/** The 'hal_param_xxx_new()' functions create a new 'parameter' object. - A parameter is a value that is only used inside a component, but may - need to be initialized or adjusted from outside the component to set - up the system properly. - Once a parameter has been created, it's value can be changed using - the 'hal_param_xxx_set()' functions. - There are eight functions, one for each of the data types that - the HAL supports. Pins may only be linked to signals of the same - type. - 'name' is the name of the new parameter. It must be no longer than - .HAL_NAME_LEN. If there is already a parameter with the same - name the call will fail. - 'dir' is the parameter direction. HAL_RO parameters are read only from - outside, and are written to by the component itself, typically to provide a - view "into" the component for testing or troubleshooting. HAL_RW - parameters are writable from outside and also sometimes modified by the - component itself as well. - 'data_addr' is the address where the value of the parameter is to be - stored. 'data_addr' must point to memory allocated by hal_malloc(). - Typically the component allocates space for a data structure with - hal_malloc(), and 'data_addr' is the address of a member of that - structure. Creating the parameter does not initialize or modify the - value at *data_addr - the component should load a reasonable default - value. - 'comp_id' is the ID of the component that will 'own' the parameter. - Normally it should be the ID of the caller, but in some cases, a - user mode component may be doing setup for a realtime component, so - the ID should be that of the realtime component that will actually - be using the parameter. - If successful, the hal_param_xxx_new() functions return 0. - On failure they return a negative error code. -*/ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -extern int hal_param_bit_new(const char *name, hal_param_dir_t dir, - hal_bit_t * data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_bool()"); -extern int hal_param_float_new(const char *name, hal_param_dir_t dir, - hal_float_t * data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_real()"); -extern int hal_param_u32_new(const char *name, hal_param_dir_t dir, - hal_u32_t * data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_ui32()"); -extern int hal_param_s32_new(const char *name, hal_param_dir_t dir, - hal_s32_t * data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_si32()"); -extern int hal_param_u64_new(const char *name, hal_param_dir_t dir, - hal_u64_t * data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_uint()"); -extern int hal_param_s64_new(const char *name, hal_param_dir_t dir, - hal_s64_t * data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_sint()"); - -/** printf_style-style versions of hal_param_XXX_new */ -extern int hal_param_bit_newf(hal_param_dir_t dir, - hal_bit_t * data_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_param_new_bool()"); -extern int hal_param_float_newf(hal_param_dir_t dir, - hal_float_t * data_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_param_new_real()"); -extern int hal_param_u32_newf(hal_param_dir_t dir, - hal_u32_t * data_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_param_new_ui32()"); -extern int hal_param_s32_newf(hal_param_dir_t dir, - hal_s32_t * data_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_param_new_si32()"); -extern int hal_param_u64_newf(hal_param_dir_t dir, - hal_u64_t * data_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_param_new_uint()"); -extern int hal_param_s64_newf(hal_param_dir_t dir, - hal_s64_t * data_addr, int comp_id, const char *fmt, ...) - __attribute__((format(printf,4,5))) __HAL_DEPRECATED("Use hal_param_new_sint()"); -#pragma GCC diagnostic pop - - -/** 'hal_param_new()' creates a new 'parameter' object. It is a generic - version of the eight functions above. It is provided ONLY for those - special cases where a generic function is needed. It is STRONGLY - recommended that the functions above be used instead, because they - check the type of 'data_addr' against the parameter type at compile - time. Using this function requires a cast of the 'data_addr' argument - that defeats type checking and can cause subtle bugs. - 'name', 'data_addr' and 'comp_id' are the same as in the - functions above. - 'type' is the hal type of the new parameter - the type of data - that will be stored in the parameter. - 'dir' is the parameter direction. HAL_RO parameters are read only from - outside, and are written to by the component itself, typically to provide a - view "into" the component for testing or troubleshooting. HAL_RW - parameters are writable from outside and also sometimes modified by the - component itself as well. - If successful, hal_param_new() returns 0. On failure - it returns a negative error code. -*/ -extern int hal_param_new(const char *name, hal_type_t type, hal_param_dir_t dir, - void *data_addr, int comp_id) __HAL_DEPRECATED("Use hal_param_new_XXXX()"); +// +// The 'hal_param_xxx_new()' functions create a new 'parameter' object. +// +// A parameter is a value that is only used inside a component, but may need to +// be initialized or adjusted from outside the component to set up the system +// properly. A parameter is, just like pins an opaque pointer. +// +// Once a parameter has been created, it's value can be changed using the +// appropriate hal_set_XXX() function for the respective type. There are seven +// (five) functions, one for each of the data types that the HAL supports. +// Parameters cannot be linked to signals. +// +// - 'comp_id' is the ID of the component that will 'own' the parameter. +// Normally it should be the ID of the caller, but in some cases, a user +// mode component may be doing setup for a realtime component, so the ID +// should be that of the realtime component that will actually be using the +// parameter. +// - 'dir' is the parameter direction. HAL_RO parameters are read only from +// outside, and are written to by the component itself, typically to +// provide a view "into" the component for testing or troubleshooting. +// HAL_RW parameters are writable from outside and also sometimes modified +// by the component itself as well. +// - 'ref' is the address where the pointer reference of where the parameter is +// to be stored. 'ref' must point to memory allocated by hal_malloc(). +// Typically the component allocates space for a data structure with +// hal_malloc(), and 'ref' is the address of a member of that structure. +// - 'def' is the default value of the parameter. The default value willbe set +// when the parameter is created. +// - 'fmt' is the name of the new parameter. It must be no longer than +// HAL_NAME_LEN. If there is already a parameter with the same name the +// call will fail. +// Both parameters and pins share the name space and a name must be unique. +// +// If successful, the hal_param_new_xxxx() functions return zero (0). On +// failure they return a negative error code. +// +int hal_param_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_param_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_param_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_param_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_param_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_param_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real def, const char *fmt, ...) __HAL_PFMT(5,6); +int hal_param_new_fake(int compid, hal_refs_u *refs); /** There is no 'hal_param_delete()' function. Once a component has created a parameter, that parameter remains as long as the @@ -895,86 +764,12 @@ extern int hal_param_new(const char *name, hal_type_t type, hal_param_dir_t dir, removed when the component calls 'hal_exit()'. */ -/** The 'hal_param_xxx_set()' functions modify the value of a parameter. - 'name' is the name of the parameter that is to be set. The - parameter type must match the function type, and the parameter - must not be read-only. - 'value' is the value to be loaded into the parameter. - On success, the hal_param_xxx_set() functions return 0, - and on failure they return a negative error code. -*/ -int hal_param_bit_set(const char *name, int value) __HAL_DEPRECATED("Use hal_set_p()"); -int hal_param_float_set(const char *name, double value) __HAL_DEPRECATED("Use hal_set_p()"); -int hal_param_u32_set(const char *name, unsigned long value) __HAL_DEPRECATED("Use hal_set_p()"); -int hal_param_s32_set(const char *name, signed long value) __HAL_DEPRECATED("Use hal_set_p()"); -int hal_param_u64_set(const char *name, unsigned long value) __HAL_DEPRECATED("Use hal_set_p()"); -int hal_param_s64_set(const char *name, signed long value) __HAL_DEPRECATED("Use hal_set_p()"); - /** 'hal_param_alias()' assigns an alternate name, aka an alias, to a parameter. Once assigned, the parameter can be referred to by either its original name or the alias. Calling this function with 'alias' set to NULL will remove any existing alias. */ -extern int hal_param_alias(const char *pin_name, const char *alias); - -/** 'hal_param_set()' is a generic function that sets the value of a - parameter. It is provided ONLY for those special cases where a - generic function is needed. It is STRONGLY recommended that the - functions above be used instead, because they are simpler and less - prone to errors. - 'name', is the same as in the functions above. - 'type' is the hal type of the the data at *value_addr, and must - match the type of the parameter. The parameter must not be - read only. - 'value_addr' is a pointer to the new value of the parameter. - The data at that location will be interpreted according to the - type of the parameter. - If successful, hal_param_set() returns 0. On failure - it returns a negative error code. -*/ -int hal_param_set(const char *name, hal_type_t type, void *value_addr) __HAL_DEPRECATED("Use hal_set_p()"); - -/*********************************************************************** -* PIN/SIG/PARAM GETTER FUNCTIONS * -************************************************************************/ - -/** 'hal_get_pin_value_by_name()' gets the value of any arbitrary HAL pin by - * pin name. - * - * The 'type' and 'data' args are pointers to the returned values. The function - * returns 0 if successful, or -1 on error. If 'connected' is non-NULL, its - * value will be true if a signal is connected. - */ - -// We don't want our library to emit the deprecation warning. -// We already know it and need to provide them until removed. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -extern int hal_get_pin_value_by_name( - const char *name, hal_type_t *type, hal_data_u **data, bool *connected) __HAL_DEPRECATED("Use hal_get_p()"); - -/** 'hal_get_signal_value_by_name()' returns the value of any arbitrary HAL - * signal by signal name. - * - * The 'type' and 'data' args are pointers to the returned values. The function - * returns 0 if successful, or -1 on error. If 'has_writers' is non-NULL, its - * value will be true if the signal has writers. - */ - -extern int hal_get_signal_value_by_name( - const char *name, hal_type_t *type, hal_data_u **data, bool *has_writers) __HAL_DEPRECATED("Use hal_get_s()"); - -/** 'hal_get_param_value_by_name()' returns the value of any arbitrary HAL - * parameter by parameter name. - * - * The 'type' and 'data' args are pointers to the returned values. The function - * returns 0 if successful, or -1 on error. - */ - -extern int hal_get_param_value_by_name( - const char *name, hal_type_t *type, hal_data_u **data) __HAL_DEPRECATED("Use hal_get_p()"); -#pragma GCC diagnostic pop - +int hal_param_alias(const char *pin_name, const char *alias); /*********************************************************************** * EXECUTION RELATED FUNCTIONS * @@ -998,9 +793,6 @@ extern int hal_get_param_value_by_name( C function will be exported several times with different HAL names, perhaps to deal with multiple instances of a hardware device. - 'uses_fp' is deprecated and ignored. All threads now - unconditionally save and restore FPU/SSE state. This - parameter will be removed in a future version. 'reentrant' should be zero unless the function (and any hardware it accesses) is completely reentrant. If reentrant is non-zero, the function may be prempted and called again @@ -1012,16 +804,16 @@ extern int hal_get_param_value_by_name( Call only from realtime init code, not from user space or realtime code. */ -extern int hal_export_funct(const char *name, void (*funct) (void *, long), - void *arg, int uses_fp, int reentrant, int comp_id); +int hal_export_funct(const char *name, void (*funct) (void *, long), + void *arg, int reentrant, int comp_id); /** hal_export_functf is similar to hal_export_funct except that it also does printf-style formatting to compute the function name. If successful, it returns 0. On failure it returns a negative error code. */ -extern int hal_export_functf(void (*funct) (void *, long), - void *arg, int uses_fp, int reentrant, int comp_id, const char *fmt, ...); +int hal_export_functf(void (*funct) (void *, long), + void *arg, int reentrant, int comp_id, const char *fmt, ...); /** hal_create_thread() establishes a realtime thread that will execute one or more HAL functions periodically. @@ -1035,16 +827,12 @@ extern int hal_export_functf(void (*funct) (void *, long), threads that are created later, so creating them from fastest to slowest results in rate monotonic priority scheduling, usually a good thing. - 'uses_fp' is deprecated and ignored. All threads now - unconditionally save and restore FPU/SSE state. This - parameter will be removed in a future version. On success, hal_create_thread() returns a positive integer thread ID. On failure, returns an error code as defined above. Call only from realtime init code, not from user space or realtime code. */ -extern int hal_create_thread(const char *name, unsigned long period_nsec, - int uses_fp); +int hal_create_thread(const char *name, unsigned long period_nsec); /** hal_thread_delete() deletes a realtime thread. 'name' is the name of the thread, which must have been created @@ -1054,7 +842,7 @@ extern int hal_create_thread(const char *name, unsigned long period_nsec, Call only from realtime init code, not from user space or realtime code. */ -extern int hal_thread_delete(const char *name); +int hal_thread_delete(const char *name); #endif /* RTAPI */ @@ -1079,8 +867,7 @@ extern int hal_thread_delete(const char *name); only from within user space or init code, not from realtime code. */ -extern int hal_add_funct_to_thread(const char *funct_name, const char *thread_name, - int position); +int hal_add_funct_to_thread(const char *funct_name, const char *thread_name, int position); /** hal_init_funct_to_thread() registers a function to run exactly once, in the realtime context of 'thread_name', before the thread executes @@ -1099,7 +886,7 @@ extern int hal_add_funct_to_thread(const char *funct_name, const char *thread_na have no effect. Returns 0, -EALREADY, or a negative error code. Call only from user space or init code, not from realtime code. */ -extern int hal_init_funct_to_thread(const char *funct_name, const char *thread_name, int position); +int hal_init_funct_to_thread(const char *funct_name, const char *thread_name, int position); /** hal_del_funct_from_thread() removes a function from a thread. 'funct_name' is the name of the function, as specified in @@ -1110,14 +897,14 @@ extern int hal_init_funct_to_thread(const char *funct_name, const char *thread_n only from within user space or init code, not from realtime code. */ -extern int hal_del_funct_from_thread(const char *funct_name, const char *thread_name); +int hal_del_funct_from_thread(const char *funct_name, const char *thread_name); /** hal_start_threads() starts all threads that have been created. This is the point at which realtime functions start being called. On success it returns 0, on failure a negative error code. */ -extern int hal_start_threads(void); +int hal_start_threads(void); /** hal_stop_threads() stops all threads that were previously started by hal_start_threads(). It should be called before @@ -1125,7 +912,7 @@ extern int hal_start_threads(void); On success it returns 0, on failure a negative error code. */ -extern int hal_stop_threads(void); +int hal_stop_threads(void); /** HAL 'constructor' typedef If it is not NULL, this points to a function which can construct a new @@ -1136,7 +923,7 @@ typedef int(*constructor)(const char *prefix, const char *arg); /** hal_set_constructor() sets the constructor function for this component */ -extern int hal_set_constructor(int comp_id, constructor make); +int hal_set_constructor(int comp_id, constructor make); @@ -1161,7 +948,7 @@ extern int hal_set_constructor(int comp_id, constructor make); true: count bytes were read into dest false: no bytes were read into dest */ -extern bool hal_port_read(const hal_port_t *port, char* dest, unsigned count); +bool hal_port_read(const hal_port_t port, char* dest, unsigned count); /** hal_port_peek operates the same as hal_port_read but no bytes are consumed @@ -1171,7 +958,7 @@ extern bool hal_port_read(const hal_port_t *port, char* dest, unsigned count); true: count bytes were read into dest false: no bytes were read into dest */ -extern bool hal_port_peek(const hal_port_t *port, char* dest, unsigned count); +bool hal_port_peek(const hal_port_t port, char* dest, unsigned count); /** hal_port_peek_commit advances the read position in the port buffer by count bytes. A hal_port_peek followed by a hal_port_peek_commit @@ -1182,7 +969,7 @@ extern bool hal_port_peek(const hal_port_t *port, char* dest, unsigned count); true: count readable bytes were skipped and are no longer accessible false: no bytes wer skipped */ -extern bool hal_port_peek_commit(const hal_port_t *port, unsigned count); +bool hal_port_peek_commit(const hal_port_t port, unsigned count); /** hal_port_write writes count bytes from src into the port. This function should only be called by the component that owns @@ -1192,40 +979,40 @@ extern bool hal_port_peek_commit(const hal_port_t *port, unsigned count); false: no bytes were written into dest */ -extern bool hal_port_write(const hal_port_t *port, const char* src, unsigned count); +bool hal_port_write(const hal_port_t port, const char* src, unsigned count); /** hal_port_readable returns the number of bytes available for reading from the port. */ -extern unsigned hal_port_readable(const hal_port_t *port); +unsigned hal_port_readable(const hal_port_t port); /** hal_port_writable returns the number of bytes that can be written into the port */ -extern unsigned hal_port_writable(const hal_port_t *port); +unsigned hal_port_writable(const hal_port_t port); /** hal_port_buffer_size returns the total number of bytes that a port can buffer */ -extern unsigned hal_port_buffer_size(const hal_port_t *port); +unsigned hal_port_buffer_size(const hal_port_t port); /** hal_port_clear emptys a given port of all data without consuming any of it. hal_port_clear should only be called by a reader */ -extern void hal_port_clear(const hal_port_t *port); +void hal_port_clear(const hal_port_t port); #ifdef ULAPI /** hal_port_wait_readable spin waits on a port until it has at least count bytes available for reading, or *stop > 0 */ -extern void hal_port_wait_readable(hal_port_t** port, unsigned count, sig_atomic_t* stop); +void hal_port_wait_readable(const hal_port_t port, unsigned count, sig_atomic_t *stop); /** hal_port_wait_writable spin waits on a port until it has at least count bytes available for writing or *stop > 0 */ -extern void hal_port_wait_writable(hal_port_t** port, unsigned count, sig_atomic_t* stop); +void hal_port_wait_writable(const hal_port_t port, unsigned count, sig_atomic_t *stop); #endif @@ -1239,10 +1026,8 @@ extern void hal_port_wait_writable(hal_port_t** port, unsigned count, sig_atomic typedef union hal_stream_data { rtapi_real f; rtapi_bool b; - rtapi_s32 s; - rtapi_u32 u; - rtapi_sint l; - rtapi_uint k; + union { rtapi_sint s, l; }; + union { rtapi_uint u, k; }; } hal_stream_data_u; typedef hal_stream_data_u *hal_stream_data_ptr_u; @@ -1257,34 +1042,34 @@ typedef hal_stream_t *hal_stream_ptr_t; #define HAL_STREAM_MAX_PINS (21) /** create and attach a stream */ -extern int hal_stream_create(hal_stream_t *stream, int comp, int key, unsigned depth, const char *typestring); +int hal_stream_create(hal_stream_t *stream, int comp, int key, unsigned depth, const char *typestring); /** detach and destroy an open stream */ -extern void hal_stream_destroy(hal_stream_t *stream); +void hal_stream_destroy(hal_stream_t *stream); /** attach to an existing stream */ -extern int hal_stream_attach(hal_stream_t *stream, int comp, int key, const char *typestring); +int hal_stream_attach(hal_stream_t *stream, int comp, int key, const char *typestring); /** detach from an open stream */ -extern int hal_stream_detach(hal_stream_t *stream); +int hal_stream_detach(hal_stream_t *stream); /** stream introspection */ -extern int hal_stream_element_count(hal_stream_t *stream); -extern hal_type_t hal_stream_element_type(hal_stream_t *stream, int idx); +int hal_stream_element_count(hal_stream_t *stream); +hal_type_t hal_stream_element_type(hal_stream_t *stream, int idx); // only one reader and one writer is allowed. -extern int hal_stream_read(hal_stream_t *stream, hal_stream_data_u *buf, unsigned *sampleno); -extern bool hal_stream_readable(hal_stream_t *stream); -extern int hal_stream_depth(hal_stream_t *stream); -extern unsigned hal_stream_maxdepth(hal_stream_t *stream); -extern int hal_stream_num_underruns(hal_stream_t *stream); -extern int hal_stream_num_overruns(hal_stream_t *stream); +int hal_stream_read(hal_stream_t *stream, hal_stream_data_u *buf, unsigned *sampleno); +bool hal_stream_readable(hal_stream_t *stream); +int hal_stream_depth(hal_stream_t *stream); +unsigned hal_stream_maxdepth(hal_stream_t *stream); +int hal_stream_num_underruns(hal_stream_t *stream); +int hal_stream_num_overruns(hal_stream_t *stream); #ifdef ULAPI -extern void hal_stream_wait_readable(hal_stream_t *stream, sig_atomic_t *stop); +void hal_stream_wait_readable(hal_stream_t *stream, sig_atomic_t *stop); #endif -extern int hal_stream_write(hal_stream_t *stream, hal_stream_data_u *buf); -extern bool hal_stream_writable(hal_stream_t *stream); +int hal_stream_write(hal_stream_t *stream, hal_stream_data_u *buf); +bool hal_stream_writable(hal_stream_t *stream); #ifdef ULAPI -extern void hal_stream_wait_writable(hal_stream_t *stream, sig_atomic_t *stop); +void hal_stream_wait_writable(hal_stream_t *stream, sig_atomic_t *stop); #endif @@ -1293,17 +1078,6 @@ extern void hal_stream_wait_writable(hal_stream_t *stream, sig_atomic_t *stop); ************************************************************************/ -/** HAL_STATIC_ASSERT wrapper for compile time asserts -*/ -#if __STDC_VERSION__ >= 202311L || defined(__cplusplus) -#define HAL_STATIC_ASSERT(expression, message) static_assert((expression), message) -#else -/* _Static_assert: GCC extension, in C standard since C11, deprecated in favour of - static_assert (like C++) from C23 onwards*/ -#define HAL_STATIC_ASSERT(expression, message) _Static_assert((expression), message) -#endif - - /** hal_extend_counter() extends a counter value with nbits to 64 bits. For some hardware counters or encoders it may be desireable to @@ -1644,4 +1418,8 @@ int hal_enforce_exact_base_period(void); RTAPI_END_DECLS +#undef __HAL_PFMT +#undef __HAL_ALWAYS_INLINE +#undef __HAL_DEPRECATED + #endif /* HAL_H */ diff --git a/src/hal/hal_lib.c b/src/hal/hal_lib.c index ce5cbc68713..d05c01d59f6 100644 --- a/src/hal/hal_lib.c +++ b/src/hal/hal_lib.c @@ -778,10 +778,10 @@ const char *hal_strerror(int err) } } -char *hal_comp_name(int comp_id) +const char *hal_comp_name(int comp_id) { hal_comp_t *comp; - char *result = NULL; + const char *result = NULL; halpr_mutex_acquire(); comp = halpr_find_comp_by_id(comp_id); if(comp) result = comp->name; @@ -835,240 +835,9 @@ unsigned char hal_get_lock() { * "PIN" FUNCTIONS * ************************************************************************/ -/* wrapper functs for typed pins - these call the generic funct below */ - -// We don't want our library to emit the deprecation warning. -// We already know it and need to provide them until removed. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -int hal_pin_bit_new(const char *name, hal_pin_dir_t dir, - hal_bit_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_BIT, dir, (void **) data_ptr_addr, comp_id); -} - -int hal_pin_float_new(const char *name, hal_pin_dir_t dir, - hal_float_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_FLOAT, dir, (void **) data_ptr_addr, - comp_id); -} - -int hal_pin_u32_new(const char *name, hal_pin_dir_t dir, - hal_u32_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_U32, dir, (void **) data_ptr_addr, comp_id); -} - -int hal_pin_s32_new(const char *name, hal_pin_dir_t dir, - hal_s32_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_S32, dir, (void **) data_ptr_addr, comp_id); -} - -int hal_pin_u64_new(const char *name, hal_pin_dir_t dir, - hal_u64_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_U64, dir, (void **) data_ptr_addr, comp_id); -} - -int hal_pin_s64_new(const char *name, hal_pin_dir_t dir, - hal_s64_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_S64, dir, (void **) data_ptr_addr, comp_id); -} - -int hal_pin_port_new(const char *name, hal_pin_dir_t dir, - hal_port_t ** data_ptr_addr, int comp_id) -{ - return hal_pin_new(name, HAL_PORT, dir, (void **)data_ptr_addr, comp_id); -} - - -static int hal_pin_newfv(hal_type_t type, hal_pin_dir_t dir, - void ** data_ptr_addr, int comp_id, const char *fmt, va_list ap) -{ - char name[HAL_NAME_LEN + 1]; - int sz; - sz = rtapi_vsnprintf(name, sizeof(name), fmt, ap); - if(sz == -1 || sz > HAL_NAME_LEN) { - rtapi_print_msg(RTAPI_MSG_ERR, - "hal_pin_newfv: length %d too long for name starting '%s'\n", - sz, name); - return -ENOMEM; - } - return hal_pin_new(name, type, dir, data_ptr_addr, comp_id); -} - -int hal_pin_bit_newf(hal_pin_dir_t dir, - hal_bit_t ** data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_BIT, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_pin_float_newf(hal_pin_dir_t dir, - hal_float_t ** data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_FLOAT, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_pin_u32_newf(hal_pin_dir_t dir, - hal_u32_t ** data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_U32, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_pin_s32_newf(hal_pin_dir_t dir, - hal_s32_t ** data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_S32, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_pin_u64_newf(hal_pin_dir_t dir, - hal_u64_t ** data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_U64, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_pin_s64_newf(hal_pin_dir_t dir, - hal_s64_t ** data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_S64, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} -#pragma GCC diagnostic pop - -int hal_pin_port_newf(hal_pin_dir_t dir, - hal_port_t **data_ptr_addr, int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_pin_newfv(HAL_PORT, dir, (void**)data_ptr_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -// *** New interface *** - -int hal_pin_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool def, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_BIT, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - if(ret) - return ret; - hal_set_bool(*ref, def); - return 0; -} - -int hal_pin_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 def, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_S32, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - if(ret) - return ret; - hal_set_si32(*ref, def); - return 0; -} - -int hal_pin_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 def, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_U32, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - if(ret) - return ret; - hal_set_ui32(*ref, def); - return 0; -} - -int hal_pin_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint def, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_S64, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - if(ret) - return ret; - hal_set_sint(*ref, def); - return 0; -} - -int hal_pin_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint def, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_U64, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - if(ret) - return ret; - hal_set_uint(*ref, def); - return 0; -} - -int hal_pin_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real def, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_FLOAT, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - if(ret) - return ret; - hal_set_real(*ref, def); - return 0; -} - -// Note: port has no initial default as it is an 'internal' reference -//int hal_pin_new_port(int compid, hal_pdir_t dir, hal_port_t *ref, const char *fmt, ...) -// FIXME: This needs to change into hal_port_t argument when we break the API -// It is here so we may add halmodule without too much trouble until then. -int hal_pin_new_port(int compid, hal_pdir_t dir, hal_sint_t *ref, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int ret = hal_pin_newfv(HAL_PORT, dir, (void**)ref, compid, fmt, ap); - va_end(ap); - return ret; -} - /* this is a generic function that does the majority of the work. */ -int hal_pin_new(const char *name, hal_type_t type, hal_pin_dir_t dir, - void **data_ptr_addr, int comp_id) +static int halpr_pin_new(const char *name, hal_type_t type, hal_pdir_t dir, void **data_ptr_addr, int comp_id) { rtapi_intptr_t *prev, next; int cmp; @@ -1081,18 +850,25 @@ int hal_pin_new(const char *name, hal_type_t type, hal_pin_dir_t dir, return -EFAULT; } - if(*data_ptr_addr) + if(*data_ptr_addr) { rtapi_print_msg(RTAPI_MSG_ERR, "HAL: ERROR: pin_new(%s) called with already-initialized memory\n", name); } - if (type != HAL_BIT && type != HAL_FLOAT && type != HAL_S32 && type != HAL_U32 && type != HAL_S64 && type != HAL_U64 && type != HAL_PORT) { - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: pin type not one of HAL_BIT, HAL_FLOAT, HAL_S32, HAL_U32, HAL_S64, HAL_U64 or HAL_PORT\n"); - return -EINVAL; + switch(type) { + case HAL_BOOL: + case HAL_REAL: + case HAL_SINT: + case HAL_UINT: + case HAL_PORT: + break; + default: + rtapi_print_msg(RTAPI_MSG_ERR, + "HAL: ERROR: pin type not one of HAL_BOOL, HAL_REAL, HAL_SINT, HAL_UINT or HAL_PORT\n"); + return -EINVAL; } - + if(dir != HAL_IN && dir != HAL_OUT && dir != HAL_IO) { rtapi_print_msg(RTAPI_MSG_ERR, "HAL: ERROR: pin direction not one of HAL_IN, HAL_OUT, or HAL_IO\n"); @@ -1208,6 +984,110 @@ int hal_pin_new(const char *name, hal_type_t type, hal_pin_dir_t dir, } } +/* wrapper functs for typed pins - these call the generic funct below */ + +static int hal_pin_newfv(hal_type_t type, hal_pdir_t dir, + void ** data_ptr_addr, int comp_id, const char *fmt, va_list ap) +{ + char name[HAL_NAME_LEN + 1]; + int sz; + sz = rtapi_vsnprintf(name, sizeof(name), fmt, ap); + if(sz == -1 || sz > HAL_NAME_LEN) { + rtapi_print_msg(RTAPI_MSG_ERR, + "hal_pin_newfv: length %d too long for name starting '%s'\n", + sz, name); + return -ENOMEM; + } + return halpr_pin_new(name, type, dir, data_ptr_addr, comp_id); +} + +// *** New interface *** + +int hal_pin_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool def, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_BOOL, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_bool(*ref, def); + return 0; +} + +int hal_pin_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 def, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_SINT, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_si32(*ref, def); + return 0; +} + +int hal_pin_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 def, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_UINT, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_ui32(*ref, def); + return 0; +} + +int hal_pin_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint def, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_SINT, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_sint(*ref, def); + return 0; +} + +int hal_pin_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint def, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_UINT, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_uint(*ref, def); + return 0; +} + +int hal_pin_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real def, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_REAL, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_real(*ref, def); + return 0; +} + +// Note: port has no initial default as it is an 'internal' reference +int hal_pin_new_port(int compid, hal_pdir_t dir, hal_port_t *ref, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + int ret = hal_pin_newfv(HAL_PORT, dir, (void**)ref, compid, fmt, ap); + va_end(ap); + if(ret) + return ret; + hal_set_port(*ref, 0); // By definition, a port starts unallocated + return 0; +} + int hal_pin_alias(const char *pin_name, const char *alias) { rtapi_intptr_t *prev, next; @@ -1379,15 +1259,14 @@ int hal_signal_new(const char *name, hal_type_t type) */ switch (type) { case HAL_BOOL: - case HAL_S32: - case HAL_U32: case HAL_SINT: case HAL_UINT: case HAL_REAL: case HAL_PORT: data_addr = shmalloc_up(sizeof(*data_addr)); // Initialize the signal value - memset(data_addr, 0, sizeof(*data_addr)); + if(NULL != data_addr) + memset(data_addr, 0, sizeof(*data_addr)); break; default: halpr_mutex_release(); @@ -1604,8 +1483,6 @@ int hal_link(const char *pin_name, const char *sig_name) switch (pin->type) { case HAL_BOOL: - case HAL_S32: - case HAL_U32: case HAL_SINT: case HAL_UINT: case HAL_REAL: @@ -1683,126 +1560,6 @@ int hal_unlink(const char *pin_name) /* wrapper functs for typed params - these call the generic funct below */ -// We don't want our library to emit the deprecation warning. -// We already know it and need to provide them until removed. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -int hal_param_bit_new(const char *name, hal_param_dir_t dir, hal_bit_t * data_addr, - int comp_id) -{ - return hal_param_new(name, HAL_BIT, dir, (void *) data_addr, comp_id); -} - -int hal_param_float_new(const char *name, hal_param_dir_t dir, hal_float_t * data_addr, - int comp_id) -{ - return hal_param_new(name, HAL_FLOAT, dir, (void *) data_addr, comp_id); -} - -int hal_param_u32_new(const char *name, hal_param_dir_t dir, hal_u32_t * data_addr, - int comp_id) -{ - return hal_param_new(name, HAL_U32, dir, (void *) data_addr, comp_id); -} - -int hal_param_s32_new(const char *name, hal_param_dir_t dir, hal_s32_t * data_addr, - int comp_id) -{ - return hal_param_new(name, HAL_S32, dir, (void *) data_addr, comp_id); -} - -int hal_param_u64_new(const char *name, hal_param_dir_t dir, hal_u64_t * data_addr, - int comp_id) -{ - return hal_param_new(name, HAL_U64, dir, (void *) data_addr, comp_id); -} -int hal_param_s64_new(const char *name, hal_param_dir_t dir, hal_s64_t * data_addr, - int comp_id) -{ - return hal_param_new(name, HAL_S64, dir, (void *) data_addr, comp_id); -} - -static int hal_param_newfv(hal_type_t type, hal_param_dir_t dir, - void *data_addr, int comp_id, const char *fmt, va_list ap) { - char name[HAL_NAME_LEN + 1]; - int sz; - sz = rtapi_vsnprintf(name, sizeof(name), fmt, ap); - if(sz == -1 || sz > HAL_NAME_LEN) { - rtapi_print_msg(RTAPI_MSG_ERR, - "hal_param_newfv: length %d too long for name starting '%s'\n", - sz, name); - return -ENOMEM; - } - return hal_param_new(name, type, dir, (void *) data_addr, comp_id); -} - -int hal_param_bit_newf(hal_param_dir_t dir, hal_bit_t * data_addr, - int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_param_newfv(HAL_BIT, dir, (void*)data_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_param_float_newf(hal_param_dir_t dir, hal_float_t * data_addr, - int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_param_newfv(HAL_FLOAT, dir, (void*)data_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_param_u32_newf(hal_param_dir_t dir, hal_u32_t * data_addr, - int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_param_newfv(HAL_U32, dir, (void*)data_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_param_s32_newf(hal_param_dir_t dir, hal_s32_t * data_addr, - int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_param_newfv(HAL_S32, dir, (void*)data_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_param_u64_newf(hal_param_dir_t dir, hal_u64_t * data_addr, - int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_param_newfv(HAL_U64, dir, (void*)data_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} - -int hal_param_s64_newf(hal_param_dir_t dir, hal_s64_t * data_addr, - int comp_id, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = hal_param_newfv(HAL_S64, dir, (void*)data_addr, comp_id, fmt, ap); - va_end(ap); - return ret; -} -#pragma GCC diagnostic pop - /* this is a generic function that does the majority of the work. */ // The old API parameter style uses the 'data_addr' as the actual data storage @@ -1828,8 +1585,6 @@ static int hal_param_new_anyapi(const char *name, hal_type_t type, hal_pdir_t di case HAL_REAL: case HAL_SINT: case HAL_UINT: - case HAL_S32: - case HAL_U32: break; default: rtapi_print_msg(RTAPI_MSG_ERR, @@ -1951,13 +1706,6 @@ static int hal_param_new_anyapi(const char *name, hal_type_t type, hal_pdir_t di } } -// Old API interface -int hal_param_new(const char *name, hal_type_t type, hal_pdir_t dir, void *data_addr, - int comp_id) -{ - return hal_param_new_anyapi(name, type, dir, data_addr, comp_id, 0); -} - // New API interface only used locally static int hal_param_new_newapi(hal_type_t type, hal_pdir_t dir, void *data_addr, int comp_id, const char *fmt, va_list ap) @@ -1979,7 +1727,7 @@ int hal_param_new_bool(int compid, hal_pdir_t dir, hal_bool_t *ref, rtapi_bool d { va_list ap; va_start(ap, fmt); - int ret = hal_param_new_newapi(HAL_BIT, dir, ref, compid, fmt, ap); + int ret = hal_param_new_newapi(HAL_BOOL, dir, ref, compid, fmt, ap); va_end(ap); if(ret) return ret; @@ -1991,7 +1739,7 @@ int hal_param_new_si32(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_s32 de { va_list ap; va_start(ap, fmt); - int ret = hal_param_new_newapi(HAL_S32, dir, ref, compid, fmt, ap); + int ret = hal_param_new_newapi(HAL_SINT, dir, ref, compid, fmt, ap); va_end(ap); if(ret) return ret; @@ -2003,7 +1751,7 @@ int hal_param_new_ui32(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_u32 de { va_list ap; va_start(ap, fmt); - int ret = hal_param_new_newapi(HAL_U32, dir, ref, compid, fmt, ap); + int ret = hal_param_new_newapi(HAL_UINT, dir, ref, compid, fmt, ap); va_end(ap); if(ret) return ret; @@ -2015,7 +1763,7 @@ int hal_param_new_sint(int compid, hal_pdir_t dir, hal_sint_t *ref, rtapi_sint d { va_list ap; va_start(ap, fmt); - int ret = hal_param_new_newapi(HAL_S64, dir, ref, compid, fmt, ap); + int ret = hal_param_new_newapi(HAL_SINT, dir, ref, compid, fmt, ap); va_end(ap); if(ret) return ret; @@ -2027,7 +1775,7 @@ int hal_param_new_uint(int compid, hal_pdir_t dir, hal_uint_t *ref, rtapi_uint d { va_list ap; va_start(ap, fmt); - int ret = hal_param_new_newapi(HAL_U64, dir, ref, compid, fmt, ap); + int ret = hal_param_new_newapi(HAL_UINT, dir, ref, compid, fmt, ap); va_end(ap); if(ret) return ret; @@ -2039,7 +1787,7 @@ int hal_param_new_real(int compid, hal_pdir_t dir, hal_real_t *ref, rtapi_real d { va_list ap; va_start(ap, fmt); - int ret = hal_param_new_newapi(HAL_FLOAT, dir, ref, compid, fmt, ap); + int ret = hal_param_new_newapi(HAL_REAL, dir, ref, compid, fmt, ap); va_end(ap); if(ret) return ret; @@ -2064,125 +1812,6 @@ int hal_param_new_fake(int compid, hal_refs_u *ref) return 0; } -/* wrapper functs for typed params - these call the generic funct below */ - -// We don't want our library to emit the deprecation warning. -// We already know it and need to provide them until removed. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -int hal_param_bit_set(const char *name, int value) -{ - return hal_param_set(name, HAL_BIT, &value); -} - -int hal_param_float_set(const char *name, double value) -{ - return hal_param_set(name, HAL_FLOAT, &value); -} - -int hal_param_u32_set(const char *name, unsigned long value) -{ - return hal_param_set(name, HAL_U32, &value); -} - -int hal_param_s32_set(const char *name, signed long value) -{ - return hal_param_set(name, HAL_S32, &value); -} - -int hal_param_u64_set(const char *name, unsigned long value) -{ - return hal_param_set(name, HAL_U64, &value); -} - -int hal_param_s64_set(const char *name, signed long value) -{ - return hal_param_set(name, HAL_S64, &value); -} - -/* this is a generic function that does the majority of the work */ - -int hal_param_set(const char *name, hal_type_t type, void *value_addr) -{ - hal_param_t *param; - void *d_ptr; - - if (hal_data == NULL) { - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: param_set called before init\n"); - return -EFAULT; - } - - if (hal_data->lock & HAL_LOCK_PARAMS) { - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: param_set called while HAL locked\n"); - return -EPERM; - } - - rtapi_print_msg(RTAPI_MSG_DBG, "HAL: setting parameter '%s'\n", name); - /* get mutex before accessing shared data */ - halpr_mutex_acquire(); - - /* search param list for name */ - param = halpr_find_param_by_name(name); - if (param == NULL) { - /* parameter not found */ - halpr_mutex_release(); - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: parameter '%s' not found\n", name); - return -EINVAL; - } - /* found it, is type compatible? */ - if (param->type != type) { - halpr_mutex_release(); - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: type mismatch setting param '%s'\n", name); - return -EINVAL; - } - /* is it read only? */ - if (param->dir == HAL_RO) { - halpr_mutex_release(); - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: param '%s' is not writable\n", name); - return -EINVAL; - } - /* everything is OK, set the value */ - d_ptr = SHMPTR(param->data_ptr); - switch (param->type) { - case HAL_BIT: - if (*((int *) value_addr) == 0) { - *(hal_bit_t *) (d_ptr) = 0; - } else { - *(hal_bit_t *) (d_ptr) = 1; - } - break; - case HAL_FLOAT: - *((hal_float_t *) (d_ptr)) = *((double *) (value_addr)); - break; - case HAL_S32: - *((hal_s32_t *) (d_ptr)) = *((signed long *) (value_addr)); - break; - case HAL_U32: - *((hal_u32_t *) (d_ptr)) = *((unsigned long *) (value_addr)); - break; - case HAL_S64: - *((hal_s64_t *) (d_ptr)) = *((signed long *) (value_addr)); - break; - case HAL_U64: - *((hal_u64_t *) (d_ptr)) = *((unsigned long *) (value_addr)); - break; - default: - /* Shouldn't get here, but just in case... */ - halpr_mutex_release(); - rtapi_print_msg(RTAPI_MSG_ERR, - "HAL: ERROR: bad type %d setting param\n", param->type); - return -EINVAL; - } - halpr_mutex_release(); - return 0; -} -#pragma GCC diagnostic pop - int hal_param_alias(const char *param_name, const char *alias) { rtapi_intptr_t *prev, next; @@ -2307,62 +1936,6 @@ int hal_param_alias(const char *param_name, const char *alias) } } -/*********************************************************************** -* PIN/SIG/PARAM GETTER FUNCTIONS * -************************************************************************/ - -// We don't want our library to emit the deprecation warning. -// We already know it and need to provide them until removed. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -int hal_get_pin_value_by_name( - const char *hal_name, hal_type_t *type, hal_data_u **data, bool *connected) -{ - hal_pin_t *pin; - hal_sig_t *sig; - if ((pin = halpr_find_pin_by_name(hal_name)) == NULL) - return -1; - - if (connected != NULL) - *connected = pin && pin->signal; - *type = pin->type; - if (pin->signal != 0) { - sig = (hal_sig_t *) SHMPTR(pin->signal); - *data = (hal_data_u *) SHMPTR(sig->data_ptr); - } else { - *data = (hal_data_u *) &(pin->dummysig); - } - return 0; -} - -int hal_get_signal_value_by_name( - const char *hal_name, hal_type_t *type, hal_data_u **data, bool *has_writers) -{ - hal_sig_t *sig; - if ((sig = halpr_find_sig_by_name(hal_name)) == NULL) - return -1; - - if (has_writers != NULL) - *has_writers = !!sig->writers; - *type = sig->type; - *data = (hal_data_u *) SHMPTR(sig->data_ptr); - return 0; -} - -int hal_get_param_value_by_name( - const char *hal_name, hal_type_t *type, hal_data_u **data) -{ - hal_param_t *param; - if ((param = halpr_find_param_by_name(hal_name)) == NULL) - return -1; - - *type = param->type; - *data = (hal_data_u *) SHMPTR(param->data_ptr); - return 0; -} -#pragma GCC diagnostic pop - - /*********************************************************************** * EXECUTION RELATED FUNCTIONS * ************************************************************************/ @@ -2370,7 +1943,7 @@ int hal_get_param_value_by_name( #ifdef RTAPI static int hal_export_functfv(void (*funct) (void *, long), - void *arg, int uses_fp, int reentrant, int comp_id, const char *fmt, va_list ap) + void *arg, int reentrant, int comp_id, const char *fmt, va_list ap) { char name[HAL_NAME_LEN + 1]; int sz; @@ -2381,24 +1954,23 @@ static int hal_export_functfv(void (*funct) (void *, long), sz, name); return -ENOMEM; } - return hal_export_funct(name, funct, arg, uses_fp, reentrant, comp_id); + return hal_export_funct(name, funct, arg, reentrant, comp_id); } int hal_export_functf(void (*funct) (void *, long), - void *arg, int uses_fp, int reentrant, int comp_id, const char *fmt, ...) + void *arg, int reentrant, int comp_id, const char *fmt, ...) { va_list ap; int ret; va_start(ap, fmt); - ret = hal_export_functfv(funct, arg, uses_fp, reentrant, comp_id, fmt, ap); + ret = hal_export_functfv(funct, arg, reentrant, comp_id, fmt, ap); va_end(ap); return ret; } int hal_export_funct(const char *name, void (*funct) (void *, long), - void *arg, int uses_fp, int reentrant, int comp_id) + void *arg, int reentrant, int comp_id) { - (void)uses_fp; rtapi_intptr_t *prev, next; int cmp; hal_funct_t *new, *fptr; @@ -2455,9 +2027,7 @@ int hal_export_funct(const char *name, void (*funct) (void *, long), "HAL: ERROR: insufficient memory for function '%s'\n", name); return -ENOMEM; } - /* initialize the structure. - uses_fp is deprecated and ignored; always report as FP-capable. */ - new->uses_fp = 1; + /* initialize the structure. */ new->owner_ptr = SHMOFF(comp); new->reentrant = reentrant; new->users = 0; @@ -2523,9 +2093,8 @@ int hal_export_funct(const char *name, void (*funct) (void *, long), return 0; } -int hal_create_thread(const char *name, unsigned long period_nsec, int uses_fp) +int hal_create_thread(const char *name, unsigned long period_nsec) { - (void)uses_fp; int next, cmp, prev_priority; int retval, n; hal_thread_t *new, *tptr; @@ -2582,9 +2151,7 @@ int hal_create_thread(const char *name, unsigned long period_nsec, int uses_fp) "HAL: ERROR: insufficient memory to create thread\n"); return -ENOMEM; } - /* initialize the structure. - uses_fp is deprecated and ignored; always enable FPU save/restore. */ - new->uses_fp = 1; + /* initialize the structure. */ rtapi_snprintf(new->name, sizeof(new->name), "%s", name); /* have to create and start a task to run the thread */ if (hal_data->thread_list_ptr == 0) { @@ -2644,10 +2211,8 @@ int hal_create_thread(const char *name, unsigned long period_nsec, int uses_fp) } /* make priority one lower than previous */ new->priority = rtapi_prio_next_lower(prev_priority); - /* create task - owned by library module, not caller. - Always pass 1 for uses_fp (deprecated, ignored by rtapi). */ - retval = rtapi_task_new(thread_task, new, new->priority, - lib_module_id, HAL_STACKSIZE, 1); + /* create task - owned by library module, not caller.*/ + retval = rtapi_task_new(thread_task, new, new->priority, lib_module_id, HAL_STACKSIZE); if (retval < 0) { halpr_mutex_release(); rtapi_print_msg(RTAPI_MSG_ERR, @@ -2832,9 +2397,6 @@ int hal_add_funct_to_thread(const char *funct_name, const char *thread_name, int "HAL: ERROR: thread '%s' not found\n", thread_name); return -EINVAL; } - /* uses_fp is deprecated and ignored; all threads are FP-capable. - The FP compatibility check has been removed since all threads - and functions now effectively have uses_fp=1. */ /* find insertion point */ list_root = &(thread->funct_list); list_entry = list_root; @@ -3995,7 +3557,6 @@ static hal_funct_t *alloc_funct_struct(void) if (p) { /* make sure it's empty */ p->next_ptr = 0; - p->uses_fp = 0; p->owner_ptr = 0; p->reentrant = 0; p->users = 0; @@ -4053,7 +3614,6 @@ static hal_thread_t *alloc_thread_struct(void) if (p) { /* make sure it's empty */ p->next_ptr = 0; - p->uses_fp = 0; p->period = 0; p->priority = 0; p->task_id = 0; @@ -4159,8 +3719,6 @@ static void unlink_pin(hal_pin_t * pin) switch (pin->type) { case HAL_BOOL: - case HAL_S32: - case HAL_U32: case HAL_SINT: case HAL_UINT: case HAL_REAL: @@ -4319,7 +3877,6 @@ static void free_funct_struct(hal_funct_t * funct) } } /* clear contents of struct */ - funct->uses_fp = 0; funct->owner_ptr = 0; funct->reentrant = 0; funct->users = 0; @@ -4368,7 +3925,6 @@ static void free_thread_struct(hal_thread_t * thread) rtapi_task_pause(thread->task_id); rtapi_task_delete(thread->task_id); /* clear contents of struct */ - thread->uses_fp = 0; thread->period = 0; thread->priority = 0; thread->task_id = 0; @@ -4517,7 +4073,7 @@ static bool hal_port_compute_copy(unsigned read, } -int halpr_port_alloc(unsigned size, hal_port_t *port) { +int halpr_port_alloc(unsigned size, hal_port_t port) { if(!port || size < 1 || size > HAL_PORT_SIZE_MAX) return -EINVAL; @@ -4531,32 +4087,33 @@ int halpr_port_alloc(unsigned size, hal_port_t *port) { new_port->write = 0; new_port->size = size; - *port = SHMOFF(new_port); + hal_set_port(port, SHMOFF(new_port)); return 0; } -static inline hal_port_shm_t *hal_port_to_shm(const hal_port_t *port) +static inline hal_port_shm_t *hal_port_to_shm(const hal_port_t port) { + HAL_STATIC_ASSERT(sizeof(rtapi_port) <= sizeof(rtapi_sint), "rtapi_port size larger than rtapi_sint"); hal_port_shm_t *shm; if(!port) return NULL; - long ofs = *port; + rtapi_port ofs = hal_get_port(port); // The offset must be positive non-zero // The offset must be modulo the magic field size (4 bytes) // The offset must not point beyond shared memory for the control structure - if(ofs <= 0 || 0 != (ofs & (long)(sizeof(shm->magic)-1)) || ofs > (long)(HAL_SIZE - sizeof(hal_port_shm_t))) + if(ofs <= 0 || 0 != (ofs & (rtapi_port)(sizeof(shm->magic)-1)) || ofs > (rtapi_port)(HAL_SIZE - sizeof(hal_port_shm_t))) return NULL; shm = SHMPTR(ofs); // The magic number must match and size be valid if (shm->magic != HAL_PORT_MAGIC_NUM || shm->size > HAL_PORT_SIZE_MAX) return NULL; // The ofset must not point beyond shared memory considering the size - if (ofs > (long)(HAL_SIZE - (sizeof(hal_port_shm_t) + shm->size))) + if (ofs > (rtapi_port)(HAL_SIZE - (sizeof(hal_port_shm_t) + shm->size))) return NULL; return shm; } -bool hal_port_read(const hal_port_t *port, char* dest, unsigned count) { +bool hal_port_read(const hal_port_t port, char* dest, unsigned count) { unsigned read, write, end_bytes_to_read, //number of bytes to read after read position and before end of buffer @@ -4592,7 +4149,7 @@ bool hal_port_read(const hal_port_t *port, char* dest, unsigned count) { } -bool hal_port_peek(const hal_port_t *port, char* dest, unsigned count) { +bool hal_port_peek(const hal_port_t port, char* dest, unsigned count) { unsigned read, write, end_bytes_to_read, //number of bytes to read after read position and before end of buffer @@ -4627,7 +4184,7 @@ bool hal_port_peek(const hal_port_t *port, char* dest, unsigned count) { } -bool hal_port_peek_commit(const hal_port_t *port, unsigned count) { +bool hal_port_peek_commit(const hal_port_t port, unsigned count) { unsigned read, write, end_bytes_to_read, //number of bytes to read after read position and before end of buffer @@ -4661,7 +4218,7 @@ bool hal_port_peek_commit(const hal_port_t *port, unsigned count) { } -bool hal_port_write(const hal_port_t *port, const char* src, unsigned count) { +bool hal_port_write(const hal_port_t port, const char* src, unsigned count) { unsigned read, write, bytes_avail, @@ -4717,7 +4274,7 @@ bool hal_port_write(const hal_port_t *port, const char* src, unsigned count) { } -unsigned hal_port_readable(const hal_port_t *port) { +unsigned hal_port_readable(const hal_port_t port) { hal_port_shm_t* port_shm = hal_port_to_shm(port); if(!port_shm) { rtapi_print_msg(RTAPI_MSG_ERR, "hal_port_readable: invalid port %p\n", port); @@ -4727,7 +4284,7 @@ unsigned hal_port_readable(const hal_port_t *port) { } -unsigned hal_port_writable(const hal_port_t *port) { +unsigned hal_port_writable(const hal_port_t port) { hal_port_shm_t* port_shm = hal_port_to_shm(port); if(!port_shm) { rtapi_print_msg(RTAPI_MSG_ERR, "hal_port_writable: invalid port %p\n", port); @@ -4737,7 +4294,7 @@ unsigned hal_port_writable(const hal_port_t *port) { } -unsigned hal_port_buffer_size(const hal_port_t *port) { +unsigned hal_port_buffer_size(const hal_port_t port) { hal_port_shm_t* port_shm = hal_port_to_shm(port); if(!port_shm) { rtapi_print_msg(RTAPI_MSG_ERR, "hal_port_buffer_size: invalid port %p\n", port); @@ -4747,7 +4304,7 @@ unsigned hal_port_buffer_size(const hal_port_t *port) { } -void hal_port_clear(const hal_port_t *port) { +void hal_port_clear(const hal_port_t port) { unsigned read,write; hal_port_shm_t* port_shm = hal_port_to_shm(port); if(!port_shm) { @@ -4760,15 +4317,15 @@ void hal_port_clear(const hal_port_t *port) { #ifdef ULAPI -void hal_port_wait_readable(hal_port_t** port, unsigned count, sig_atomic_t* stop) { - while((hal_port_readable(*port) < count) && (!stop || !*stop)) { +void hal_port_wait_readable(const hal_port_t port, unsigned count, sig_atomic_t *stop) { + while((hal_port_readable(port) < count) && (!stop || !*stop)) { rtapi_delay(10000000); } } -void hal_port_wait_writable(hal_port_t** port, unsigned count, sig_atomic_t* stop) { - while((hal_port_writable(*port) < count) && (!stop || !*stop)) { +void hal_port_wait_writable(const hal_port_t port, unsigned count, sig_atomic_t *stop) { + while((hal_port_writable(port) < count) && (!stop || !*stop)) { rtapi_delay(10000000); } } @@ -4802,13 +4359,11 @@ static char *hal_stream_type_string(int type, char *buf, size_t nbuf) { const char *cptr; switch(type) { - case HAL_BIT: cptr = "bit"; break; - case HAL_FLOAT: cptr = "float"; break; - case HAL_S32: cptr = "s32"; break; - case HAL_U32: cptr = "u32"; break; - case HAL_S64: cptr = "s64"; break; - case HAL_U64: cptr = "u64"; break; - case HAL_PORT: cptr = "port"; break; + case HAL_BOOL: cptr = "bool"; break; + case HAL_REAL: cptr = "real"; break; + case HAL_SINT: cptr = "sint"; break; + case HAL_UINT: cptr = "uint"; break; + case HAL_PORT: cptr = "port"; break; default: rtapi_snprintf(buf, nbuf, "UNK#%d", type); return buf; @@ -4829,12 +4384,12 @@ static int hal_stream_parse_types(hal_type_t type[HAL_STREAM_MAX_PINS], const ch for(n = 0; n < HAL_STREAM_MAX_PINS && *cfg != '\0'; n++) { switch (*cfg) { case 'r': case 'R': - case 'f': case 'F': type[n] = HAL_FLOAT; break; - case 'b': case 'B': type[n] = HAL_BIT; break; - case 'u': case 'U': type[n] = HAL_U32; break; - case 's': case 'S': type[n] = HAL_S32; break; - case 'l': case 'L': type[n] = HAL_S64; break; - case 'k': case 'K': type[n] = HAL_U64; break; + case 'f': case 'F': type[n] = HAL_REAL; break; + case 'b': case 'B': type[n] = HAL_BOOL; break; + case 's': case 'S': + case 'l': case 'L': type[n] = HAL_SINT; break; + case 'u': case 'U': + case 'k': case 'K': type[n] = HAL_UINT; break; default: rtapi_print_msg(RTAPI_MSG_ERR, "stream: ERROR: unknown type '%c', must be R (F), B, U, S, L or K\n", *cfg); return 0; @@ -5168,44 +4723,11 @@ EXPORT_SYMBOL(hal_pin_new_uint); EXPORT_SYMBOL(hal_pin_new_real); EXPORT_SYMBOL(hal_pin_new_port); -EXPORT_SYMBOL(hal_pin_bit_new); -EXPORT_SYMBOL(hal_pin_float_new); -EXPORT_SYMBOL(hal_pin_u32_new); -EXPORT_SYMBOL(hal_pin_s32_new); -EXPORT_SYMBOL(hal_pin_u64_new); -EXPORT_SYMBOL(hal_pin_s64_new); -EXPORT_SYMBOL(hal_pin_port_new); -EXPORT_SYMBOL(hal_pin_new); - -EXPORT_SYMBOL(hal_pin_bit_newf); -EXPORT_SYMBOL(hal_pin_float_newf); -EXPORT_SYMBOL(hal_pin_u32_newf); -EXPORT_SYMBOL(hal_pin_s32_newf); -EXPORT_SYMBOL(hal_pin_u64_newf); -EXPORT_SYMBOL(hal_pin_s64_newf); -EXPORT_SYMBOL(hal_pin_port_newf); - - EXPORT_SYMBOL(hal_signal_new); EXPORT_SYMBOL(hal_signal_delete); EXPORT_SYMBOL(hal_link); EXPORT_SYMBOL(hal_unlink); -EXPORT_SYMBOL(hal_param_bit_new); -EXPORT_SYMBOL(hal_param_float_new); -EXPORT_SYMBOL(hal_param_u32_new); -EXPORT_SYMBOL(hal_param_s32_new); -EXPORT_SYMBOL(hal_param_u64_new); -EXPORT_SYMBOL(hal_param_s64_new); -EXPORT_SYMBOL(hal_param_new); - -EXPORT_SYMBOL(hal_param_bit_newf); -EXPORT_SYMBOL(hal_param_float_newf); -EXPORT_SYMBOL(hal_param_u32_newf); -EXPORT_SYMBOL(hal_param_s32_newf); -EXPORT_SYMBOL(hal_param_u64_newf); -EXPORT_SYMBOL(hal_param_s64_newf); - EXPORT_SYMBOL(hal_param_new_bool); EXPORT_SYMBOL(hal_param_new_si32); EXPORT_SYMBOL(hal_param_new_ui32); @@ -5214,14 +4736,6 @@ EXPORT_SYMBOL(hal_param_new_uint); EXPORT_SYMBOL(hal_param_new_real); EXPORT_SYMBOL(hal_param_new_fake); -EXPORT_SYMBOL(hal_param_bit_set); -EXPORT_SYMBOL(hal_param_float_set); -EXPORT_SYMBOL(hal_param_u32_set); -EXPORT_SYMBOL(hal_param_s32_set); -EXPORT_SYMBOL(hal_param_u64_set); -EXPORT_SYMBOL(hal_param_s64_set); -EXPORT_SYMBOL(hal_param_set); - EXPORT_SYMBOL(hal_set_constructor); EXPORT_SYMBOL(hal_comp_invoke_make); diff --git a/src/hal/hal_lib_query.c b/src/hal/hal_lib_query.c index 09ec62cc827..8a6b57c7e6f 100644 --- a/src/hal/hal_lib_query.c +++ b/src/hal/hal_lib_query.c @@ -40,45 +40,20 @@ // //===================================================== -static int set_common(hal_type_t type, const hal_query_value_u *v, hal_refs_u u, bool setport, bool isparam) +static int set_common(hal_type_t type, const hal_query_value_u *v, hal_refs_u u, bool setport) { - // This is a special case because compatibility requires us to write to the - // smaller field when addressing parameters. An old-style param has a - // user-defined storage that may not be large enough for our new types and - // would overwrite other memory. - // FIXME: This code must be retired when we do the API break. - if(isparam) { - switch(type) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - case HAL_BOOL: ((hal_data_u *)u.b)->b = v->b; break; - case HAL_S32: ((hal_data_u *)u.s)->s = v->s; break; - case HAL_U32: ((hal_data_u *)u.u)->u = v->u; break; - case HAL_SINT: ((hal_data_u *)u.s)->ls = v->s; break; - case HAL_UINT: ((hal_data_u *)u.u)->lu = v->u; break; - case HAL_REAL: ((hal_data_u *)u.r)->f = v->r; break; -#pragma GCC diagnostic pop - default: - case HAL_PORT: return -EBADF; - } - return 0; - } switch(type) { case HAL_BOOL: hal_set_bool(u.b, v->b); break; - case HAL_S32: hal_set_si32(u.s, v->s); break; - case HAL_U32: hal_set_ui32(u.u, v->u); break; case HAL_SINT: hal_set_sint(u.s, v->s); break; case HAL_UINT: hal_set_uint(u.u, v->u); break; case HAL_REAL: hal_set_real(u.r, v->r); break; case HAL_PORT: { if(!setport) return -EBADF; - // FIXME: This needs to be changed when the old API is removed - rtapi_port port = hal_get_sint(u.s); - if(0 != port && hal_port_buffer_size((hal_port_t *)u.s) > 0) { + if(hal_port_buffer_size(u.p) > 0) { return -EISCONN; } - int rv = halpr_port_alloc(v->u, (hal_port_t *)u.s); + int rv = halpr_port_alloc(v->u, u.p); if(rv) return rv; } break; @@ -157,7 +132,7 @@ int hal_set_s(hal_query_t *q, hal_query_cb cb, void *arg) if(!rv) { // Success, data to write must be in the value union hal_refs_u u = (hal_refs_u)(hal_sint_t)SHMPTR(sig->data_ptr); - if((rv = set_common(sig->type, &q->sig.value, u, 1, 0)) < 0) { + if((rv = set_common(sig->type, &q->sig.value, u, 1)) < 0) { halpr_mutex_release(); if(-EBADF == rv) rtapi_print_msg(RTAPI_MSG_ERR, "hal_set_s: Signal '%s' has bad type %d\n", q->name, sig->type); @@ -204,7 +179,6 @@ int hal_set_p(hal_query_t *q, hal_query_cb cb, void *arg) hal_type_t t; hal_pin_t *pin = NULL; hal_refs_u u; - bool isparam; // If only parameters requested, don't look for pins if(HAL_QTYPE_PARAM != q->qtype) pin = halpr_find_pin_by_name(q->name); @@ -251,7 +225,6 @@ int hal_set_p(hal_query_t *q, hal_query_cb cb, void *arg) } // FIXME: This can be targeted to param's data when the old API is retired u = (hal_refs_u)(hal_sint_t)SHMPTR(param->data_ptr); - isparam = 1; } else { // We have a pin, copy the data, but we still can fail q->qtype = HAL_QTYPE_PIN; @@ -281,7 +254,6 @@ int hal_set_p(hal_query_t *q, hal_query_cb cb, void *arg) return -EACCES; } u = (hal_refs_u)(hal_sint_t)&pin->dummysig; - isparam = 0; } // Note: the callback is called while holding the mutex @@ -289,7 +261,7 @@ int hal_set_p(hal_query_t *q, hal_query_cb cb, void *arg) if(!rv) { // Success, data to write must be in the value union - if((rv = set_common(t, &q->pp.value, u, 0, isparam)) < 0) { + if((rv = set_common(t, &q->pp.value, u, 0)) < 0) { halpr_mutex_release(); if(-EBADF == rv) rtapi_print_msg(RTAPI_MSG_ERR, "hal_set_p: %s '%s' has bad type %d\n", pin ? "Pin" : "Param", q->name, t); @@ -305,8 +277,6 @@ static int get_common(hal_type_t type, hal_query_value_u *v, hal_refs_u u, bool { switch(type) { case HAL_BOOL: v->b = hal_get_bool(u.b); break; - case HAL_S32: v->s = hal_get_si32(u.s); break; - case HAL_U32: v->u = hal_get_ui32(u.u); break; case HAL_SINT: v->s = hal_get_sint(u.s); break; case HAL_UINT: v->u = hal_get_uint(u.u); break; case HAL_REAL: v->r = hal_get_real(u.r); break; @@ -314,8 +284,7 @@ static int get_common(hal_type_t type, hal_query_value_u *v, hal_refs_u u, bool if(!getport) { v->u = 0; } else { - // FIXME: This needs to be changed when the old API is removed - v->u = hal_port_buffer_size((hal_port_t *)u.s); + v->u = hal_port_buffer_size(u.p); } break; default: diff --git a/src/hal/hal_priv.h b/src/hal/hal_priv.h index 3e16f554614..a4f4dae9b7b 100644 --- a/src/hal/hal_priv.h +++ b/src/hal/hal_priv.h @@ -124,7 +124,7 @@ */ #define HAL_KEY 0x48414C32 /* key used to open HAL shared memory */ -#define HAL_VER 0x00000014 /* version code */ +#define HAL_VER 0x00000016 /* version code */ #define HAL_SIZE (2*256*4096) /* These pointers are set by hal_init() to point to the shmem block @@ -231,8 +231,8 @@ typedef union { inside a larger structure. */ typedef struct hal_list_t { - SHMFIELD(hal_list_t) next; /* next element in list */ - SHMFIELD(hal_list_t) prev; /* previous element in list */ + SHMFIELD(hal_list_t) next; // next element in list + SHMFIELD(hal_list_t) prev; // previous element in list } hal_list_t; /** HAL "oldname" data structure. @@ -240,8 +240,8 @@ typedef struct hal_list_t { store the original name. */ typedef struct hal_oldname_t { - SHMFIELD(hal_oldname_t) next_ptr; /* next struct (used for free list only) */ - char name[HAL_NAME_LEN + 1]; /* the original name */ + SHMFIELD(hal_oldname_t) next_ptr; // next struct (used for free list only) + char name[HAL_NAME_LEN + 1]; // the original name } hal_oldname_t; typedef struct hal_comp_t hal_comp_t; @@ -261,7 +261,7 @@ typedef struct hal_thread_t hal_thread_t; structure for all data in the HAL. */ typedef struct hal_data_t { - int version; /* version code for structs, etc */ + int version; // version code for structs, etc // WARNING: Do not touch these mutex lock fields. Only use the proper // functions halpr_mutex_acquire() and halpr_mutex_release(). See comment @@ -273,35 +273,31 @@ typedef struct hal_data_t { int locklvl; // Lock recursion level int locktid; // Lock owner thread ID - rtapi_s32 shmem_avail; /* amount of shmem left free */ - constructor pending_constructor; - /* pointer to the pending constructor function */ - char constructor_prefix[HAL_NAME_LEN+1]; - /* prefix of name for new instance */ - char constructor_arg[HAL_NAME_LEN+1]; - /* prefix of name for new instance */ - int shmem_bot; /* bottom of free shmem (first free byte) */ - int shmem_top; /* top of free shmem (1 past last free) */ - SHMFIELD(hal_comp_t) comp_list_ptr; /* root of linked list of components */ - SHMFIELD(hal_pin_t) pin_list_ptr; /* root of linked list of pins */ - SHMFIELD(hal_sig_t) sig_list_ptr; /* root of linked list of signals */ - SHMFIELD(hal_param_t) param_list_ptr; /* root of linked list of parameters */ - SHMFIELD(hal_funct_t) funct_list_ptr; /* root of linked list of functions */ - SHMFIELD(hal_thread_t) thread_list_ptr; /* root of linked list of threads */ - long base_period; /* timer period for realtime tasks */ - int threads_running; /* non-zero if threads are started */ - SHMFIELD(hal_oldname_t) oldname_free_ptr; /* list of free oldname structs */ - SHMFIELD(hal_comp_t) comp_free_ptr; /* list of free component structs */ - SHMFIELD(hal_pin_t) pin_free_ptr; /* list of free pin structs */ - SHMFIELD(hal_sig_t) sig_free_ptr; /* list of free signal structs */ - SHMFIELD(hal_param_t) param_free_ptr; /* list of free parameter structs */ - SHMFIELD(hal_funct_t) funct_free_ptr; /* list of free function structs */ - hal_list_t funct_entry_free; /* list of free funct entry structs */ - SHMFIELD(hal_thread_t) thread_free_ptr; /* list of free thread structs */ - int exact_base_period; /* if set, pretend that rtapi satisfied our - period request exactly */ - rtapi_realtime_type_t realtime_type; /* reflects the running realtime type */ - unsigned char lock; /* hal locking, can be one of the HAL_LOCK_* types */ + rtapi_s32 shmem_avail; // amount of shmem left free + constructor pending_constructor; // pointer to the pending constructor function + char constructor_prefix[HAL_NAME_LEN+1];// prefix of name for new instance + char constructor_arg[HAL_NAME_LEN+1]; // prefix of name for new instance + int shmem_bot; // bottom of free shmem (first free byte) + int shmem_top; // top of free shmem (1 past last free) + SHMFIELD(hal_comp_t) comp_list_ptr; // root of linked list of components + SHMFIELD(hal_pin_t) pin_list_ptr; // root of linked list of pins + SHMFIELD(hal_sig_t) sig_list_ptr; // root of linked list of signals + SHMFIELD(hal_param_t) param_list_ptr; // root of linked list of parameters + SHMFIELD(hal_funct_t) funct_list_ptr; // root of linked list of functions + SHMFIELD(hal_thread_t) thread_list_ptr; // root of linked list of threads + long base_period; // timer period for realtime tasks + int threads_running; // non-zero if threads are started + SHMFIELD(hal_oldname_t) oldname_free_ptr; // list of free oldname structs + SHMFIELD(hal_comp_t) comp_free_ptr; // list of free component structs + SHMFIELD(hal_pin_t) pin_free_ptr; // list of free pin structs + SHMFIELD(hal_sig_t) sig_free_ptr; // list of free signal structs + SHMFIELD(hal_param_t) param_free_ptr; // list of free parameter structs + SHMFIELD(hal_funct_t) funct_free_ptr; // list of free function structs + hal_list_t funct_entry_free; // list of free funct entry structs + SHMFIELD(hal_thread_t) thread_free_ptr; // list of free thread structs + int exact_base_period; // if set, pretend that rtapi satisfied our period request exactly + rtapi_realtime_type_t realtime_type; // reflects the running realtime type + unsigned char lock; // hal locking, can be one of the HAL_LOCK_* types } hal_data_t; // @@ -319,16 +315,16 @@ typedef hal_comp_type_t component_type_t; component calls hal_init(). */ struct hal_comp_t { - SHMFIELD(hal_comp_t) next_ptr; /* next component in the list */ - int comp_id; /* component ID (RTAPI module id) */ - int mem_id; /* RTAPI shmem ID used by this comp */ - component_type_t type; - int ready; /* nonzero if ready, 0 if not */ - int pid; /* PID of component (user components only) */ - void *shmem_base; /* base of shmem for this component */ - char name[HAL_NAME_LEN + 1]; /* component name */ + SHMFIELD(hal_comp_t) next_ptr; // next component in the list + int comp_id; // component ID (RTAPI module id) + int mem_id; // RTAPI shmem ID used by this comp + component_type_t type; // RT or non-RT (HAL_COMP_TYPE_*) + int ready; // nonzero if ready, 0 if not + int pid; // PID of component (user components only) + void *shmem_base; // base of shmem for this component + char name[HAL_NAME_LEN + 1]; // component name constructor make; - SHMFIELD(char) insmod_args; /* args passed to insmod when loaded */ + SHMFIELD(char) insmod_args; // args passed to insmod when loaded }; /** HAL 'pin' data structure. @@ -337,28 +333,28 @@ struct hal_comp_t { FIXME: Merge with hal_param_t */ struct hal_pin_t { - SHMFIELD(hal_pin_t) next_ptr; /* next pin in linked list */ - SHMFIELD(void*) data_ptr_addr; /* address of pin data pointer */ - SHMFIELD(hal_comp_t) owner_ptr; /* component that owns this pin */ - SHMFIELD(hal_oldname_t) oldname; /* old name if aliased, else zero */ - halpr_data_u dummysig; /* if unlinked, data_ptr points here */ - SHMFIELD(hal_sig_t) signal; /* signal to which pin is linked */ - hal_type_t type; /* data type */ - hal_pin_dir_t dir; /* pin direction */ - char name[HAL_NAME_LEN + 1]; /* pin name */ + SHMFIELD(hal_pin_t) next_ptr; // next pin in linked list + SHMFIELD(void*) data_ptr_addr; // address of pin data pointer + SHMFIELD(hal_comp_t) owner_ptr; // component that owns this pin + SHMFIELD(hal_oldname_t) oldname; // old name if aliased, else zero + halpr_data_u dummysig; // if unlinked, data_ptr points here + SHMFIELD(hal_sig_t) signal; // signal to which pin is linked + hal_type_t type; // data type + hal_pdir_t dir; // pin direction + char name[HAL_NAME_LEN + 1]; // pin name }; /** HAL 'signal' data structure. This structure contains information about a 'signal' object. */ struct hal_sig_t { - SHMFIELD(hal_sig_t) next_ptr; /* next signal in linked list */ - SHMFIELD(void*) data_ptr; /* offset of signal value */ - hal_type_t type; /* data type */ - int readers; /* number of input pins linked */ - int writers; /* number of output pins linked */ - int bidirs; /* number of I/O pins linked */ - char name[HAL_NAME_LEN + 1]; /* signal name */ + SHMFIELD(hal_sig_t) next_ptr; // next signal in linked list + SHMFIELD(void*) data_ptr; // offset of signal value + hal_type_t type; // data type + int readers; // number of input pins linked + int writers; // number of output pins linked + int bidirs; // number of I/O pins linked + char name[HAL_NAME_LEN + 1]; // signal name }; /** HAL 'parameter' data structure. @@ -367,15 +363,15 @@ struct hal_sig_t { FIXME: Merge with hal_pin_t */ struct hal_param_t { - SHMFIELD(hal_param_t) next_ptr; /* next parameter in linked list */ - SHMFIELD(void*) data_ptr; /* offset of parameter value */ - SHMFIELD(hal_comp_t) owner_ptr; /* component that owns this signal */ - SHMFIELD(hal_oldname_t) oldname; /* old name if aliased, else zero */ - halpr_data_u data; /* new API parameter storage is here, data_ptr points here too */ - SHMFIELD(void*) reserved; /* reserved to match hal_pin_t layout */ - hal_type_t type; /* data type */ - hal_param_dir_t dir; /* data direction */ - char name[HAL_NAME_LEN + 1]; /* parameter name */ + SHMFIELD(hal_param_t) next_ptr; // next parameter in linked list + SHMFIELD(void*) data_ptr; // offset of parameter value + SHMFIELD(hal_comp_t) owner_ptr; // component that owns this signal + SHMFIELD(hal_oldname_t) oldname; // old name if aliased, else zero + halpr_data_u data; // new API parameter storage is here, data_ptr points here too + SHMFIELD(void*) reserved; // reserved to match hal_pin_t layout + hal_type_t type; // data type + hal_pdir_t dir; // data direction + char name[HAL_NAME_LEN + 1]; // parameter name }; /** the HAL uses functions and threads to handle synchronization of @@ -395,48 +391,46 @@ struct hal_param_t { */ struct hal_funct_t { - SHMFIELD(hal_funct_t) next_ptr; /* next function in linked list */ - int uses_fp; /* floating point flag */ - SHMFIELD(hal_comp_t) owner_ptr; /* component that added this funct */ - int reentrant; /* non-zero if function is re-entrant */ - int users; /* number of threads using function */ - void *arg; /* argument for function */ - void (*funct) (void *, long); /* ptr to function code */ + SHMFIELD(hal_funct_t) next_ptr; // next function in linked list + SHMFIELD(hal_comp_t) owner_ptr; // component that added this funct + int reentrant; // non-zero if function is re-entrant + int users; // number of threads using function + void *arg; // argument for function + void (*funct) (void *, long); // ptr to function code // IMPORTANT: The pins and params are valid as seen from the context that // created them. For uspace that is rtapi_app and in the kernel it is the // kernel's module context. - hal_sint_t runtime; /* (pin) duration of last run, in CPU cycles */ - hal_sint_t maxtime; /* (param) duration of longest run, in CPU cycles */ - hal_bool_t maxtime_increased; /* (param) on last call, maxtime increased */ - char name[HAL_NAME_LEN + 1]; /* function name */ + hal_sint_t runtime; // (pin) duration of last run, in CPU cycles + hal_sint_t maxtime; // (param) duration of longest run, in CPU cycles + hal_bool_t maxtime_increased; // (param) on last call, maxtime increased + char name[HAL_NAME_LEN + 1]; // function name }; struct hal_funct_entry_t { - hal_list_t links; /* linked list data */ - void *arg; /* argument for function */ - void (*funct) (void *, long); /* ptr to function code */ - SHMFIELD(hal_funct_t) funct_ptr; /* pointer to function */ + hal_list_t links; // linked list data + void *arg; // argument for function + void (*funct) (void *, long); // ptr to function code + SHMFIELD(hal_funct_t) funct_ptr; // pointer to function }; -#define HAL_STACKSIZE 16384 /* realtime task stacksize */ +#define HAL_STACKSIZE 16384 // realtime task stacksize struct hal_thread_t { - SHMFIELD(hal_thread_t) next_ptr; /* next thread in linked list */ - int uses_fp; /* floating point flag */ - long int period; /* period of the thread, in nsec */ - int priority; /* priority of the thread */ - int task_id; /* ID of the task that runs this thread */ + SHMFIELD(hal_thread_t) next_ptr; // next thread in linked list + long int period; // period of the thread, in nsec + int priority; // priority of the thread + int task_id; // ID of the task that runs this thread // IMPORTANT: The pins and params are valid as seen from the context that // created them. For uspace that is rtapi_app and in the kernel it is the // kernel's module context. - hal_sint_t runtime; /* (pin) duration of last run, in ns */ - hal_sint_t maxtime; /* (param) duration of longest run, in ns */ - hal_sint_t threadbeat; /* (pin) visible monotonic loop beat counter */ - rtapi_sint beatcnt; /* Thread monotonic increasing loop beat counter (so we don't need to read/write volatile) */ - hal_list_t funct_list; /* list of functions to run */ - hal_list_t init_funct_list; /* list of init functions, run once before first cyclic cycle */ - int init_done; /* 0 = init pending, 1 = init cycle has executed */ - char name[HAL_NAME_LEN + 1]; /* thread name */ + hal_sint_t runtime; // (pin) duration of last run, in ns + hal_sint_t maxtime; // (param) duration of longest run, in ns + hal_sint_t threadbeat; // (pin) visible monotonic loop beat counter + rtapi_sint beatcnt; // Thread monotonic increasing loop beat counter (so we don't need to read/write volatile) + hal_list_t funct_list; // list of functions to run + hal_list_t init_funct_list; // list of init functions, run once before first cyclic cycle + int init_done; // 0 = init pending, 1 = init cycle has executed + char name[HAL_NAME_LEN + 1]; // thread name int comp_id; }; @@ -509,12 +503,9 @@ extern hal_comp_t *halpr_find_comp_by_id(int id); call, and return the next matching item. If no match is found, they return NULL. */ -extern hal_pin_t *halpr_find_pin_by_owner(hal_comp_t * owner, - hal_pin_t * start); -extern hal_param_t *halpr_find_param_by_owner(hal_comp_t * owner, - hal_param_t * start); -extern hal_funct_t *halpr_find_funct_by_owner(hal_comp_t * owner, - hal_funct_t * start); +extern hal_pin_t *halpr_find_pin_by_owner(hal_comp_t *owner, hal_pin_t *start); +extern hal_param_t *halpr_find_param_by_owner(hal_comp_t *owner, hal_param_t *start); +extern hal_funct_t *halpr_find_funct_by_owner(hal_comp_t *owner, hal_funct_t *start); /** 'find_pin_by_sig()' finds pin(s) that are linked to a specific signal. If 'start' is NULL, it starts at the beginning of the pin list, and @@ -530,7 +521,7 @@ extern hal_pin_t *halpr_find_pin_by_sig(hal_sig_t * sig, hal_pin_t * start); returned and the newly allocated hal_port_t is returned in the port argument and can be used with all other hal_port functions. */ -int halpr_port_alloc(unsigned size, hal_port_t *port); +int halpr_port_alloc(unsigned size, hal_port_t port); // Recursive HAL mutex (replaces old mutex) int halpr_mutex_acquire(void); diff --git a/src/hal/halmodule.cc b/src/hal/halmodule.cc index 3f581d7de4b..2b8a6afc784 100644 --- a/src/hal/halmodule.cc +++ b/src/hal/halmodule.cc @@ -374,18 +374,6 @@ static int pyhal_write_common(halitem *pin, PyObject *value) { hal_set_real(pin->u->r, tmp); break; } - case HAL_U32: { - rtapi_u32 tmp; - if(!from_python(value, &tmp)) return -1; - hal_set_ui32(pin->u->u, tmp); - break; - } - case HAL_S32: { - rtapi_s32 tmp; - if(!from_python(value, &tmp)) return -1; - hal_set_si32(pin->u->s, tmp); - break; - } case HAL_UINT: { rtapi_uint tmp; if(!from_python(value, &tmp)) return -1; @@ -408,14 +396,12 @@ static PyObject *pyhal_read_common(halitem *item) { if(!item) return NULL; switch(item->type) { case HAL_BOOL: return to_python(hal_get_bool(item->u->b)); - case HAL_U32: return to_python(hal_get_ui32(item->u->u)); - case HAL_S32: return to_python(hal_get_si32(item->u->s)); case HAL_UINT: return to_python(hal_get_uint(item->u->u)); case HAL_SINT: return to_python(hal_get_sint(item->u->s)); case HAL_REAL: return to_python(hal_get_real(item->u->r)); case HAL_PORT: if(item->is_pin) - return to_python(hal_port_buffer_size(reinterpret_cast(item->u->u))); + return to_python(hal_port_buffer_size(item->u->p)); else return to_python((unsigned)0); // HAL_PORT cannot be a parameter default: @@ -442,8 +428,6 @@ static bool is_valid_hal_type(hal_type_t t, bool allowport) { switch(t) { case HAL_BOOL: - case HAL_S32: - case HAL_U32: case HAL_SINT: case HAL_UINT: case HAL_REAL: @@ -455,7 +439,7 @@ static bool is_valid_hal_type(hal_type_t t, bool allowport) } } -static PyObject * pyhal_create_param(halobject *self, const char *name, hal_type_t type, hal_param_dir_t dir) { +static PyObject * pyhal_create_param(halobject *self, const char *name, hal_type_t type, hal_pdir_t dir) { int res; halitem param; param.is_pin = 0; @@ -475,8 +459,6 @@ static PyObject * pyhal_create_param(halobject *self, const char *name, hal_type switch(type) { case HAL_BOOL: res = hal_param_new_bool(self->hal_id, dir, ¶m.u->b, 0, "%s.%s", self->prefix, name); break; - case HAL_S32: res = hal_param_new_si32(self->hal_id, dir, ¶m.u->s, 0, "%s.%s", self->prefix, name); break; - case HAL_U32: res = hal_param_new_ui32(self->hal_id, dir, ¶m.u->u, 0, "%s.%s", self->prefix, name); break; case HAL_SINT: res = hal_param_new_sint(self->hal_id, dir, ¶m.u->s, 0, "%s.%s", self->prefix, name); break; case HAL_UINT: res = hal_param_new_uint(self->hal_id, dir, ¶m.u->u, 0, "%s.%s", self->prefix, name); break; case HAL_REAL: res = hal_param_new_real(self->hal_id, dir, ¶m.u->r, 0.0, "%s.%s", self->prefix, name); break; @@ -490,7 +472,7 @@ static PyObject * pyhal_create_param(halobject *self, const char *name, hal_type } -static PyObject * pyhal_create_pin(halobject *self, const char *name, hal_type_t type, hal_pin_dir_t dir) { +static PyObject * pyhal_create_pin(halobject *self, const char *name, hal_type_t type, hal_pdir_t dir) { char pin_name[HAL_NAME_LEN+1]; int res; halitem pin; @@ -518,13 +500,10 @@ static PyObject * pyhal_create_pin(halobject *self, const char *name, hal_type_t } switch(type) { case HAL_BOOL: res = hal_pin_new_bool(self->hal_id, dir, &pin.u->b, 0, "%s.%s", self->prefix, name); break; - case HAL_S32: res = hal_pin_new_si32(self->hal_id, dir, &pin.u->s, 0, "%s.%s", self->prefix, name); break; - case HAL_U32: res = hal_pin_new_ui32(self->hal_id, dir, &pin.u->u, 0, "%s.%s", self->prefix, name); break; case HAL_SINT: res = hal_pin_new_sint(self->hal_id, dir, &pin.u->s, 0, "%s.%s", self->prefix, name); break; case HAL_UINT: res = hal_pin_new_uint(self->hal_id, dir, &pin.u->u, 0, "%s.%s", self->prefix, name); break; case HAL_REAL: res = hal_pin_new_real(self->hal_id, dir, &pin.u->r, 0.0, "%s.%s", self->prefix, name); break; - // FIXME: This needs to change when we break the API. - case HAL_PORT: res = hal_pin_new_port(self->hal_id, dir, &pin.u->s, "%s.%s", self->prefix, name); break; + case HAL_PORT: res = hal_pin_new_port(self->hal_id, dir, &pin.u->p, "%s.%s", self->prefix, name); break; default: res = -EINVAL; break; } if(res) return pyhal_error(res); @@ -547,7 +526,7 @@ static PyObject *pyhal_new_param(PyObject *_self, PyObject *o) { PyErr_Format(PyExc_ValueError, "Duplicate parameter name '%s'", name); return NULL; } else { PyErr_Clear(); } - return pyhal_create_param(self, name, (hal_type_t)type, (hal_param_dir_t)dir); + return pyhal_create_param(self, name, (hal_type_t)type, (hal_pdir_t)dir); } @@ -564,7 +543,7 @@ static PyObject *pyhal_new_pin(PyObject *_self, PyObject *o) { PyErr_Format(PyExc_ValueError, "Duplicate pin name '%s'", name); return NULL; } else { PyErr_Clear(); } - return pyhal_create_pin(self, name, (hal_type_t)type, (hal_pin_dir_t)dir); + return pyhal_create_pin(self, name, (hal_type_t)type, (hal_pdir_t)dir); } enum what_type_e { @@ -820,12 +799,10 @@ PyTypeObject halobject_type = { static const char * pin_type2name(hal_type_t type) { switch (type) { - case HAL_BOOL: return "BIT"; - case HAL_S32: return "S32"; - case HAL_U32: return "U32"; - case HAL_SINT: return "S64"; - case HAL_UINT: return "U64"; - case HAL_REAL: return "FLOAT"; + case HAL_BOOL: return "BOOL"; + case HAL_SINT: return "SINT"; + case HAL_UINT: return "UINT"; + case HAL_REAL: return "REAL"; case HAL_PORT: return "PORT"; default: return "unknown"; } @@ -949,12 +926,12 @@ static PyObject *pyhal_port_write(PyObject *self, PyObject *o) Py_INCREF(Py_False); return Py_False; } - if(len > (Py_ssize_t)hal_port_writable((hal_port_t *)item->pin.u->u)) { + if(len > (Py_ssize_t)hal_port_writable(item->pin.u->p)) { Py_INCREF(Py_False); return Py_False; } - return PyBool_FromLong(hal_port_write((hal_port_t *)item->pin.u->u, cptr, (unsigned)len)); + return PyBool_FromLong(hal_port_write(item->pin.u->p, cptr, (unsigned)len)); } static PyObject *pyhal_port_read_peek(pyhalitem *item, PyObject *o, bool isread) @@ -978,7 +955,7 @@ static PyObject *pyhal_port_read_peek(pyhalitem *item, PyObject *o, bool isread) Py_INCREF(Py_False); return Py_False; } - if(l > (unsigned long)hal_port_readable((hal_port_t *)item->pin.u->u)) { + if(l > (unsigned long)hal_port_readable(item->pin.u->p)) { Py_INCREF(Py_False); return Py_False; } @@ -990,9 +967,9 @@ static PyObject *pyhal_port_read_peek(pyhalitem *item, PyObject *o, bool isread) } bool b; if(isread) - b = hal_port_read((hal_port_t *)item->pin.u->u, PyBytes_AsString(bts), (unsigned)l); + b = hal_port_read(item->pin.u->p, PyBytes_AsString(bts), (unsigned)l); else - b = hal_port_peek((hal_port_t *)item->pin.u->u, PyBytes_AsString(bts), (unsigned)l); + b = hal_port_peek(item->pin.u->p, PyBytes_AsString(bts), (unsigned)l); if(b) { Py_DECREF(bts); Py_INCREF(Py_False); @@ -1030,7 +1007,7 @@ static PyObject *pyhal_port_peek_commit(PyObject *self, PyObject *o) Py_INCREF(Py_False); return Py_False; } - return PyBool_FromLong(hal_port_peek_commit((hal_port_t *)item->pin.u->u, (unsigned)l)); + return PyBool_FromLong(hal_port_peek_commit(item->pin.u->p, (unsigned)l)); } static PyObject *pyhal_port_writable(PyObject *self, PyObject *) @@ -1042,7 +1019,7 @@ static PyObject *pyhal_port_writable(PyObject *self, PyObject *) PyErr_Format(PyExc_RuntimeError, "writable: %s: Pin not output", item->name); return NULL; } - return PyLong_FromUnsignedLong(hal_port_writable((hal_port_t *)item->pin.u->u)); + return PyLong_FromUnsignedLong(hal_port_writable(item->pin.u->p)); } static PyObject *pyhal_port_readable(PyObject *self, PyObject *) @@ -1054,7 +1031,7 @@ static PyObject *pyhal_port_readable(PyObject *self, PyObject *) PyErr_Format(PyExc_RuntimeError, "readable: %s: Pin not input", item->name); return NULL; } - return PyLong_FromUnsignedLong(hal_port_readable((hal_port_t *)item->pin.u->u)); + return PyLong_FromUnsignedLong(hal_port_readable(item->pin.u->p)); } static PyObject *pyhal_port_clear(PyObject *self, PyObject *) @@ -1062,7 +1039,7 @@ static PyObject *pyhal_port_clear(PyObject *self, PyObject *) pyhalitem *item = reinterpret_cast(self); if(!check_port(item, "clear")) return NULL; - hal_port_clear((hal_port_t *)item->pin.u->u); + hal_port_clear(item->pin.u->p); Py_INCREF(Py_None); return Py_None; } @@ -1072,7 +1049,7 @@ static PyObject *pyhal_port_size(PyObject *self, PyObject *) pyhalitem *item = reinterpret_cast(self); if(!check_port(item, "size")) return NULL; - return PyLong_FromUnsignedLong(hal_port_buffer_size((hal_port_t *)item->pin.u->u)); + return PyLong_FromUnsignedLong(hal_port_buffer_size(item->pin.u->p)); } static PyMethodDef halpin_methods[] = { @@ -1234,8 +1211,6 @@ PyObject *new_sig(PyObject * /*self*/, PyObject *args) { //printf("INFO HALMODULE -- make signal -> %s type %d\n",name,(hal_type_t) type); switch (type) { case HAL_BOOL: - case HAL_S32: - case HAL_U32: case HAL_SINT: case HAL_UINT: case HAL_REAL: @@ -1285,18 +1260,6 @@ static int set_common_cb(hal_query_t *q, void *arg) qvp->r = tmp; break; } - case HAL_S32: { - rtapi_s32 tmp; - if(!from_python(obj, &tmp)) return -EINVAL; - qvp->s = tmp; - break; - } - case HAL_U32: { - rtapi_u32 tmp; - if(!from_python(obj, &tmp)) return -EINVAL; - qvp->u = tmp; - break; - } case HAL_SINT: { rtapi_sint tmp; if(!from_python(obj, &tmp)) return -EINVAL; @@ -1358,8 +1321,6 @@ static PyObject *halref_to_object(hal_type_t type, const hal_query_value_u *v) { switch(type) { case HAL_BOOL: return to_python(v->b); - case HAL_U32: return to_python((rtapi_u32)v->u); - case HAL_S32: return to_python((rtapi_s32)v->s); case HAL_UINT: return to_python(v->u); case HAL_SINT: return to_python(v->s); case HAL_REAL: return to_python(v->r); @@ -1454,16 +1415,6 @@ static int pinparaminfo_add(const hal_query_t *q, PyObject *lst) str_n, q->name, str_v, PyBool_FromLong(hal_get_bool(q->pp.ref.b)), str_d, PyLong_FromLong(q->pp.dir), str_t, PyLong_FromLong(HAL_BOOL)); break; - case HAL_U32: - obj = Py_BuildValue("{s:s,s:k,s:N,s:N}", - str_n, q->name, str_v, hal_get_ui32(q->pp.ref.u), - str_d, PyLong_FromLong(q->pp.dir), str_t, PyLong_FromLong(HAL_U32)); - break; - case HAL_S32: - obj = Py_BuildValue("{s:s,s:l,s:N,s:N}", - str_n, q->name, str_v, hal_get_si32(q->pp.ref.s), - str_d, PyLong_FromLong(q->pp.dir), str_t, PyLong_FromLong(HAL_S32)); - break; case HAL_UINT: obj = Py_BuildValue("{s:s,s:K,s:N,s:N}", str_n, q->name, str_v, hal_get_uint(q->pp.ref.u), @@ -1548,16 +1499,6 @@ static int siginfo_add(const hal_query_t *q, PyObject *lst) str_n, q->name, str_v, PyBool_FromLong(hal_get_bool(q->sig.ref.b)), str_d, writer, str_t, PyLong_FromLong(HAL_BOOL)); break; - case HAL_U32: - obj = Py_BuildValue("{s:s,s:k,s:s,s:N}", - str_n, q->name, str_v, hal_get_ui32(q->sig.ref.u), - str_d, writer, str_t, PyLong_FromLong(HAL_U32)); - break; - case HAL_S32: - obj = Py_BuildValue("{s:s,s:l,s:s,s:N}", - str_n, q->name, str_v, hal_get_si32(q->sig.ref.s), - str_d, writer, str_t, PyLong_FromLong(HAL_S32)); - break; case HAL_UINT: obj = Py_BuildValue("{s:s,s:K,s:s,s:N}", str_n, q->name, str_v, hal_get_uint(q->sig.ref.u), @@ -1868,10 +1809,8 @@ static int pystream_init(PyObject *_self, PyObject *args, PyObject * /*kw*/) { switch(hal_stream_element_type(&self->stream, i)) { case HAL_BOOL: tbuf[i] = 'b'; break; case HAL_REAL: tbuf[i] = 'f'; break; - case HAL_S32: tbuf[i] = 's'; break; - case HAL_U32: tbuf[i] = 'u'; break; - case HAL_SINT: tbuf[i] = 'l'; break; - case HAL_UINT: tbuf[i] = 'k'; break; + case HAL_SINT: tbuf[i] = 's'; break; + case HAL_UINT: tbuf[i] = 'u'; break; default: tbuf[i] = '?'; break; } } @@ -2107,7 +2046,7 @@ static PyMethodDef module_methods[] = { {"get_msg_level", get_msg_level, METH_NOARGS, ".get_msg_level(): Get the RTAPI message level"}, {"new_sig", new_sig, METH_VARARGS, - ".new_sig('signal_name', type): Create a new signal with the specified name. 'type' is one of HAL_BIT, HAL_FLOAT, HAL_S32, or HAL_U32."}, + ".new_sig('signal_name', type): Create a new signal with the specified name. 'type' is one of HAL_BOOL, HAL_REAL, HAL_SINT, or HAL_UINT."}, {"connect", connect, METH_VARARGS, ".connect('pin_name', 'signal_name'): Connect the named pin to the named signal."}, {"disconnect", disconnect, METH_VARARGS, @@ -2148,8 +2087,8 @@ const char *module_doc = "Interface to LinuxCNC's hal\n" "import hal, time\n" "h = hal.component(\"component-name\")\n" "# create pins and parameters with calls to h.newpin and h.newparam\n" -"h.newpin(\"in\", hal.HAL_FLOAT, hal.HAL_IN)\n" -"h.newpin(\"out\", hal.HAL_FLOAT, hal.HAL_OUT)\n" +"h.newpin(\"in\", hal.Type.REAL, hal.Dir.IN)\n" +"h.newpin(\"out\", hal.Type.REAL, hal.Dir.OUT)\n" "h.ready() # mark the component as 'ready'\n" "\n" "try:\n" @@ -2193,15 +2132,11 @@ static const halenum_member_t halenum_type_members[] = { {"SINT", HAL_SINT}, {"UINT", HAL_UINT}, {"PORT", HAL_PORT}, - {"S32", HAL_S32}, - {"U32", HAL_U32}, {"HAL_BOOL", HAL_BOOL}, {"HAL_REAL", HAL_REAL}, {"HAL_SINT", HAL_SINT}, {"HAL_UINT", HAL_UINT}, {"HAL_PORT", HAL_PORT}, - {"HAL_S32", HAL_S32}, - {"HAL_U32", HAL_U32}, {} }; @@ -2321,12 +2256,6 @@ PyMODINIT_FUNC PyInit__hal(void) PyModule_AddIntConstant(m, "HAL_REAL", HAL_REAL); PyModule_AddIntConstant(m, "HAL_SINT", HAL_SINT); PyModule_AddIntConstant(m, "HAL_UINT", HAL_UINT); - PyModule_AddIntConstant(m, "HAL_BIT", HAL_BIT); - PyModule_AddIntConstant(m, "HAL_FLOAT", HAL_FLOAT); - PyModule_AddIntConstant(m, "HAL_S32", HAL_S32); - PyModule_AddIntConstant(m, "HAL_U32", HAL_U32); - PyModule_AddIntConstant(m, "HAL_S64", HAL_S64); - PyModule_AddIntConstant(m, "HAL_U64", HAL_U64); PyModule_AddIntConstant(m, "HAL_PORT", HAL_PORT); PyModule_AddIntConstant(m, "HAL_RO", HAL_RO); diff --git a/src/hal/halqrec.hh b/src/hal/halqrec.hh index fd79ddbcebb..71aec6926b8 100644 --- a/src/hal/halqrec.hh +++ b/src/hal/halqrec.hh @@ -94,6 +94,10 @@ public: throw std::runtime_error(fmt::format("HalQRec: Index {} out of range, no entries available", i)); } + void clear() { + n = 0; + memset(qr, 0, na * sizeof(*qr)); + } private: size_t n; size_t na; diff --git a/src/hal/halquery.cc b/src/hal/halquery.cc index 64fb36a92a1..d29f46aedfc 100644 --- a/src/hal/halquery.cc +++ b/src/hal/halquery.cc @@ -32,16 +32,12 @@ static py::object value_object(hal_type_t type, hal_refs_u u, bool ispin) { switch(type) { case HAL_BOOL: return py::bool_(hal_get_bool(u.b)); - case HAL_S32: return py::int_(hal_get_si32(u.s)); case HAL_SINT: return py::int_(hal_get_sint(u.s)); - case HAL_U32: return py::int_(hal_get_ui32(u.u)); case HAL_UINT: return py::int_(hal_get_uint(u.u)); case HAL_REAL: return py::float_(hal_get_real(u.r)); case HAL_PORT: - // FIXME - // Needs to change when we break the API and change hal_port_t if(ispin) - return py::int_(hal_port_buffer_size(reinterpret_cast(u.u))); + return py::int_(hal_port_buffer_size(u.p)); else return py::int_(0); // HAL_PORT cannot be a parameter default: return py::none(); diff --git a/src/hal/setps_util.c b/src/hal/setps_util.c index c3831376404..a5c44a5487c 100644 --- a/src/hal/setps_util.c +++ b/src/hal/setps_util.c @@ -63,12 +63,9 @@ int setps_common_cb(hal_query_t *q, void *arg) } } return -EINVAL; - case HAL_S32: case HAL_SINT: errno = 0; qvp->s = strtoll(value, &eptr, 0); - if(HAL_S32 == type && (qvp->s < RTAPI_INT32_MIN || qvp->s > RTAPI_INT32_MAX)) - return -ERANGE; if(0 != errno) return -errno; if(value == eptr || (('\0' != *eptr) && !isspace((unsigned char)*eptr))) @@ -80,12 +77,9 @@ int setps_common_cb(hal_query_t *q, void *arg) return -EBADF; } /* Fallthrough */ - case HAL_U32: case HAL_UINT: errno = 0; qvp->u = strtoull(value, &eptr, 0); - if((HAL_U32 == type || HAL_PORT == type) && qvp->u > RTAPI_UINT32_MAX) - return -ERANGE; if(0 != errno) return -errno; if(value == eptr || (('\0' != *eptr) && !isspace((unsigned char)*eptr))) diff --git a/src/hal/user_comps/hal_bridge.py b/src/hal/user_comps/hal_bridge.py index f2ea1211d72..c7481597696 100644 --- a/src/hal/user_comps/hal_bridge.py +++ b/src/hal/user_comps/hal_bridge.py @@ -76,7 +76,7 @@ def init_hal(self): self.jogIncrement = QHAL.newpin("jog-increment", hal.Type.REAL, hal.Dir.OUT) self.jogIncrementAngular = QHAL.newpin("jog-increment-angular", hal.Type.REAL, hal.Dir.OUT) - self.activeJoint = QHAL.newpin('joint-selected', hal.HAL_S32, hal.Dir.OUT) + self.activeJoint = QHAL.newpin('joint-selected', hal.Type.SINT, hal.Dir.OUT) for i in (self.INFO.AVAILABLE_AXES): let = i.lower() diff --git a/src/hal/user_comps/hal_input.py b/src/hal/user_comps/hal_input.py index 28f64cf018c..53f49225a32 100644 --- a/src/hal/user_comps/hal_input.py +++ b/src/hal/user_comps/hal_input.py @@ -91,7 +91,7 @@ def __init__(self, comp, idx, name, parts='KRAL'): name = tohalname(axis) self.codes.add(name) comp.newpin("%s.%s-position" % (idx, name), Type.REAL, Dir.OUT) - comp.newpin("%s.%s-counts" % (idx, name), HAL_S32, Dir.OUT) + comp.newpin("%s.%s-counts" % (idx, name), Type.SINT, Dir.OUT) comp.newpin("%s.%s-reset" % (idx, name), Type.BOOL, Dir.IN) comp.newpin("%s.%s-scale" % (idx, name), Type.REAL, Dir.IN) self.set(name + '-scale', 1.) @@ -103,15 +103,15 @@ def __init__(self, comp, idx, name, parts='KRAL'): self.codes.add(name) absinfo = self.device.get_absinfo(axis) comp.newpin("%s.%s-position" % (idx, name), Type.REAL, Dir.OUT) - comp.newpin("%s.%s-counts" % (idx, name), HAL_S32, Dir.OUT) + comp.newpin("%s.%s-counts" % (idx, name), Type.SINT, Dir.OUT) comp.newpin("%s.%s-is-pos" % (idx, name), Type.BOOL, Dir.OUT) comp.newpin("%s.%s-is-neg" % (idx, name), Type.BOOL, Dir.OUT) comp.newpin("%s.%s-scale" % (idx, name), Type.REAL, Dir.IN) comp.newpin("%s.%s-offset" % (idx, name), Type.REAL, Dir.IN) - comp.newpin("%s.%s-fuzz" % (idx, name), HAL_S32, Dir.IN) - comp.newpin("%s.%s-flat" % (idx, name), HAL_S32, Dir.IN) - comp.newparam("%s.%s-min" % (idx, name), HAL_S32, Dir.RO) - comp.newparam("%s.%s-max" % (idx, name), HAL_S32, Dir.RO) + comp.newpin("%s.%s-fuzz" % (idx, name), Type.SINT, Dir.IN) + comp.newpin("%s.%s-flat" % (idx, name), Type.SINT, Dir.IN) + comp.newparam("%s.%s-min" % (idx, name), Type.SINT, Dir.RO) + comp.newparam("%s.%s-max" % (idx, name), Type.SINT, Dir.RO) center = (absinfo.minimum + absinfo.maximum)/2. halfrange = (absinfo.maximum - absinfo.minimum)/2. or 1 self.set(name + "-counts", absinfo.value) diff --git a/src/hal/user_comps/mqtt-publisher.py b/src/hal/user_comps/mqtt-publisher.py index 25cf2a0bdb3..0a7c1ce60af 100755 --- a/src/hal/user_comps/mqtt-publisher.py +++ b/src/hal/user_comps/mqtt-publisher.py @@ -75,9 +75,9 @@ def create_pins(self, keys): self.hal.newpin('enable', hal.Type.BOOL, hal.Dir.IN) self.hal['enable'] = True - self.hal.newpin('period', hal.HAL_U32, hal.Dir.IN) + self.hal.newpin('period', hal.Type.UINT, hal.Dir.IN) self.hal['period'] = 10 - self.hal.newpin('lastpublish', hal.HAL_U32, hal.Dir.OUT) + self.hal.newpin('lastpublish', hal.Type.UINT, hal.Dir.OUT) self.hal['lastpublish'] = 0 self.hal.ready() diff --git a/src/hal/user_comps/mtconnect-agent.py b/src/hal/user_comps/mtconnect-agent.py index c4a5d87047e..d64e2d1f418 100755 --- a/src/hal/user_comps/mtconnect-agent.py +++ b/src/hal/user_comps/mtconnect-agent.py @@ -94,8 +94,8 @@ def make_hal_pins(): comp = hal.component("mtconnect-agent") comp.newpin("enable", hal.Type.BOOL, hal.Dir.IN) comp["enable"] = True - comp.newpin("sample-hz", hal.Type.U32, hal.Dir.IN) - comp.newpin("heartbeat", hal.Type.U32, hal.Dir.OUT) + comp.newpin("sample-hz", hal.Type.UINT, hal.Dir.IN) + comp.newpin("heartbeat", hal.Type.UINT, hal.Dir.OUT) # Status outputs (linkable in the HAL file): # active - agent is polling and serving # connected - MQTT broker link is up (stays low without MQTT; HTTP/SHDR diff --git a/src/hal/user_comps/pi500_vfd/pi500_vfd.comp b/src/hal/user_comps/pi500_vfd/pi500_vfd.comp index 792852b1ab4..92cc57bdf52 100644 --- a/src/hal/user_comps/pi500_vfd/pi500_vfd.comp +++ b/src/hal/user_comps/pi500_vfd/pi500_vfd.comp @@ -1,5 +1,5 @@ component pi500_vfd "Powtran PI500 Modbus driver"; -param rw ui32 mbslaveaddr "Modbus slave address"; +param rw uint mbslaveaddr "Modbus slave address"; pin in real commanded_frequency "Frequency of vfd"; pin in bool run "run the vfd"; pin in bool enable "1 to enable the vfd. 0 will remote trip the vfd, thereby disabling it."; @@ -134,7 +134,7 @@ bool pi500_getStatus(modbus_t* ctx, pi500_status* status) void print_modbus_error(struct __comp_state *__comp_inst, const char* msg) { fprintf(stderr, - "Error: pi500_vfd slave(%u): %s - Modbus error (%d) - %s\n", + "Error: pi500_vfd slave(%lu): %s - Modbus error (%d) - %s\n", mbslaveaddr, msg, errno, diff --git a/src/hal/user_comps/pyvcp.py b/src/hal/user_comps/pyvcp.py index f8b9bb22165..fd069371a15 100755 --- a/src/hal/user_comps/pyvcp.py +++ b/src/hal/user_comps/pyvcp.py @@ -21,7 +21,7 @@ """ Python Virtual Control Panel for EMC A virtual control panel (VCP) is used to display and control - HAL pins, which are either BIT or FLOAT valued. + HAL pins, which are either BOOL or REAL valued. Usage: pyvcp -g WxH+X+Y -c compname myfile.xml diff --git a/src/hal/user_comps/scorbot-er-3.py b/src/hal/user_comps/scorbot-er-3.py index f29221f0db9..2206223f798 100755 --- a/src/hal/user_comps/scorbot-er-3.py +++ b/src/hal/user_comps/scorbot-er-3.py @@ -79,7 +79,7 @@ def serial_read(num_bytes): h.newpin('joint%d.limit-sw' % joint, hal.Type.BOOL, hal.Dir.OUT) h.newpin('joint%d.motor-pos-cmd' % joint, hal.Type.REAL, hal.Dir.IN) h.newpin('joint%d.scale' % joint, hal.Type.REAL, hal.Dir.IN) - h.newpin('joint%d.motor-max-vel' % joint, hal.HAL_S32, hal.Dir.IN) + h.newpin('joint%d.motor-max-vel' % joint, hal.Type.SINT, hal.Dir.IN) h['joint%d.motor-pos-cmd' % joint] = 0.0 old_motor_pos_cmd[joint] = 0.0 diff --git a/src/hal/user_comps/sim-torch.py b/src/hal/user_comps/sim-torch.py index 87e27deb60a..de150d33c71 100644 --- a/src/hal/user_comps/sim-torch.py +++ b/src/hal/user_comps/sim-torch.py @@ -30,18 +30,18 @@ # create the hal pins h.setprefix('sim-torch') h.newpin('cut-noise-in', hal.Type.REAL, hal.Dir.IN) -h.newpin('cycles-in', hal.HAL_S32, hal.Dir.IN) -h.newpin('on-delay-in', hal.HAL_S32, hal.Dir.IN) +h.newpin('cycles-in', hal.Type.SINT, hal.Dir.IN) +h.newpin('on-delay-in', hal.Type.SINT, hal.Dir.IN) h.newpin('offset-in', hal.Type.REAL, hal.Dir.IN) -h.newpin('overshoot-in', hal.HAL_S32, hal.Dir.IN) +h.newpin('overshoot-in', hal.Type.SINT, hal.Dir.IN) h.newpin('ramp-noise-in', hal.Type.REAL, hal.Dir.IN) -h.newpin('ramp-up-in', hal.HAL_S32, hal.Dir.IN) +h.newpin('ramp-up-in', hal.Type.SINT, hal.Dir.IN) h.newpin('start', hal.Type.BOOL, hal.Dir.IN) h.newpin('voltage-in', hal.Type.REAL, hal.Dir.IN) h.newpin('close', hal.Type.BOOL, hal.Dir.IN) h.newpin('voltage-out', hal.Type.REAL, hal.Dir.OUT) h.newpin('void', hal.Type.BOOL, hal.Dir.IN) -h.newpin('void_ramp', hal.HAL_S32, hal.Dir.IN) +h.newpin('void_ramp', hal.Type.SINT, hal.Dir.IN) # setdefaults for input pins h['cut-noise-in'] = 0.75 h['cycles-in'] = 200 #"the number of cycles that the arc voltage overshoots the cut voltage (cycles)" diff --git a/src/hal/user_comps/wj200_vfd/wj200_vfd.comp b/src/hal/user_comps/wj200_vfd/wj200_vfd.comp index 71b1c9cf86b..5766a8e24e2 100644 --- a/src/hal/user_comps/wj200_vfd/wj200_vfd.comp +++ b/src/hal/user_comps/wj200_vfd/wj200_vfd.comp @@ -1,5 +1,5 @@ component wj200_vfd "Hitachi wj200 modbus driver"; -param rw ui32 mbslaveaddr "Modbus slave address"; +param rw uint mbslaveaddr "Modbus slave address"; param rw real frequency_scale = 1 "RPM / frequency, default 1"; pin in real commanded_frequency "Frequency of vfd (scaled to RPM)"; pin out real motor_frequency "Motor's actual frequency (scaled to RPM)"; @@ -174,7 +174,7 @@ bool wj200_getStatus(modbus_t* ctx, wj200_status* status) void print_modbus_error(struct __comp_state *__comp_inst, const char* msg) { fprintf(stderr, - "Error: wj200_vfd slave(%u): %s - Modbus error (%d) - %s\n", + "Error: wj200_vfd slave(%lu): %s - Modbus error (%d) - %s\n", mbslaveaddr, msg, errno, diff --git a/src/hal/user_comps/xhc-hb04.cc b/src/hal/user_comps/xhc-hb04.cc index 920cccfa245..6e928fd067d 100644 --- a/src/hal/user_comps/xhc-hb04.cc +++ b/src/hal/user_comps/xhc-hb04.cc @@ -526,7 +526,7 @@ static int hal_pin_simu(char *pin_name, void **ptr, int s) return 0; } -int _hal_pin_float_newf(hal_pin_dir_t dir, hal_real_t *data_ptr_addr, int comp_id, const char *fmt, ...) +int _hal_pin_float_newf(hal_pdir_t dir, hal_real_t *data_ptr_addr, int comp_id, const char *fmt, ...) { char pin_name[256]; va_list args; @@ -542,7 +542,7 @@ int _hal_pin_float_newf(hal_pin_dir_t dir, hal_real_t *data_ptr_addr, int comp_i } } -int _hal_pin_s32_newf(hal_pin_dir_t dir, hal_sint_t *data_ptr_addr, int comp_id, const char *fmt, ...) +int _hal_pin_s32_newf(hal_pdir_t dir, hal_sint_t *data_ptr_addr, int comp_id, const char *fmt, ...) { char pin_name[256]; va_list args; @@ -558,7 +558,7 @@ int _hal_pin_s32_newf(hal_pin_dir_t dir, hal_sint_t *data_ptr_addr, int comp_id, } } -int _hal_pin_bit_newf(hal_pin_dir_t dir, hal_bool_t *data_ptr_addr, int comp_id, const char *fmt, ...) +int _hal_pin_bit_newf(hal_pdir_t dir, hal_bool_t *data_ptr_addr, int comp_id, const char *fmt, ...) { char pin_name[256]; va_list args; diff --git a/src/hal/user_comps/xhc-whb04b-6/hal.cc b/src/hal/user_comps/xhc-whb04b-6/hal.cc index 843643490e0..f75611c6b06 100644 --- a/src/hal/user_comps/xhc-whb04b-6/hal.cc +++ b/src/hal/user_comps/xhc-whb04b-6/hal.cc @@ -232,7 +232,7 @@ int Hal::newSimulatedHalPin(char* /*pin_name*/, void** ptr, int s) return 0; } // ---------------------------------------------------------------------- -int Hal::newHalFloat(hal_pin_dir_t direction, hal_real_t *ptr, int componentId, const char *fmt, ...) +int Hal::newHalFloat(hal_pdir_t direction, hal_real_t *ptr, int componentId, const char *fmt, ...) { char pin_name[256]; va_list args; @@ -242,7 +242,7 @@ int Hal::newHalFloat(hal_pin_dir_t direction, hal_real_t *ptr, int componentId, assert(strlen(pin_name) < HAL_NAME_LEN); - *mHalCout << "hal float "; + *mHalCout << "hal real "; if (direction == HAL_OUT) { *mHalCout << "out "; @@ -268,7 +268,7 @@ int Hal::newHalFloat(hal_pin_dir_t direction, hal_real_t *ptr, int componentId, } } // ---------------------------------------------------------------------- -int Hal::newHalSigned32(hal_pin_dir_t direction, hal_sint_t *ptr, int componentId, const char *fmt, ...) +int Hal::newHalSigned32(hal_pdir_t direction, hal_sint_t *ptr, int componentId, const char *fmt, ...) { char pin_name[256]; va_list args; @@ -278,7 +278,7 @@ int Hal::newHalSigned32(hal_pin_dir_t direction, hal_sint_t *ptr, int componentI assert(strlen(pin_name) < HAL_NAME_LEN); - *mHalCout << "hal s32 "; + *mHalCout << "hal sint "; if (direction == HAL_OUT) { *mHalCout << "out "; @@ -304,7 +304,7 @@ int Hal::newHalSigned32(hal_pin_dir_t direction, hal_sint_t *ptr, int componentI } } // ---------------------------------------------------------------------- -int Hal::newHalUnsigned32(hal_pin_dir_t direction, hal_uint_t *ptr, int componentId, const char *fmt, ...) +int Hal::newHalUnsigned32(hal_pdir_t direction, hal_uint_t *ptr, int componentId, const char *fmt, ...) { char pin_name[256]; va_list args; @@ -314,7 +314,7 @@ int Hal::newHalUnsigned32(hal_pin_dir_t direction, hal_uint_t *ptr, int componen assert(strlen(pin_name) < HAL_NAME_LEN); - *mHalCout << "hal u32 "; + *mHalCout << "hal uint "; if (direction == HAL_OUT) { *mHalCout << "out "; @@ -340,7 +340,7 @@ int Hal::newHalUnsigned32(hal_pin_dir_t direction, hal_uint_t *ptr, int componen } } // ---------------------------------------------------------------------- -int Hal::newHalBit(hal_pin_dir_t direction, hal_bool_t *ptr, int componentId, const char *fmt, ...) +int Hal::newHalBit(hal_pdir_t direction, hal_bool_t *ptr, int componentId, const char *fmt, ...) { char pin_name[256]; va_list args; @@ -350,7 +350,7 @@ int Hal::newHalBit(hal_pin_dir_t direction, hal_bool_t *ptr, int componentId, co assert(strlen(pin_name) < HAL_NAME_LEN); - *mHalCout << "hal bit "; + *mHalCout << "hal bool "; if (direction == HAL_OUT) { *mHalCout << "out "; diff --git a/src/hal/user_comps/xhc-whb04b-6/hal.h b/src/hal/user_comps/xhc-whb04b-6/hal.h index 28a64aa1858..b5c05324b9f 100644 --- a/src/hal/user_comps/xhc-whb04b-6/hal.h +++ b/src/hal/user_comps/xhc-whb04b-6/hal.h @@ -588,19 +588,19 @@ class Hal //! \param s size in bytes //! \return != 0 on error, 0 otherwise int newSimulatedHalPin(char* pin_name, void** ptr, int s); - //! \sa int newHalFloat(hal_pin_dir_t direction, hal_real_t* ptr, int componentId, const char* fmt, ...); - int newHalFloat(hal_pin_dir_t direction, hal_real_t* ptr, int componentId, const char* fmt, ...); - //! \sa int newHalSigned32(hal_pin_dir_t direction, hal_sint_t* ptr, int componentId, const char* fmt, ...); - int newHalSigned32(hal_pin_dir_t direction, hal_sint_t* ptr, int componentId, const char* fmt, ...); - //! \sa int newHalUnsigned32(hal_pin_dir_t direction, hal_sint_t* ptr, int componentId, const char* fmt, ...); - int newHalUnsigned32(hal_pin_dir_t direction, hal_uint_t* ptr, int componentId, const char* fmt, ...); + //! \sa int newHalFloat(hal_pdir_t direction, hal_real_t* ptr, int componentId, const char* fmt, ...); + int newHalFloat(hal_pdir_t direction, hal_real_t* ptr, int componentId, const char* fmt, ...); + //! \sa int newHalSigned32(hal_pdir_t direction, hal_sint_t* ptr, int componentId, const char* fmt, ...); + int newHalSigned32(hal_pdir_t direction, hal_sint_t* ptr, int componentId, const char* fmt, ...); + //! \sa int newHalUnsigned32(hal_pdir_t direction, hal_sint_t* ptr, int componentId, const char* fmt, ...); + int newHalUnsigned32(hal_pdir_t direction, hal_uint_t* ptr, int componentId, const char* fmt, ...); //! \param direction module input or output //! \param ptr will point to the allocated memory //! \param componentId hal id //! \param fmt the pin name when registered to hal //! \param ... va args //! \return != 0 on error, 0 otherwise - int newHalBit(hal_pin_dir_t direction, hal_bool_t* ptr, int componentId, const char* fmt, ...); + int newHalBit(hal_pdir_t direction, hal_bool_t* ptr, int componentId, const char* fmt, ...); //! allocates new hal pin according to \ref mIsSimulationMode //! \param pin pointer reference to the memory to be fred //! \post pin == nullptr diff --git a/src/hal/user_comps/z_level_compensation.py b/src/hal/user_comps/z_level_compensation.py index 6e7bdaa654e..07c1c94bd96 100644 --- a/src/hal/user_comps/z_level_compensation.py +++ b/src/hal/user_comps/z_level_compensation.py @@ -112,13 +112,13 @@ def run(self): self.h = hal.component("z_level_compensation") self.h.newpin("enable-in", hal.Type.BOOL, hal.Dir.IN) self.h.newpin("scale", hal.Type.REAL, hal.Dir.OUT) - self.h.newpin("counts", hal.HAL_S32, hal.Dir.OUT) + self.h.newpin("counts", hal.Type.SINT, hal.Dir.OUT) self.h.newpin("clear", hal.Type.BOOL, hal.Dir.IN) self.h.newpin("x-pos", hal.Type.REAL, hal.Dir.IN) self.h.newpin("y-pos", hal.Type.REAL, hal.Dir.IN) self.h.newpin("z-pos", hal.Type.REAL, hal.Dir.IN) self.h.newpin("fade-height", hal.Type.REAL, hal.Dir.IN) - self.h.newpin("method", hal.HAL_S32, hal.Dir.IN) + self.h.newpin("method", hal.Type.SINT, hal.Dir.IN) self.h.ready() self.stat = linuxcnc.stat() diff --git a/src/hal/utils/halcmd_commands.cc b/src/hal/utils/halcmd_commands.cc index 569293f2f4e..334f875841b 100644 --- a/src/hal/utils/halcmd_commands.cc +++ b/src/hal/utils/halcmd_commands.cc @@ -60,6 +60,7 @@ #include #include "hal/setps_util.h" +#include "hal/halqrec.hh" static int unloadrt_comp(const char *mod_name); static void print_comp_info(const char **patterns); @@ -619,25 +620,31 @@ static hal_type_t typestr_to_haltype(const char *type, bool anycase) { static const struct { const char *name; + const char *repl; hal_type_t type; } htypes[] = { - { "bool", HAL_BOOL }, - { "real", HAL_REAL }, - { "sint", HAL_SINT }, - { "uint", HAL_UINT }, - { "port", HAL_PORT }, - { "bit", HAL_BOOL }, - { "float", HAL_REAL }, - { "u32", HAL_U32 }, - { "s32", HAL_S32 }, - { "u64", HAL_UINT }, - { "s64", HAL_SINT }, - { nullptr, HAL_TYPE_UNSPECIFIED } + { "bool", nullptr, HAL_BOOL }, + { "real", nullptr, HAL_REAL }, + { "sint", nullptr, HAL_SINT }, + { "uint", nullptr, HAL_UINT }, + { "port", nullptr, HAL_PORT }, + { "bit", "bool", HAL_BOOL }, + { "float", "real", HAL_REAL }, + { "u32", "uint", HAL_UINT }, + { "s32", "sint", HAL_SINT }, + { "u64", "uint", HAL_UINT }, + { "s64", "sint", HAL_SINT }, + { "signed", "sint", HAL_SINT }, + { "unsigned", "uint", HAL_SINT }, + { nullptr, nullptr, HAL_TYPE_UNSPECIFIED } }; int (*cmpfunc)(const char *, const char *) = anycase ? strcasecmp : strcmp; for(int i = 0; htypes[i].name; i++) { if(!cmpfunc(type, htypes[i].name)) { + if(nullptr != htypes[i].repl) { + halcmd_warning("Old type '%s' has been replaced by '%s'\n", type, htypes[i].repl); + } return htypes[i].type; } } @@ -707,11 +714,9 @@ static std::string querydata_valuestr(hal_type_t type, const hal_query_value_u * return v->b ? "TRUE" : "FALSE"; case HAL_REAL: return fmt::format("{:.7g}", v->r); - case HAL_S32: case HAL_SINT: case HAL_PORT: return fmt::format("{}", v->s); - case HAL_U32: case HAL_UINT: return fmt::format("{}", v->u); default: @@ -792,8 +797,6 @@ static int get_type(const char ***patterns) { hal_type_t htype = typestr_to_haltype(typestr, false); if(htype != HAL_TYPE_UNINITIALIZED) return htype; - if(strcmp(typestr, "signed") == 0) return HAL_S32; - if(strcmp(typestr, "unsigned") == 0) return HAL_U32; return -1; } @@ -1011,13 +1014,6 @@ int do_loadrt_cmd(const char *mod_name, const char *args[]) return 0; } -static int delsig_cmd_cb(hal_query_t *q, void *arg) -{ - std::vector *sigs = reinterpret_cast *>(arg); - sigs->push_back(q->name); - return 0; -} - int do_delsig_cmd(const char *signame) { if(strcmp(signame, "all")) { @@ -1034,8 +1030,16 @@ int do_delsig_cmd(const char *signame) // Build a list of signals to delete std::vector sigs; + HalQRec qrec(256); hal_query_t q = {}; - hal_list_s(&q, delsig_cmd_cb, (void *)&sigs); + int rv = hal_list_s(&q, HalQRec::get_qrec_cb, &qrec); + if(0 != rv) { + halcmd_error("Failed to get signal list error=%d (%s)\n", rv, hal_strerror(rv)); + return -1; + } + for(size_t i = 0; i < qrec.size(); i++) { + sigs.push_back(qrec.rec(i)->name); + } if(0 == sigs.size()) { halcmd_error("no signals found to be deleted\n"); @@ -1078,15 +1082,6 @@ int do_unloadusr_cmd(const char *mod_name) return 0; } -static int unloadrt_cmd_cb(hal_query_t *q, void *arg) -{ - std::vector *comps = reinterpret_cast *>(arg); - if(HAL_COMP_TYPE_REALTIME == q->comp.type) { - comps->push_back(q->name); - } - return 0; -} - int do_unloadrt_cmd(const char *mod_name) { if(strcmp(mod_name, "all")) { @@ -1115,8 +1110,18 @@ int do_unloadrt_cmd(const char *mod_name) // Need to unload all modules // Build a list of loaded modules std::vector comps; + HalQRec qrec; hal_query_t q = {}; - hal_list_comp(&q, unloadrt_cmd_cb, (void *)&comps); + int rv = hal_list_comp(&q, HalQRec::get_qrec_cb, &qrec); + if(0 != rv) { + halcmd_error("Failed to list all components, error=%d (%s)\n", rv, hal_strerror(rv)); + return rv; + } + for(size_t i = 0; i < qrec.size(); i++) { + if(HAL_COMP_TYPE_REALTIME == qrec.rec(i)->comp.type) { + comps.push_back(qrec.rec(i)->name); + } + } /* Unload newest first so dependent modules release their references before the ones they depend on are removed. This matters for @@ -1233,17 +1238,14 @@ is not fixed or has regressed by debian jessie) #include -static int get_all_comp_names_cb(hal_query_t *q, void *arg) -{ - std::set *comps = reinterpret_cast *>(arg); - comps->insert(q->name); - return 0; -} - static std::set get_all_comp_names() { std::set result; + HalQRec qrec; hal_query_t q = {}; - hal_list_comp(&q, get_all_comp_names_cb, (void *)&result); + hal_list_comp(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) { + result.insert(qrec.rec(i)->name); + } return result; } @@ -1441,11 +1443,10 @@ int do_waitusr_cmd(const char *comp_name) return 0; } -static int print_comp_info_cb(hal_query_t *q, void *arg) +static void print_comp_info_print(const hal_query_t *q, const char **patterns) { - const char **patterns = (const char **)arg; if(!match(patterns, q->name)) - return 0; + return; switch(q->comp.type) { case HAL_COMP_TYPE_USER: @@ -1476,7 +1477,6 @@ static int print_comp_info_cb(hal_query_t *q, void *arg) break; } halcmd_output("\n"); - return 0; } static void print_comp_info(const char **patterns) @@ -1485,16 +1485,18 @@ static void print_comp_info(const char **patterns) halcmd_output("Loaded HAL Components:\n"); halcmd_output("ID Type %-*s PID State\n", HAL_NAME_LEN, "Name"); } + HalQRec qrec; hal_query_t q = {}; - hal_list_comp(&q, print_comp_info_cb, (void *)patterns); + hal_list_comp(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_comp_info_print(qrec.rec(i), patterns); halcmd_output("\n"); } -static int print_pin_info_cb(hal_query_t *q, void *arg) +static void print_pin_info_print(const hal_query_t *q, int type, const char **patterns) { - const char **patterns = (const char **)arg; - if(!tmatch(q->callerdata.sival, q->pp.type) || !match(patterns, q->name)) - return 0; + if(!tmatch(type, q->pp.type) || !match(patterns, q->name)) + return; if (scriptmode == 0) { halcmd_output(" %5d %5s %-3s %9s %s", @@ -1516,7 +1518,6 @@ static int print_pin_info_cb(hal_query_t *q, void *arg) } else { halcmd_output(" %s %s\n", data_arrow1(q->pp.dir), q->pp.signal); } - return 0; } static void print_pin_info(int type, const char **patterns) @@ -1525,27 +1526,27 @@ static void print_pin_info(int type, const char **patterns) halcmd_output("Component Pins:\n"); halcmd_output("Owner Type Dir Value Name\n"); } + HalQRec qrec(1024); hal_query_t q = {}; q.qtype = HAL_QTYPE_PIN; - q.callerdata.sival = type; - hal_list_p(&q, print_pin_info_cb, (void *)patterns); + hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_pin_info_print(qrec.rec(i), type, patterns); halcmd_output("\n"); } -static int print_pin_aliases_cb(hal_query_t *q, void *arg) +static void print_pin_aliases_print(const hal_query_t *q, const char **patterns) { - const char **patterns = (const char **)arg; if(q->pp.alias) { /* name is an alias */ if(!match(patterns, q->name) && !match(patterns, q->pp.alias)) - return 0; + return; if(scriptmode == 0) { halcmd_output(" %-*s %s\n", HAL_NAME_LEN, q->name, q->pp.alias); } else { halcmd_output(" %s %s\n", q->name, q->pp.alias); } } - return 0; } static void print_pin_aliases(const char **patterns) @@ -1554,23 +1555,19 @@ static void print_pin_aliases(const char **patterns) halcmd_output("Pin Aliases:\n"); halcmd_output(" %-*s %s\n", HAL_NAME_LEN, "Alias", "Original Name"); } + HalQRec qrec(1024); hal_query_t q = {}; q.qtype = HAL_QTYPE_PIN; - hal_list_p(&q, print_pin_aliases_cb, (void *)patterns); + hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_pin_aliases_print(qrec.rec(i), patterns); halcmd_output("\n"); } -static int print_sig_pin_info_cb(hal_query_t *q, void *) +static void print_sig_info_print(const hal_query_t *q, int type, const char **patterns) { - halcmd_output("%32s %s %s\n", "", data_arrow2(q->pp.dir), q->name); - return 0; -} - -static int print_sig_info_cb(hal_query_t *q, void *arg) -{ - const char **patterns = (const char **)arg; - if(!tmatch(q->callerdata.sival, q->sig.type) || !match(patterns, q->name)) - return 0; + if(!tmatch(type, q->sig.type) || !match(patterns, q->name)) + return; halcmd_output("%s %s %s\n", data_type(q->sig.type), @@ -1578,10 +1575,13 @@ static int print_sig_info_cb(hal_query_t *q, void *arg) q->name); // List all pins connected to the signal + HalQRec qrec; hal_query_t qs = {}; qs.name = q->name; - hal_list_p_s(&qs, print_sig_pin_info_cb, NULL); - return 0; + hal_list_p_s(&qs, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) { + halcmd_output("%32s %s %s\n", "", data_arrow2(qrec.rec(i)->pp.dir), qrec.rec(i)->name); + } } static void print_sig_info(int type, const char **patterns) @@ -1593,49 +1593,48 @@ static void print_sig_info(int type, const char **patterns) halcmd_output("Signals:\n"); halcmd_output("Type Value Name (linked to)\n"); + HalQRec qrec(256); hal_query_t q = {}; - q.callerdata.sival = type; - hal_list_s(&q, print_sig_info_cb, (void *)patterns); + hal_list_s(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_sig_info_print(qrec.rec(i), type, patterns); halcmd_output("\n"); } -static int print_script_sig_pin_info_cb(hal_query_t *q, void *) +static void print_script_sig_info_print(const hal_query_t *q, int type, const char **patterns) { - halcmd_output(" %s %s", data_arrow2(q->pp.dir), q->name); - return 0; -} - -static int print_script_sig_info_cb(hal_query_t *q, void *arg) -{ - const char **patterns = (const char **)arg; - if(!tmatch(q->callerdata.sival, q->sig.type) || !match(patterns, q->name)) - return 0; + if(!tmatch(type, q->sig.type) || !match(patterns, q->name)) + return; halcmd_output("%s %s %s", data_type(q->sig.type), querydata_refstr(q->sig.type, q->sig.ref).c_str(), q->name); // List all pins connected to the signal + HalQRec qrec; hal_query_t qs = {}; qs.name = q->name; - hal_list_p_s(&qs, print_script_sig_pin_info_cb, NULL); + hal_list_p_s(&qs, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) { + halcmd_output(" %s %s", data_arrow2(qrec.rec(i)->pp.dir), qrec.rec(i)->name); + } halcmd_output("\n"); - return 0; } static void print_script_sig_info(int type, const char **patterns) { if(!scriptmode) return; + HalQRec qrec(256); hal_query_t q = {}; - q.callerdata.sival = type; - hal_list_s(&q, print_script_sig_info_cb, (void *)patterns); + hal_list_s(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_script_sig_info_print(qrec.rec(i), type, patterns); halcmd_output("\n"); } -static int print_param_info_cb(hal_query_t *q, void *arg) +static void print_param_info_print(const hal_query_t *q, int type, const char **patterns) { - const char **patterns = (const char **)arg; - if(!tmatch(q->callerdata.sival, q->pp.type) || !match(patterns, q->name)) - return 0; + if(!tmatch(type, q->pp.type) || !match(patterns, q->name)) + return; if(!scriptmode) { halcmd_output(" %5d %5s %-3s %9s %s\n", @@ -1652,7 +1651,6 @@ static int print_param_info_cb(hal_query_t *q, void *arg) querydata_refstr(q->pp.type, q->pp.ref).c_str(), q->name); } - return 0; } static void print_param_info(int type, const char **patterns) @@ -1661,20 +1659,22 @@ static void print_param_info(int type, const char **patterns) halcmd_output("Parameters:\n"); halcmd_output("Owner Type Dir Value Name\n"); } + HalQRec qrec(512); hal_query_t q = {}; q.callerdata.sival = type; q.qtype = HAL_QTYPE_PARAM; - hal_list_p(&q, print_param_info_cb, (void *)patterns); + hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_param_info_print(qrec.rec(i), type, patterns); halcmd_output("\n"); } -static int print_param_aliases_cb(hal_query_t *q, void *arg) +static void print_param_aliases_print(const hal_query_t *q, const char **patterns) { - const char **patterns = (const char **)arg; if(NULL == q->pp.alias) - return 0; + return; if(!match(patterns, q->name) && !match(patterns, q->pp.alias)) - return 0; + return; // name is an alias if(!scriptmode) { @@ -1682,7 +1682,6 @@ static int print_param_aliases_cb(hal_query_t *q, void *arg) } else { halcmd_output(" %s %s\n", q->name, q->pp.alias); } - return 0; } static void print_param_aliases(const char **patterns) @@ -1691,17 +1690,19 @@ static void print_param_aliases(const char **patterns) halcmd_output("Parameter Aliases:\n"); halcmd_output(" %-*s %s\n", HAL_NAME_LEN, "Alias", "Original Name"); } + HalQRec qrec(512); hal_query_t q = {}; q.qtype = HAL_QTYPE_PARAM; // Only parameters - hal_list_p(&q, print_param_aliases_cb, (void *)patterns); + hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_param_aliases_print(qrec.rec(i), patterns); halcmd_output("\n"); } -static int print_funct_info_cb(hal_query_t *q, void *arg) +static void print_funct_info_print(const hal_query_t *q, const char **patterns) { - const char **patterns = (const char **)arg; if(!match(patterns, q->name)) - return 0; + return; if(!scriptmode) { halcmd_output(" %05d %08llx %08llx %-3s %5d %s\n", q->funct.comp_id, @@ -1719,7 +1720,6 @@ static int print_funct_info_cb(hal_query_t *q, void *arg) q->funct.users, q->name); } - return 0; } static void print_funct_info(const char **patterns) @@ -1728,16 +1728,18 @@ static void print_funct_info(const char **patterns) halcmd_output("Exported Functions:\n"); halcmd_output("Owner CodeAddr Arg FP Users Name\n"); } + HalQRec qrec; hal_query_t q = {}; - hal_list_funct(&q, print_funct_info_cb, (void *)patterns); + hal_list_funct(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_funct_info_print(qrec.rec(i), patterns); halcmd_output("\n"); } -static int print_thread_info_cb(hal_query_t *q, void *arg) +static void print_thread_info_print(const hal_query_t *q, const char **patterns) { - const char **patterns = (const char **)arg; if(!match(patterns, q->name)) - return 0; + return; // The first callback is on the pure thread data if(HAL_QTYPE_THREAD == q->qtype) { @@ -1746,12 +1748,12 @@ static int print_thread_info_cb(hal_query_t *q, void *arg) size_t ret = snprintf(tname, sizeof(tname), "%s.time", q->name); if (ret >= sizeof(tname)) { rtapi_print_msg(RTAPI_MSG_ERR, "unexpected: time pin name too long for buffer %s\n", q->name); - return 0; + return; } ret = snprintf(mname, sizeof(mname), "%s.tmax", q->name); if (ret >= sizeof(mname)) { rtapi_print_msg(RTAPI_MSG_ERR, "unexpected: tmax pin name too long for buffer %s\n", q->name); - return 0; + return; } hal_query_t qt = {}; qt.name = tname; @@ -1786,7 +1788,6 @@ static int print_thread_info_cb(hal_query_t *q, void *arg) if(scriptmode) { halcmd_output("\n"); } - return 0; } static void print_thread_info(const char **patterns) @@ -1795,63 +1796,82 @@ static void print_thread_info(const char **patterns) halcmd_output("Realtime Threads:\n"); halcmd_output(" Period FP Name ( Time, Max-Time )\n"); } + HalQRec qrec; hal_query_t q = {}; q.qtype = HAL_QTYPE_THREAD_FUNCT; // Callback on both threads and functions attached - hal_list_thread(&q, print_thread_info_cb, (void *)patterns); + hal_list_thread(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_thread_info_print(qrec.rec(i), patterns); halcmd_output("\n"); } -static int print_any_names_cb(hal_query_t *q, void *arg) +static void print_any_names_print(const hal_query_t *q, const char **patterns) { - const char **patterns = (const char **)arg; if(!match(patterns, q->name)) - return 0; + return; halcmd_output("%s ", q->name); - return 0; } static void print_comp_names(const char **patterns) { + HalQRec qrec; hal_query_t q = {}; - hal_list_comp(&q, print_any_names_cb, (void *)patterns); + hal_list_comp(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_any_names_print(qrec.rec(i), patterns); halcmd_output("\n"); } static void print_pin_names(const char **patterns) { + HalQRec qrec(1024); hal_query_t q = {}; q.qtype = HAL_QTYPE_PIN; // Pins only - hal_list_p(&q, print_any_names_cb, (void *)patterns); + hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_any_names_print(qrec.rec(i), patterns); halcmd_output("\n"); } static void print_sig_names(const char **patterns) { + HalQRec qrec(256); hal_query_t q = {}; - hal_list_s(&q, print_any_names_cb, (void *)patterns); + hal_list_s(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_any_names_print(qrec.rec(i), patterns); halcmd_output("\n"); } static void print_param_names(const char **patterns) { + HalQRec qrec(512); hal_query_t q = {}; q.qtype = HAL_QTYPE_PARAM; // Parameters only - hal_list_p(&q, print_any_names_cb, (void *)patterns); + hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_any_names_print(qrec.rec(i), patterns); halcmd_output("\n"); } static void print_funct_names(const char **patterns) { + HalQRec qrec; hal_query_t q = {}; - hal_list_funct(&q, print_any_names_cb, (void *)patterns); + hal_list_funct(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_any_names_print(qrec.rec(i), patterns); halcmd_output("\n"); } static void print_thread_names(const char **patterns) { + HalQRec qrec; hal_query_t q = {}; q.qtype = HAL_QTYPE_THREAD; // Only thread names - hal_list_thread(&q, print_any_names_cb, (void *)patterns); + hal_list_thread(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + print_any_names_print(qrec.rec(i), patterns); halcmd_output("\n"); } @@ -1900,12 +1920,10 @@ static void print_mem_status() static const char *data_type(hal_type_t type) { switch (type) { - case HAL_BOOL: return "bit "; - case HAL_REAL: return "float"; - case HAL_S32: return "s32 "; - case HAL_U32: return "u32 "; - case HAL_SINT: return "s64 "; - case HAL_UINT: return "u64 "; + case HAL_BOOL: return "bool "; + case HAL_REAL: return "real "; + case HAL_SINT: return "sint "; + case HAL_UINT: return "uint "; case HAL_PORT: return "port "; default: return "undef"; /* Shouldn't get here, but just in case... */ } @@ -1914,12 +1932,10 @@ static const char *data_type(hal_type_t type) static const char *data_type2(hal_type_t type) { switch (type) { - case HAL_BOOL: return "bit"; - case HAL_REAL: return "float"; - case HAL_S32: return "s32"; - case HAL_U32: return "u32"; - case HAL_SINT: return "s64"; - case HAL_UINT: return "u64"; + case HAL_BOOL: return "bool"; + case HAL_REAL: return "real"; + case HAL_SINT: return "sint"; + case HAL_UINT: return "uint"; case HAL_PORT: return "port"; default: return "undef"; /* Shouldn't get here, but just in case... */ } @@ -1978,15 +1994,12 @@ static std::string querydata_refstr_20(hal_type_t type, hal_refs_u u) return fmt::format("{:>20s}", hal_get_bool(u.b) ? "TRUE" : "FALSE"); case HAL_REAL: return fmt::format("{:20.7g}", hal_get_real(u.r)); - case HAL_S32: - return fmt::format("{:20d}", (long)hal_get_si32(u.s)); case HAL_SINT: + return fmt::format("{:20d}", hal_get_sint(u.s)); case HAL_PORT: - return fmt::format("{:20d}", (long long)hal_get_sint(u.s)); - case HAL_U32: - return fmt::format(" 0x{:08X}", (unsigned long)hal_get_ui32(u.u)); + return fmt::format("{:20d}", hal_port_buffer_size(u.p)); case HAL_UINT: - return fmt::format(" 0x{:016X}", (unsigned long long)hal_get_uint(u.u)); + return fmt::format(" 0x{:016X}", hal_get_uint(u.u)); default: /* Shouldn't get here, but just in case... */ return " undef "; @@ -2003,13 +2016,10 @@ static std::string querydata_refstr(hal_type_t type, hal_refs_u u) return hal_get_bool(u.b) ? "TRUE" : "FALSE"; case HAL_REAL: return fmt::format("{:.7g}", hal_get_real(u.r)); - case HAL_S32: - return fmt::format("{}", hal_get_si32(u.s)); case HAL_SINT: - case HAL_PORT: return fmt::format("{}", hal_get_sint(u.s)); - case HAL_U32: - return fmt::format("{}", hal_get_ui32(u.u)); + case HAL_PORT: + return fmt::format("{}", hal_port_buffer_size(u.p)); case HAL_UINT: return fmt::format("{}", hal_get_uint(u.u)); default: @@ -2097,19 +2107,16 @@ struct _comp_save_data_t { const char *insmod; }; -static int save_comp_cb(hal_query_t *q, void *arg) -{ - std::vector<_comp_save_data_t> *v = (std::vector<_comp_save_data_t> *)arg; - if(HAL_COMP_TYPE_REALTIME == q->comp.type) - v->push_back({q->name, q->comp.insmod}); - return 0; -} - static void save_comps(FILE *dst) { + HalQRec qrec; hal_query_t q = {}; std::vector<_comp_save_data_t> compdata; - hal_list_comp(&q, save_comp_cb, (void *)&compdata); + hal_list_comp(&q,HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) { + if(HAL_COMP_TYPE_REALTIME == qrec.rec(i)->comp.type) + compdata.push_back({qrec.rec(i)->name, qrec.rec(i)->comp.insmod}); + } fprintf(dst, "# components\n"); if(0 == compdata.size()) { @@ -2126,63 +2133,55 @@ static void save_comps(FILE *dst) } } -static int save_aliases_cb(hal_query_t *q, void *arg) -{ - FILE *fp = (FILE *)arg; - if(q->pp.alias) { - const char *s = q->qtype == HAL_QTYPE_PIN ? "pin" : "param"; - fprintf(fp, "alias %s %s %s\n", s, q->pp.alias, q->name); - } - return 0; -} - static void save_aliases(FILE *dst) { + HalQRec qrec(1024); hal_query_t q = {}; q.qtype = HAL_QTYPE_PIN; fprintf(dst, "# pin aliases\n"); - hal_list_p(&q, save_aliases_cb, (void *)dst); + hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) { + if(qrec.rec(i)->pp.alias) + fprintf(dst, "alias pin %s %s\n", qrec.rec(i)->pp.alias, qrec.rec(i)->name); + } + qrec.clear(); q = {}; q.qtype = HAL_QTYPE_PARAM; fprintf(dst, "# param aliases\n"); - hal_list_p(&q, save_aliases_cb, (void *)dst); -} - -static int save_signals_cb(hal_query_t *q, void *arg) -{ - FILE *fp = (FILE *)arg; - // FIXME: What about the bidirs? - if(!(q->callerdata.sival && (q->sig.writers || q->sig.readers))) - fprintf(fp, "newsig %s %s\n", q->name, data_type(q->sig.type)); - return 0; + hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) { + if(qrec.rec(i)->pp.alias) + fprintf(dst, "alias param %s %s\n", qrec.rec(i)->pp.alias, qrec.rec(i)->name); + } } static void save_signals(FILE *dst, int only_unlinked) { + HalQRec qrec(256); hal_query_t q = {}; - q.callerdata.sival = only_unlinked; + hal_list_s(&q, HalQRec::get_qrec_cb, &qrec); fprintf(dst, "# signals\n"); - hal_list_s(&q, save_signals_cb, (void *)dst); -} - -static int save_links_cb(hal_query_t *q, void *arg) -{ - FILE *fp = (FILE *)arg; - if(q->pp.signal) { - const char *arrow_str = q->callerdata.sival ? data_arrow1(q->pp.dir) : ""; - fprintf(fp, "linkps %s %s %s\n", q->name, arrow_str, q->pp.signal); + for(size_t i = 0; i < qrec.size(); i++) { + // FIXME: What about the bidirs? + if(!(only_unlinked && (qrec.rec(i)->sig.writers || qrec.rec(i)->sig.readers))) + fprintf(dst, "newsig %s %s\n", qrec.rec(i)->name, data_type(qrec.rec(i)->sig.type)); } - return 0; } static void save_links(FILE *dst, int arrow) { + HalQRec qrec(1024); hal_query_t q = {}; q.qtype = HAL_QTYPE_PIN; - q.callerdata.sival = arrow; + hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); fprintf(dst, "# links\n"); - hal_list_p(&q, save_links_cb, (void *)dst); + for(size_t i = 0; i < qrec.size(); i++) { + if(qrec.rec(i)->pp.signal) { + const char *arrow_str = arrow ? data_arrow1(qrec.rec(i)->pp.dir) : ""; + fprintf(dst, "linkps %s %s %s\n", qrec.rec(i)->name, arrow_str, qrec.rec(i)->pp.signal); + } + } } struct save_nets_state_t { @@ -2190,20 +2189,17 @@ struct save_nets_state_t { int first; }; -static int save_nets_3_outpins_cb(hal_query_t *q, void *arg) +static void save_nets_3_outpins_print(const hal_query_t *q, save_nets_state_t *st, FILE *fp) { if(HAL_OUT == q->pp.dir) { - fprintf((FILE *)arg, " %s", q->name); - reinterpret_cast(q->callerdata.vpval)->state = 1; + fprintf(fp, " %s", q->name); + st->state = 1; } - return 0; } -static int save_nets_3_iopins_cb(hal_query_t *q, void *arg) +static void save_nets_3_iopins_print(const hal_query_t *q, save_nets_state_t *st, FILE *fp) { if(HAL_IO == q->pp.dir) { - FILE *fp = (FILE *)arg; - save_nets_state_t *st = reinterpret_cast(q->callerdata.vpval); fprintf(fp, " "); if(st->state) { fprintf(fp, "=> "); @@ -2214,14 +2210,11 @@ static int save_nets_3_iopins_cb(hal_query_t *q, void *arg) fprintf(fp, "%s", q->name); st->first = 0; } - return 0; } -static int save_nets_3_inpins_cb(hal_query_t *q, void *arg) +static void save_nets_3_inpins_print(const hal_query_t *q, save_nets_state_t *st, FILE *fp) { if(HAL_IN == q->pp.dir) { - FILE *fp = (FILE *)arg; - save_nets_state_t *st = reinterpret_cast(q->callerdata.vpval); fprintf(fp, " "); if(st->state) { fprintf(fp, "=> "); @@ -2229,103 +2222,98 @@ static int save_nets_3_inpins_cb(hal_query_t *q, void *arg) } fprintf(fp, "%s", q->name); } - return 0; } -static int save_nets_3_cb(hal_query_t *q, void *arg) +static void save_nets_3_print(const hal_query_t *q, FILE *fp) { - FILE *fp = (FILE *)arg; save_nets_state_t st = {.state = 0, .first = 1}; hal_query_t qp; // If there are no pins connected to this signal, do nothing if(!q->sig.writers && !q->sig.readers && !q->sig.bidirs) - return 0; + return; fprintf(fp, "net %s", q->name); - /* Step 1: Output pin, if any */ + // Step 0: Get the connections + HalQRec qrec; qp = {}; qp.name = q->name; - qp.callerdata.vpval = &st; // Counts pins - hal_list_p_s(&qp, save_nets_3_outpins_cb, arg); + hal_list_p_s(&qp, HalQRec::get_qrec_cb, &qrec); + + /* Step 1: Output pin, if any */ + for(size_t i = 0; i < qrec.size(); i++) + save_nets_3_outpins_print(qrec.rec(i), &st, fp); /* Step 2: I/O pins, if any */ - qp = {}; - qp.name = q->name; - qp.callerdata.vpval = &st; - hal_list_p_s(&qp, save_nets_3_iopins_cb, arg); + for(size_t i = 0; i < qrec.size(); i++) + save_nets_3_iopins_print(qrec.rec(i), &st, fp); if(!st.first) st.state = 1; /* Step 3: Input pins, if any */ - qp = {}; - qp.name = q->name; - qp.callerdata.vpval = &st; - hal_list_p_s(&qp, save_nets_3_inpins_cb, arg); + for(size_t i = 0; i < qrec.size(); i++) + save_nets_3_inpins_print(qrec.rec(i), &st, fp); fprintf(fp, "\n"); - return 0; } static void save_nets_3(FILE *dst) { + HalQRec qrec(256); hal_query_t q = {}; - hal_list_s(&q, save_nets_3_cb, (void *)dst); + hal_list_s(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + save_nets_3_print(qrec.rec(i), dst); } -static int save_nets_2_pins_cb(hal_query_t *q, void *arg) +static void save_nets_2_print(const hal_query_t *q, FILE *fp) { - fprintf((FILE *)arg, " %s", q->name); - return 0; -} - -static int save_nets_2_cb(hal_query_t *q, void *arg) -{ - FILE *fp = (FILE *)arg; - // If there are no pins connected to this signal, do nothing if(!q->sig.writers && !q->sig.readers && !q->sig.bidirs) - return 0; + return; fprintf(fp, "net %s", q->name); + HalQRec qrec; hal_query_t qp = {}; qp.name = q->name; - hal_list_p_s(&qp, save_nets_2_pins_cb, arg); + hal_list_p_s(&qp, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) { + fprintf(fp, " %s", qrec.rec(i)->name); + } fprintf(fp, "\n"); - return 0; } static void save_nets_2(FILE *dst) { + HalQRec qrec(256); hal_query_t q = {}; - hal_list_s(&q, save_nets_2_cb, (void *)dst); -} - -static int save_nets_01_pins_cb(hal_query_t *q, void *arg) -{ - FILE *fp = (FILE *)arg; - const char *arrow_str = q->callerdata.sival ? data_arrow2(q->pp.dir) : ""; - fprintf(fp, "linksp %s %s %s\n", q->pp.signal, arrow_str, q->name); - return 0; + hal_list_s(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + save_nets_2_print(qrec.rec(i), dst); } -static int save_nets_01_cb(hal_query_t *q, void *arg) +static void save_nets_01_print(const hal_query_t *q, int arrow, FILE *fp) { - FILE *fp = (FILE *)arg; fprintf(fp, "newsig %s %s\n", q->name, data_type(q->sig.type)); + HalQRec qrec; hal_query_t qp = {}; - qp.callerdata.sival = q->callerdata.sival; // Propagate arrow type qp.name = q->name; - return hal_list_p_s(&qp, save_nets_01_pins_cb, arg); + hal_list_p_s(&qp, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) { + const char *arrow_str = arrow ? data_arrow2(qrec.rec(i)->pp.dir) : ""; + fprintf(fp, "linksp %s %s %s\n", qrec.rec(i)->pp.signal, arrow_str, qrec.rec(i)->name); + } } static void save_nets_01(FILE *dst, int arrow) { + HalQRec qrec(256); hal_query_t q = {}; - q.callerdata.sival = arrow; - hal_list_s(&q, save_nets_01_cb, (void *)dst); + hal_list_s(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) + save_nets_01_print(qrec.rec(i), arrow, dst); } static void save_nets(FILE *dst, int arrow) @@ -2340,56 +2328,48 @@ static void save_nets(FILE *dst, int arrow) } } -static int save_params_cb(hal_query_t *q, void *arg) -{ - FILE *fp = (FILE *)arg; - if(HAL_RO != q->pp.dir) { - // Writable parameter, save its value - fprintf(fp, "setp %s %s\n", q->name, querydata_refstr_20(q->pp.type, q->pp.ref).c_str()); - } - return 0; -} - static void save_params(FILE *dst) { + HalQRec qrec(512); hal_query_t q = {}; q.qtype = HAL_QTYPE_PARAM; + hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); fprintf(dst, "# parameter values\n"); - hal_list_p(&q, save_params_cb, (void *)dst); -} - -static int save_threads_cb(hal_query_t *q, void *arg) -{ - if(HAL_QTYPE_THREAD_FUNCT == q->qtype) { - const char *f = q->thread.is_init ? "initf" : "addf"; - fprintf((FILE *)arg, "%s %s %s\n", f, q->thread.funct, q->name); + for(size_t i = 0; i < qrec.size(); i++) { + if(HAL_RO != qrec.rec(i)->pp.dir) { + // Writable parameter, save its value + fprintf(dst, "setp %s %s\n", qrec.rec(i)->name, querydata_refstr_20(qrec.rec(i)->pp.type, qrec.rec(i)->pp.ref).c_str()); + } } - return 0; } static void save_threads(FILE *dst) { + HalQRec qrec; hal_query_t q = {}; q.qtype = HAL_QTYPE_THREAD_FUNCT; fprintf(dst, "# realtime thread/function links\n"); - hal_list_thread(&q, save_threads_cb, (void *)dst); -} - -static int save_unconnected_input_pin_values_cb(hal_query_t *q, void *arg) -{ - FILE *fp = (FILE *)arg; - if(!q->pp.signal && (HAL_IN == q->pp.dir || HAL_IO == q->pp.dir)) { - fprintf(fp, "setp %s %s\n", q->name, querydata_refstr_20(q->pp.type, q->pp.ref).c_str()); + hal_list_thread(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) { + if(HAL_QTYPE_THREAD_FUNCT == qrec.rec(i)->qtype) { + const char *f = qrec.rec(i)->thread.is_init ? "initf" : "addf"; + fprintf(dst, "%s %s %s\n", f, qrec.rec(i)->thread.funct, qrec.rec(i)->name); + } } - return 0; } static void save_unconnected_input_pin_values(FILE *dst) { + HalQRec qrec(1024); hal_query_t q = {}; q.qtype = HAL_QTYPE_PIN; fprintf(dst, "# unconnected pin values\n"); - hal_list_p(&q, save_unconnected_input_pin_values_cb, (void *)dst); + hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); + for(size_t i = 0; i < qrec.size(); i++) { + if(!qrec.rec(i)->pp.signal && (HAL_IN == qrec.rec(i)->pp.dir || HAL_IO == qrec.rec(i)->pp.dir)) { + fprintf(dst, "setp %s %s\n", qrec.rec(i)->name, querydata_refstr_20(qrec.rec(i)->pp.type, qrec.rec(i)->pp.ref).c_str()); + } + } } int do_setexact_cmd() @@ -2477,7 +2457,7 @@ int do_help_cmd(const char *command) } else if (strcmp(command, "newsig") == 0) { printf("newsig signame type\n"); printf(" Creates a new signal called 'signame'. Type\n"); - printf(" is 'bit', 'float', 'port', 'u32', or 's32'.\n"); + printf(" is 'bool', 'real', 'port', 'uint', or 'sint'.\n"); } else if (strcmp(command, "delsig") == 0) { printf("delsig signame\n"); printf(" Deletes signal 'signame'. If 'signame is 'all',\n"); diff --git a/src/hal/utils/halcmd_completion.c b/src/hal/utils/halcmd_completion.c index 577a958f767..69e854eedd8 100644 --- a/src/hal/utils/halcmd_completion.c +++ b/src/hal/utils/halcmd_completion.c @@ -87,7 +87,7 @@ static const char *status_table[] = { }; static const char *pintype_table[] = { - "bit", "float", "u32", "s32", + "bool", "real", "uint", "sint", NULL }; @@ -120,14 +120,14 @@ static char **completion_matches_table(const char *text, const char **table, hal static hal_type_t match_type = -1; static int match_writers = -1; -static hal_pin_dir_t match_direction = HAL_DIR_UNSPECIFIED; +static hal_pdir_t match_direction = HAL_DIR_UNSPECIFIED; -static int direction_match(hal_pin_dir_t dir1, hal_pin_dir_t dir2) { +static int direction_match(hal_pdir_t dir1, hal_pdir_t dir2) { if(dir1 == HAL_DIR_UNSPECIFIED || dir2 == -1) return 1; return (dir1 | dir2) == HAL_IO; } -static int writer_match(hal_pin_dir_t dir, int writers) { +static int writer_match(hal_pdir_t dir, int writers) { if(writers == -1 || dir == -1) return 1; if(dir & HAL_IN || writers == 0) return 1; return 0; diff --git a/src/hal/utils/halcompile.g b/src/hal/utils/halcompile.g index 2690dc61df7..8c486dcaad0 100644 --- a/src/hal/utils/halcompile.g +++ b/src/hal/utils/halcompile.g @@ -41,6 +41,7 @@ parser Hal: rule Declaration: "pin" PINDIRECTION TYPE HALNAME OptArray OptSAssign OptPersonality OptString ";" {{ pin(HALNAME, TYPE, OptArray, PINDIRECTION, OptString, OptSAssign, OptPersonality) }} | "param" PARAMDIRECTION TYPE HALNAME OptArray OptSAssign OptPersonality OptString ";" {{ param(HALNAME, TYPE, OptArray, PARAMDIRECTION, OptString, OptSAssign, OptPersonality) }} + | "alias" HALNAME OptArray {{ ppname = HALNAME; pparr = OptArray }} HALNAME OptArray ";" {{ alias(ppname, pparr, HALNAME, OptArray) }} | "function" NAME OptFP OptString ";" {{ function(NAME, OptFP, OptString) }} | "variable" NAME STARREDNAME OptSimpleArray OptAssign ";" {{ variable(NAME, STARREDNAME, OptSimpleArray, OptAssign) }} | "option" NAME OptValue ";" {{ option(NAME, OptValue) }} @@ -150,17 +151,25 @@ def parse(filename): return a, b dirmap = {'r': 'HAL_RO', 'rw': 'HAL_RW', 'in': 'HAL_IN', 'out': 'HAL_OUT', 'io': 'HAL_IO' } -typemap = {'signed': 's32', 'unsigned': 'u32'} -deprmap = {'s32': 'signed', 'u32': 'unsigned'} -deprecated = ['s32', 'u32'] -newtypes = ['bool', 'sint', 'uint', 'si32', 'ui32', 'real'] +# Using any in the typemap will result in a warning +typemap = { + "bit": "bool", + "float": "real", + "s32": "si32", + "signed": "si32", + "u32": "ui32", + "unsigned": "ui32", + "s64": "sint", + "u64": "uint" } def initialize(): global functions, params, pins, comp_name, names, docs, variables global modparams, includes + global aliases functions = []; params = []; pins = []; options = {}; variables = [] modparams = []; docs = []; includes = []; + aliases = {} comp_name = None names = {} @@ -169,11 +178,15 @@ def Warn(msg, *args): if args: msg = msg % args print("%s:%d: Warning: %s" % (S.filename, S.line, msg), file=sys.stderr) + if warn_is_error: + sys.exit(1) def Error(msg, *args): if args: msg = msg % args - raise runtime.SyntaxError(S.get_pos(), msg, None) + print("%s:%d: Error: %s" % (S.filename, S.line, msg), file=sys.stderr) + sys.exit(1) + #raise runtime.SyntaxError(S.get_pos(), msg, None) def optfp_warn(state): s = "nofp" if 0 == state else "fp" @@ -208,8 +221,10 @@ def notes(doc): docs.append(('notes', doc)); def type2type(type_): - # When we start warning about s32/u32 this is where the warning goes - return typemap.get(type_, type_) + if type_ in typemap: + Warn(f"Old type '{type_}' has been replaced by '{typemap[type_]}'") + return typemap[type_] + return type_ def checkarray(name, array): hashes = len(re.findall("#+", name)) @@ -230,21 +245,39 @@ def pin(name, type_, array, dir_, doc, value, personality): type_ = type2type(type_) check_name_ok(name) docs.append(('pin', name, type_, array, dir_, doc, value, personality)) - names[name] = None + names[name] = 'pin' pins.append((name, type_, array, dir_, value, personality)) def param(name, type_, array, dir_, doc, value, personality): + if 'port' == type_: + Error("Parameters cannot be of type 'port'") checkarray(name, array) type_ = type2type(type_) check_name_ok(name) docs.append(('param', name, type_, array, dir_, doc, value, personality)) - names[name] = None + names[name] = 'param' params.append((name, type_, array, dir_, value, personality)) +def alias(name, namearr, aliasname, aliasarr): + if namearr != aliasarr: + Error(f"Alias arrays for pin '{namearr}' != '{aliasarr}'") + checkarray(name, namearr) + checkarray(aliasname, aliasarr) + if aliasname in names: + Error(f"Alias name '{aliasname}' already in use") + if name not in names: + Error(f"Pin/param name '{name}' not found, cannot alias") + if name in aliases: + Error(f"Alias for pin/param '{name}' already exists as '{aliases[name][2]}'") + if names[name] not in ('pin', 'param'): + Error(f"Expected '{name}' to be pin or param, but got '{names[name]}'"); + aliases[name] = (name, namearr, aliasname, aliasarr, names[name]) + names[aliasname] = 'alias' # Must register to prevent collision + def function(name, fp, doc): check_name_ok(name) docs.append(('funct', name, fp, doc)) - names[name] = None + names[name] = 'function' functions.append((name, fp)) def option(name, value): @@ -254,12 +287,12 @@ def option(name, value): def variable(type_, name, array, default): check_name_ok(name) - names[name] = None + names[name] = 'variable' variables.append((type_, name, array, default)) def modparam(type_, name, default, doc): check_name_ok(name) - names[name] = None + names[name] = 'modparam' modparams.append((type_, name, default, doc)) def include(value): @@ -350,20 +383,19 @@ static int comp_id; print(" int _personality;", file=f) for name, type_, array, dir_, value, personality in pins: - star = '' if type_ in newtypes else '*' if array: if isinstance(array, tuple): array = array[0] - print(" hal_%s_t %s%s_p[%s];" % (to_t(type_), star, to_c(name), array), file=f) + print(" hal_%s_t %s_p[%s]; // pin %s" % (to_t(type_), to_c(name), array, dir_), file=f) else: - print(" hal_%s_t %s%s_p;" % (to_t(type_), star, to_c(name)), file=f) + print(" hal_%s_t %s_p; // pin %s" % (to_t(type_), to_c(name), dir_), file=f) names[name] = 1 for name, type_, array, dir_, value, personality in params: if array: if isinstance(array, tuple): array = array[0] - print(" hal_%s_t %s_p[%s];" % (to_t(type_), to_c(name), array), file=f) + print(" hal_%s_t %s_p[%s]; // param %s" % (to_t(type_), to_c(name), array, dir_), file=f) else: - print(" hal_%s_t %s_p;" % (to_t(type_), to_c(name)), file=f) + print(" hal_%s_t %s_p; // param %s" % (to_t(type_), to_c(name), dir_), file=f) names[name] = 1 for type_, name, array, value in variables: @@ -439,7 +471,6 @@ static int comp_id; if has_personality: print(" personality = inst->_personality;", file=f) for name, type_, array, dir_, value, personality in pins: - isnewtype = type_ in newtypes if personality: print("if(%s) {" % personality, file=f) if array: @@ -453,35 +484,31 @@ static int comp_id; print(" }", file=f) else: cnt = array print(" for(j=0; j < (%s); j++) {" % cnt, file=f) - if isnewtype: + if 'port' == type_: + print(" r = hal_pin_new_%s(comp_id, %s, &(inst->%s_p[j])," % ( + type_, dirmap[dir_], to_c(name)), file=f) + else: dflt = "%s" % value if value is not None else "0" print(" r = hal_pin_new_%s(comp_id, %s, &(inst->%s_p[j]), %s," % ( type_, dirmap[dir_], to_c(name), dflt), file=f) - else: - print(" r = hal_pin_%s_newf(%s, &(inst->%s_p[j]), comp_id," % ( - type_, dirmap[dir_], to_c(name)), file=f) print(" \"%%s%s\", prefix, j);" % to_hal("." + name), file=f) print(" if(r != 0) return r;", file=f) - if not isnewtype and value is not None: - print(" *(inst->%s_p[j]) = %s;" % (to_c(name), value), file=f) print(" }", file=f) else: - if isnewtype: + if 'port' == type_: + dflt = "%s" % value if value is not None else "0" + print(" r = hal_pin_new_%s(comp_id, %s, &(inst->%s_p)," % ( + type_, dirmap[dir_], to_c(name)), file=f) + else: dflt = "%s" % value if value is not None else "0" print(" r = hal_pin_new_%s(comp_id, %s, &(inst->%s_p), %s," % ( type_, dirmap[dir_], to_c(name), dflt), file=f) - else: - print(" r = hal_pin_%s_newf(%s, &(inst->%s_p), comp_id," % ( - type_, dirmap[dir_], to_c(name)), file=f) print(" \"%%s%s\", prefix);" % to_hal("." + name), file=f) print(" if(r != 0) return r;", file=f) - if not isnewtype and value is not None: - print(" *(inst->%s_p) = %s;" % (to_c(name), value), file=f) if personality: print("}", file=f) for name, type_, array, dir_, value, personality in params: - isnewtype = type_ in newtypes if personality: print("if(%s) {" % personality, file=f) if array: @@ -495,33 +522,50 @@ static int comp_id; print(" }", file=f) else: cnt = array print(" for(j=0; j < (%s); j++) {" % cnt, file=f) - if isnewtype: - dflt = "%s" % value if value is not None else "0" - print(" r = hal_param_new_%s(comp_id, %s, &(inst->%s_p[j]), %s," % ( - type_, dirmap[dir_], to_c(name), dflt), file=f) - else: - print(" r = hal_param_%s_newf(%s, &(inst->%s_p[j]), comp_id," % ( - type_, dirmap[dir_], to_c(name)), file=f) + dflt = "%s" % value if value is not None else "0" + print(" r = hal_param_new_%s(comp_id, %s, &(inst->%s_p[j]), %s," % ( + type_, dirmap[dir_], to_c(name), dflt), file=f) print(" \"%%s%s\", prefix, j);" % to_hal("." + name), file=f) print(" if(r != 0) return r;", file=f) - if not isnewtype and value is not None: - print(" inst->%s_p[j] = %s;" % (to_c(name), value), file=f) print(" }", file=f) else: - if isnewtype: - dflt = "%s" % value if value is not None else "0" - print(" r = hal_param_new_%s(comp_id, %s, &(inst->%s_p), %s," % ( - type_, dirmap[dir_], to_c(name), dflt), file=f) - else: - print(" r = hal_param_%s_newf(%s, &(inst->%s_p), comp_id," % ( - type_, dirmap[dir_], to_c(name)), file=f) + dflt = "%s" % value if value is not None else "0" + print(" r = hal_param_new_%s(comp_id, %s, &(inst->%s_p), %s," % ( + type_, dirmap[dir_], to_c(name), dflt), file=f) print(" \"%%s%s\", prefix);" % to_hal("." + name), file=f) - if not isnewtype and value is not None: - print(" inst->%s_p = %s;" % (to_c(name), value), file=f) print(" if(r != 0) return r;", file=f) if personality: print("}", file=f) + if len(aliases) > 0: + print(" {", file=f) + print(" char pinname[HAL_NAME_LEN+1], alsname[HAL_NAME_LEN+1];", file=f) + for k, v in aliases.items(): + name, namearr, aliasname, aliasarr, nametype = v + if isinstance(array, tuple): + lim, cnt = array + print(" if((%s) > (%s)) {" % (cnt, lim), file=f) + print(' rtapi_print_msg(RTAPI_MSG_ERR,' \ + '"Alias %s: Requested size %%d exceeds max size %%d\\n",' + '(int)(%s), (int)(%s));' % (name, cnt, lim), file=f) + print(" return -ENOSPC;", file=f) + print(" }", file=f) + else: + cnt = array + if namearr: + print( " for(j = 0; j < (%s); j++) {" % cnt, file=f) + print(f" rtapi_snprintf(pinname, sizeof(pinname), \"%s.{to_hal(name)}\", prefix, j);", file=f) + print(f" rtapi_snprintf(alsname, sizeof(alsname), \"%s.{to_hal(aliasname)}\", prefix, j);", file=f) + print(f" r = {nametype}(pinname, alsname);", file=f) + print( " if(r != 0) return r;", file=f) + print( " }" % cnt, file=f) + else: + print(f" rtapi_snprintf(pinname, sizeof(pinname), \"%s.{to_hal(name)}\", prefix);", file=f) + print(f" rtapi_snprintf(alsname, sizeof(alsname), \"%s.{to_hal(aliasname)}\", prefix);", file=f) + print(f" r = hal_{nametype}_alias(pinname, alsname);", file=f) + print( " if(r != 0) return r;", file=f) + print(" }", file=f) + for type_, name, array, value in variables: if value is None: continue if array: @@ -534,8 +578,8 @@ static int comp_id; for name, fp in functions: print(" rtapi_snprintf(buf, sizeof(buf), \"%%s%s\", prefix);"\ % to_hal("." + name), file=f) - print(" r = hal_export_funct(buf, (void(*)(void *inst, long))%s, inst, %s, 0, comp_id);" % ( - to_c(name), int(fp)), file=f) + print(" r = hal_export_funct(buf, (void(*)(void *inst, long))%s, inst, 0, comp_id);" % ( + to_c(name)), file=f) print(" if(r != 0) return r;", file=f) print(" if(__comp_last_inst) __comp_last_inst->_next = inst;", file=f) print(" __comp_last_inst = inst;", file=f) @@ -866,46 +910,32 @@ int __comp_parse_names(int *argc, char **argv) { print("#undef fperiod", file=f) print("#define fperiod (period * 1e-9)", file=f) for name, type_, array, dir_, value, personality in pins: - if type_ in newtypes: - if array: - print("#define %s_ptr(i) (__comp_inst->%s_p[(i)])" % (to_c(name), to_c(name)), file=f) - if dir_ != 'in': # Only I/O and output pins can be 'set' - print("#define %s_set(i,v) (hal_set_%s(__comp_inst->%s_p[(i)],(v)))" % (to_c(name), type_, to_c(name)), file=f) - print("#define %s(i) (hal_get_%s(__comp_inst->%s_p[(i)]))" % (to_c(name), type_, to_c(name)), file=f) - else: - print("#define %s_ptr (__comp_inst->%s_p)" % (to_c(name), to_c(name)), file=f) - if dir_ != 'in': # Only I/O and output pins can be 'set' - print("#define %s_set(v) (hal_set_%s(__comp_inst->%s_p,(v)))" % (to_c(name), type_, to_c(name)), file=f) - print("#define %s (hal_get_%s(__comp_inst->%s_p))" % (to_c(name), type_, to_c(name)), file=f) + print("#undef %s" % to_c(name), file=f) + print("#undef %s_ptr" % to_c(name), file=f) + if dir_ != 'in': + print("#undef %s_set" % to_c(name), file=f) + if array: + print("#define %s(i) (hal_get_%s(__comp_inst->%s_p[(i)]))" % (to_c(name), type_, to_c(name)), file=f) + print("#define %s_ptr(i) (__comp_inst->%s_p[(i)])" % (to_c(name), to_c(name)), file=f) + if dir_ != 'in': # Only I/O and output pins can be 'set' + print("#define %s_set(i,v) (hal_set_%s(__comp_inst->%s_p[(i)],(v)))" % (to_c(name), type_, to_c(name)), file=f) else: - print("#undef %s" % to_c(name), file=f) - print("#undef %s_ptr" % to_c(name), file=f) - if array: - print("#define %s_ptr(i) (__comp_inst->%s_p[(i)])" % (to_c(name), to_c(name)), file=f) - if dir_ == 'in': - print("#define %s(i) (0+*(__comp_inst->%s_p[(i)]))" % (to_c(name), to_c(name)), file=f) - else: - print("#define %s(i) (*(__comp_inst->%s_p[(i)]))" % (to_c(name), to_c(name)), file=f) - else: - print("#define %s_ptr (__comp_inst->%s_p)" % (to_c(name), to_c(name)), file=f) - if dir_ == 'in': - print("#define %s (0+*__comp_inst->%s_p)" % (to_c(name), to_c(name)), file=f) - else: - print("#define %s (*__comp_inst->%s_p)" % (to_c(name), to_c(name)), file=f) - for name, type_, array, dir_, value, personality in params: - if type_ in newtypes: - if array: - print("#define %s(i) (hal_get_%s(__comp_inst->%s_p[i]))" % (to_c(name), type_, to_c(name)), file=f) - print("#define %s_set(i,v) (hal_set_%s(__comp_inst->%s_p[i],(v)))" % (to_c(name), type_, to_c(name)), file=f) - else: - print("#define %s (hal_get_%s(__comp_inst->%s_p))" % (to_c(name), type_, to_c(name)), file=f) + print("#define %s (hal_get_%s(__comp_inst->%s_p))" % (to_c(name), type_, to_c(name)), file=f) + print("#define %s_ptr (__comp_inst->%s_p)" % (to_c(name), to_c(name)), file=f) + if dir_ != 'in': # Only I/O and output pins can be 'set' print("#define %s_set(v) (hal_set_%s(__comp_inst->%s_p,(v)))" % (to_c(name), type_, to_c(name)), file=f) + for name, type_, array, dir_, value, personality in params: + print("#undef %s" % to_c(name), file=f) + print("#undef %s_ptr" % to_c(name), file=f) + print("#undef %s_set" % to_c(name), file=f) + if array: + print("#define %s(i) (hal_get_%s(__comp_inst->%s_p[i]))" % (to_c(name), type_, to_c(name)), file=f) + print("#define %s_ptr(i) (__comp_inst->%s_p[(i)])" % (to_c(name), to_c(name)), file=f) + print("#define %s_set(i,v) (hal_set_%s(__comp_inst->%s_p[i],(v)))" % (to_c(name), type_, to_c(name)), file=f) else: - print("#undef %s" % to_c(name), file=f) - if array: - print("#define %s(i) (__comp_inst->%s_p[i])" % (to_c(name), to_c(name)), file=f) - else: - print("#define %s (__comp_inst->%s_p)" % (to_c(name), to_c(name)), file=f) + print("#define %s (hal_get_%s(__comp_inst->%s_p))" % (to_c(name), type_, to_c(name)), file=f) + print("#define %s_ptr (__comp_inst->%s_p)" % (to_c(name), to_c(name)), file=f) + print("#define %s_set(v) (hal_set_%s(__comp_inst->%s_p,(v)))" % (to_c(name), type_, to_c(name)), file=f) for type_, name, array, value in variables: name = name.replace("*", "") @@ -1333,6 +1363,8 @@ def main(): require_license = True global require_unix_line_endings require_unix_line_endings = False + global warn_is_error + warn_is_error = False mode = PREPROCESS adoc = False keepadoc = None @@ -1341,12 +1373,12 @@ def main(): global options options = {} try: - opts, args = getopt.getopt(sys.argv[1:], "UluijJcpdak:o:h?P:", + opts, args = getopt.getopt(sys.argv[1:], "UluijJcpdak:o:h?P:w", ['unix', 'install', 'compile', 'preprocess', 'outfile=', 'document', 'adoc', 'keep-adoc=', 'help', 'userspace', 'install-doc', 'view-doc', 'require-license', 'print-modinc', 'personalities=', "extra-compile-args=", - 'extra-link-args=']) + 'extra-link-args=', 'werror']) except getopt.GetoptError: usage(1) for k, v in opts: @@ -1393,6 +1425,8 @@ def main(): option("extra_link_args", v) if k in ("-?", "-h", "--help"): usage(0) + if k in ("-w", "--werror"): + warn_is_error = True if outfile and mode != PREPROCESS and mode != DOCUMENT: raise SystemExit("Can only specify -o when preprocessing or documenting") diff --git a/src/hal/utils/halrmt.cc b/src/hal/utils/halrmt.cc index 821d4db2329..6c466378418 100644 --- a/src/hal/utils/halrmt.cc +++ b/src/hal/utils/halrmt.cc @@ -56,6 +56,7 @@ #include #include "hal/setps_util.h" +#include "hal/halqrec.hh" using namespace linuxcnc; @@ -366,8 +367,6 @@ static const char *data_type(hal_type_t type) switch (type) { case HAL_BOOL: return "bool "; case HAL_REAL: return "real "; - case HAL_S32: return "s32 "; - case HAL_U32: return "u32 "; case HAL_SINT: return "sint "; case HAL_UINT: return "uint "; case HAL_PORT: return "port "; @@ -423,10 +422,8 @@ static std::string data_value(hal_type_t type, hal_query_value_u val) switch (type) { case HAL_BOOL: return val.b ? " TRUE" : " FALSE"; case HAL_REAL: return fmt::format("{:12.7g}", val.r); - case HAL_PORT: // FIXME - case HAL_S32: + case HAL_PORT: return fmt::format(" {:10d}", val.u); case HAL_SINT: return fmt::format(" {:10d}", val.s); - case HAL_U32: case HAL_UINT: return fmt::format(" {:08X}", val.u); default: return " undef "; } @@ -437,10 +434,8 @@ static std::string data_value2(hal_type_t type, hal_query_value_u val) switch (type) { case HAL_BOOL: return val.b ? "TRUE" : "FALSE"; case HAL_REAL: return fmt::format("{:.7g}", val.r); - case HAL_PORT: // FIXME - case HAL_S32: + case HAL_PORT: return fmt::format("{}", val.u); case HAL_SINT: return fmt::format("{}", val.s); - case HAL_U32: case HAL_UINT: return fmt::format("{}", val.u); default: return "unknown_type"; } @@ -695,15 +690,6 @@ static int halrmt_systemv(connectionRecType &ctx, const std::vector *comps = reinterpret_cast *>(arg); - if(HAL_COMP_TYPE_REALTIME == q->comp.type) { - comps->push_back(q->name); - } - return 0; -} - static int unloadrt_comp(connectionRecType &ctx, const std::string &mod_name) { std::vector argv; @@ -757,17 +743,16 @@ static std::string guess_comp_name(const std::string &prog_name) return name; } -static int get_all_comp_names_cb(hal_query_t *q, void *arg) -{ - std::set *comps = reinterpret_cast *>(arg); - comps->insert(q->name); - return 0; -} - static std::set get_all_comp_names() { std::set result; - hal_query_t q = {}; - hal_list_comp(&q, get_all_comp_names_cb, &result); + HalQRec qrec; + hal_query_t q= {}; + if(0 != hal_list_comp(&q, HalQRec::get_qrec_cb, &qrec)) + return result; + + for(size_t i = 0; i < qrec.size(); i++) { + result.insert(qrec.rec(i)->name); + } return result; } @@ -1100,144 +1085,142 @@ static int doLoadRt(connectionRecType &ctx, const std::vector &args #endif } -static int getCompInfo_cb(hal_query_t *q, void *arg) -{ - connectionRecType *ctx = reinterpret_cast(arg); - const std::string *pattern = reinterpret_cast(q->callerdata.cpval); - if(pattern->empty() || !fnmatch(pattern->c_str(), q->name, FNM_NOESCAPE|FNM_CASEFOLD)) { - replynl(*ctx, fmt::format("COMP {:12s} {:3d} {}", - q->name, q->comp.comp_id, q->comp.type == HAL_COMP_TYPE_REALTIME ? "RT " : "User")); - } - return 0; -} - static int getCompInfo(connectionRecType &ctx, const std::string &pattern) { + HalQRec qrec; hal_query_t q = {}; - q.callerdata.cpval = &pattern; + int rv = hal_list_comp(&q, HalQRec::get_qrec_cb, &qrec); + if(0 != rv) + return rv; + if(ctx.header) { replynl(ctx, fmt::format("COMP Name Id Type")); } - return hal_list_comp(&q, getCompInfo_cb, &ctx); -} - -typedef struct { - connectionRecType *ctx; - const std::string *pattern; - int count; - bool valuesOnly; -} getXinfo_t; - -static int getPinInfo_cb(hal_query_t *q, void *arg) -{ - getXinfo_t *gpi = reinterpret_cast(arg); - if(gpi->pattern->empty() || !fnmatch(gpi->pattern->c_str(), q->name, FNM_NOESCAPE|FNM_CASEFOLD)) { - gpi->count++; - if(gpi->valuesOnly) { - replynl(*gpi->ctx, fmt::format("PINVAL {:30s} {}", - q->name, data_value2(q->pp.type, q->pp.value))); - } else { - replynl(*gpi->ctx, fmt::format("PIN {:30s} {:11s} {:12s}({:3d}) {} {}", - q->name, data_value2(q->pp.type, q->pp.value), - q->pp.comp, q->pp.comp_id, data_type(q->pp.type), pin_data_dir(q->pp.dir))); + for(size_t i = 0; i < qrec.size(); i++) { + if(pattern.empty() || !fnmatch(pattern.c_str(), qrec.rec(i)->name, FNM_NOESCAPE|FNM_CASEFOLD)) { + replynl(ctx, fmt::format("COMP {:12s} {:3d} {}", + qrec.rec(i)->name, qrec.rec(i)->comp.comp_id, + qrec.rec(i)->comp.type == HAL_COMP_TYPE_REALTIME ? "RT " : "User")); } } + return 0; } static std::pair getPinInfo(connectionRecType &ctx, const std::string &pattern, bool valuesOnly) { - getXinfo_t gpi = { &ctx, &pattern, 0, valuesOnly }; + HalQRec qrec(1024); hal_query_t q = {}; q.qtype = HAL_QTYPE_PIN; + int rv = hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); + if(0 != rv) + return {rv, 0}; + if(ctx.header) { if(valuesOnly) replynl(ctx, fmt::format("PINVAL Name Value")); else replynl(ctx, fmt::format("PIN Name Value Component ( id) Type Dir")); } - return {hal_list_p(&q, getPinInfo_cb, &gpi), gpi.count}; -} - -static int getSigInfo_cb(hal_query_t *q, void *arg) -{ - getXinfo_t *gpi = reinterpret_cast(arg); - if(gpi->pattern->empty() || !fnmatch(gpi->pattern->c_str(), q->name, FNM_NOESCAPE|FNM_CASEFOLD)) { - gpi->count++; - if(gpi->valuesOnly) { - replynl(*gpi->ctx, fmt::format("SIGNALVAL {:30s} {}", - q->name, data_value2(q->sig.type, q->sig.value))); - } else { - replynl(*gpi->ctx, fmt::format("SIGNAL {:30s} {:11s} {}", - q->name, data_value2(q->sig.type, q->sig.value), data_type(q->sig.type))); + int count = 0; + for(size_t i = 0; i < qrec.size(); i++) { + if(pattern.empty() || !fnmatch(pattern.c_str(), qrec.rec(i)->name, FNM_NOESCAPE|FNM_CASEFOLD)) { + count++; + if(valuesOnly) { + replynl(ctx, fmt::format("PINVAL {:30s} {}", + qrec.rec(i)->name, data_value2(qrec.rec(i)->pp.type, qrec.rec(i)->pp.value))); + } else { + replynl(ctx, fmt::format("PIN {:30s} {:11s} {:12s}({:3d}) {} {}", + qrec.rec(i)->name, data_value2(qrec.rec(i)->pp.type, qrec.rec(i)->pp.value), + qrec.rec(i)->pp.comp, qrec.rec(i)->pp.comp_id, + data_type(qrec.rec(i)->pp.type), pin_data_dir(qrec.rec(i)->pp.dir))); + } } } - return 0; + return {0, count}; } static std::pair getSigInfo(connectionRecType &ctx, const std::string &pattern, bool valuesOnly) { - getXinfo_t gpi = { &ctx, &pattern, 0, valuesOnly }; + HalQRec qrec(256); hal_query_t q = {}; + int rv = hal_list_s(&q, HalQRec::get_qrec_cb, &qrec); + if(0 != rv) + return {rv, 0}; if(ctx.header) { if(valuesOnly) replynl(ctx, fmt::format("SIGNALVAL Name Value")); else replynl(ctx, fmt::format("SIGNAL Name Value Type")); } - return {hal_list_s(&q, getSigInfo_cb, &gpi), gpi.count}; -} - -static int getParamInfo_cb(hal_query_t *q, void *arg) -{ - getXinfo_t *gpi = reinterpret_cast(arg); - if(gpi->pattern->empty() || !fnmatch(gpi->pattern->c_str(), q->name, FNM_NOESCAPE|FNM_CASEFOLD)) { - gpi->count++; - if(gpi->valuesOnly) { - replynl(*gpi->ctx, fmt::format("PARAMVAL {:30s} {}", - q->name, data_value2(q->pp.type, q->pp.value))); - } else { - replynl(*gpi->ctx, fmt::format("PARAM {:30s} {:11s} {:12s}({:3d}) {} {}", - q->name, data_value2(q->pp.type, q->pp.value), - q->pp.comp, q->pp.comp_id, data_type(q->pp.type), param_data_dir(q->pp.dir))); + int count = 0; + for(size_t i = 0; i < qrec.size(); i++) { + if(pattern.empty() || !fnmatch(pattern.c_str(), qrec.rec(i)->name, FNM_NOESCAPE|FNM_CASEFOLD)) { + count++; + if(valuesOnly) { + replynl(ctx, fmt::format("SIGNALVAL {:30s} {}", + qrec.rec(i)->name, data_value2(qrec.rec(i)->sig.type, qrec.rec(i)->sig.value))); + } else { + replynl(ctx, fmt::format("SIGNAL {:30s} {:11s} {}", + qrec.rec(i)->name, data_value2(qrec.rec(i)->sig.type, qrec.rec(i)->sig.value), + data_type(qrec.rec(i)->sig.type))); + } } } - return 0; + return {0, count}; } static std::pair getParamInfo(connectionRecType &ctx, const std::string &pattern, bool valuesOnly) { - getXinfo_t gpi = { &ctx, &pattern, 0, valuesOnly }; + HalQRec qrec(512); hal_query_t q = {}; q.qtype = HAL_QTYPE_PARAM; + int rv = hal_list_p(&q, HalQRec::get_qrec_cb, &qrec); + if(0 != rv) + return {rv, 0}; if(ctx.header) { if(valuesOnly) replynl(ctx, fmt::format("PARAMVAL Name Value")); else replynl(ctx, fmt::format("PARAM Name Value Component ( id) Type Dir")); } - return {hal_list_p(&q, getParamInfo_cb, &gpi), gpi.count}; -} - -static int getFunctInfo_cb(hal_query_t *q, void *arg) -{ - connectionRecType *ctx = reinterpret_cast(arg); - const std::string *pattern = reinterpret_cast(q->callerdata.cpval); - if(pattern->empty() || !fnmatch(pattern->c_str(), q->name, FNM_NOESCAPE|FNM_CASEFOLD)) { - replynl(*ctx, fmt::format("FUNCT {:16s} {:12s}({:3d}) {:3d}", - q->name, q->funct.comp, q->funct.comp_id, q->funct.users)); + int count = 0; + for(size_t i = 0; i < qrec.size(); i++) { + if(pattern.empty() || !fnmatch(pattern.c_str(), qrec.rec(i)->name, FNM_NOESCAPE|FNM_CASEFOLD)) { + count++; + if(valuesOnly) { + replynl(ctx, fmt::format("PARAMVAL {:30s} {}", + qrec.rec(i)->name, data_value2(qrec.rec(i)->pp.type, qrec.rec(i)->pp.value))); + } else { + replynl(ctx, fmt::format("PARAM {:30s} {:11s} {:12s}({:3d}) {} {}", + qrec.rec(i)->name, data_value2(qrec.rec(i)->pp.type, qrec.rec(i)->pp.value), + qrec.rec(i)->pp.comp, qrec.rec(i)->pp.comp_id, data_type(qrec.rec(i)->pp.type), + param_data_dir(qrec.rec(i)->pp.dir))); + } + } } - return 0; + return {0, count}; } static int getFunctInfo(connectionRecType &ctx, const std::string &pattern) { + HalQRec qrec; hal_query_t q = {}; - q.callerdata.cpval = reinterpret_cast(&pattern); + int rv = hal_list_funct(&q, HalQRec::get_qrec_cb, &qrec); + if(0 != rv) + return rv; + if(ctx.header) { replynl(ctx, "FUNCT Name Component ( id) Users"); } - return hal_list_funct(&q, getFunctInfo_cb, &ctx); + for(size_t i = 0; i < qrec.size(); i++) { + if(pattern.empty() || !fnmatch(pattern.c_str(), qrec.rec(i)->name, FNM_NOESCAPE|FNM_CASEFOLD)) { + replynl(ctx, fmt::format("FUNCT {:16s} {:12s}({:3d}) {:3d}", + qrec.rec(i)->name, qrec.rec(i)->funct.comp, + qrec.rec(i)->funct.comp_id, qrec.rec(i)->funct.users)); + } + } + return 0; } static rtapi_sint getpin_sint(connectionRecType &ctx, const std::string &name) @@ -1251,48 +1234,30 @@ static rtapi_sint getpin_sint(connectionRecType &ctx, const std::string &name) } return q.pp.value.s; } -static int getThreadInfo_cb(hal_query_t *q, void *arg) -{ - connectionRecType *ctx = reinterpret_cast(arg); - const std::string *pattern = reinterpret_cast(q->callerdata.cpval); - if(HAL_QTYPE_THREAD == q->qtype) { - // The thread reference - if(pattern->empty() || !fnmatch(pattern->c_str(), q->name, FNM_NOESCAPE|FNM_CASEFOLD)) { - rtapi_sint tp = getpin_sint(*ctx, fmt::format("{}.time", q->name)); - rtapi_sint tm = getpin_sint(*ctx, fmt::format("{}.tmax", q->name)); - replynl(*ctx, fmt::format("THREAD {:12s} {:11d} {} {}", q->name, q->thread.period, tp, tm)); - } - } else { - // The thread's function reference - replynl(*ctx, fmt::format("THREADFUNCT {:16s} {:2d}", q->thread.funct, q->thread.functidx + 1)); - } - return 0; -} static int getThreadInfo(connectionRecType &ctx, const std::string &pattern) { + HalQRec qrec; hal_query_t q = {}; q.qtype = HAL_QTYPE_THREAD_FUNCT; - q.callerdata.cpval = reinterpret_cast(&pattern); + int rv = hal_list_thread(&q, HalQRec::get_qrec_cb, &qrec); + if(0 != rv) + return rv; + if(ctx.header) { replynl(ctx, "THREAD Name Period time tmax"); } - return hal_list_thread(&q, getThreadInfo_cb, &ctx); -} - -static int save_comps_cb(hal_query_t *q, void *arg) -{ - std::string *str = reinterpret_cast(arg); - if(strstr(q->name, HAL_PSEUDO_COMP_PREFIX) == q->name) { - // Those starting with '__' are fake components - return 0; - } - if(HAL_COMP_TYPE_REALTIME == q->comp.type) { - // Realtime components only - if(!q->comp.insmod) { - *str += fmt::format("# loadrt {} (not loaded by loadrt, no args saved)\n", q->name); + for(size_t i = 0; i < qrec.size(); i++) { + if(HAL_QTYPE_THREAD == qrec.rec(i)->qtype) { + // The thread reference + if(pattern.empty() || !fnmatch(pattern.c_str(), qrec.rec(i)->name, FNM_NOESCAPE|FNM_CASEFOLD)) { + rtapi_sint tp = getpin_sint(ctx, fmt::format("{}.time", qrec.rec(i)->name)); + rtapi_sint tm = getpin_sint(ctx, fmt::format("{}.tmax", qrec.rec(i)->name)); + replynl(ctx, fmt::format("THREAD {:12s} {:11d} {} {}", qrec.rec(i)->name, qrec.rec(i)->thread.period, tp, tm)); + } } else { - *str += fmt::format("loadrt {} {}\n", q->name, q->comp.insmod); + // The thread's function reference + replynl(ctx, fmt::format("THREADFUNCT {:16s} {:2d}", qrec.rec(i)->thread.funct, qrec.rec(i)->thread.functidx + 1)); } } return 0; @@ -1301,98 +1266,104 @@ static int save_comps_cb(hal_query_t *q, void *arg) static void save_comps(std::string &dst) { dst += "# components\n"; + HalQRec qrec; hal_query_t q = {}; - hal_list_comp(&q, save_comps_cb, &dst); -} - -static int save_signals_cb(hal_query_t *q, void *arg) -{ - std::string *str = reinterpret_cast(arg); - *str += fmt::format("newsig {} {}\n", q->name, data_type(q->sig.type)); - return 0; + if(0 != hal_list_comp(&q, HalQRec::get_qrec_cb, &qrec)) + return; + for(size_t i = 0; i < qrec.size(); i++) { + if(strstr(qrec.rec(i)->name, HAL_PSEUDO_COMP_PREFIX) == qrec.rec(i)->name) { + // Those starting with '__' are fake components + continue; + } + if(HAL_COMP_TYPE_REALTIME == qrec.rec(i)->comp.type) { + // Realtime components only + if(!qrec.rec(i)->comp.insmod) { + dst += fmt::format("# loadrt {} (not loaded by loadrt, no args saved)\n", qrec.rec(i)->name); + } else { + dst += fmt::format("loadrt {} {}\n", qrec.rec(i)->name, qrec.rec(i)->comp.insmod); + } + } + } } static void save_signals(std::string &dst) { dst += "# signals\n"; + HalQRec qrec(256); hal_query_t q = {}; - hal_list_s(&q, save_signals_cb, &dst); -} - -static int save_links_cb(hal_query_t *q, void *arg) -{ - if(q->pp.signal) { - std::string *str = reinterpret_cast(arg); - const char *arrow_str = q->callerdata.sival ? data_arrow1(q->pp.dir) : ""; - *str += fmt::format("linkps {} {} {}\n", q->name, arrow_str, q->pp.signal); + if(0 != hal_list_s(&q, HalQRec::get_qrec_cb, &qrec)) + return; + for(size_t i = 0; i < qrec.size(); i++) { + dst += fmt::format("newsig {} {}\n", qrec.rec(i)->name, data_type(qrec.rec(i)->sig.type)); } - return 0; } static void save_links(std::string &dst, int arrow) { dst += "# links\n"; + HalQRec qrec(1024); hal_query_t q = {}; q.qtype = HAL_QTYPE_PIN; - q.callerdata.sival = arrow; - hal_list_p(&q, save_links_cb, &dst); + if(0 != hal_list_s(&q, HalQRec::get_qrec_cb, &qrec)) + return; + for(size_t i = 0; i < qrec.size(); i++) { + if(qrec.rec(i)->pp.signal) { + const char *arrow_str = arrow ? data_arrow1(qrec.rec(i)->pp.dir) : ""; + dst += fmt::format("linkps {} {} {}\n", qrec.rec(i)->name, arrow_str, qrec.rec(i)->pp.signal); + } + } } -static int save_nets_pins_cb(hal_query_t *q, void *arg) +static void save_nets_linksp(std::string dst, const char *sig, int arrow) { - std::string *str = reinterpret_cast(arg); - const char *arrow_str = q->callerdata.sival ? data_arrow2(q->pp.dir) : ""; - *str += fmt::format("linksp {} {} {}\n", q->pp.signal, arrow_str, q->name); - return 0; + HalQRec qrec; + hal_query_t q = {}; + q.name = sig; + if(0 != hal_list_p_s(&q, HalQRec::get_qrec_cb, &qrec)) + return; + for(size_t i = 0; i < qrec.size(); i++) { + const char *arrow_str = arrow ? data_arrow2(qrec.rec(i)->pp.dir) : ""; + dst += fmt::format("linksp {} {} {}\n", qrec.rec(i)->pp.signal, arrow_str, qrec.rec(i)->name); + } } -static int save_nets_cb(hal_query_t *q, void *arg) -{ - std::string *str = reinterpret_cast(arg); - *str += fmt::format("newsig {} {}\n", q->name, data_type(q->sig.type)); - hal_query_t qp = {}; - qp.name = q->name; - qp.callerdata.sival = q->callerdata.sival; - return hal_list_p_s(&qp, save_nets_pins_cb, arg); -} static void save_nets(std::string &dst, int arrow) { dst += "# nets\n"; + HalQRec qrec(256); hal_query_t q = {}; - q.callerdata.sival = arrow; - hal_list_s(&q, save_nets_cb, &dst); -} - -static int save_params_cb(hal_query_t *q, void *arg) -{ - std::string *str = reinterpret_cast(arg); - *str += fmt::format("setp {} {}\n", q->name, data_value(q->pp.type, q->pp.value).c_str()); - return 0; + if(0 != hal_list_s(&q, HalQRec::get_qrec_cb, &qrec)) + return; + for(size_t i = 0; i < qrec.size(); i++) { + dst += fmt::format("newsig {} {}\n", qrec.rec(i)->name, data_type(qrec.rec(i)->sig.type)); + save_nets_linksp(dst, qrec.rec(i)->name, arrow); + } } static void save_params(std::string &dst) { dst += "# parameter values\n"; + HalQRec qrec(512); hal_query_t q = {}; q.qtype = HAL_QTYPE_PARAM; - hal_list_p(&q, save_params_cb, &dst); -} - -static int save_threads_cb(hal_query_t *q, void *arg) -{ - if(HAL_QTYPE_THREAD_FUNCT == q->qtype) { - std::string *str = reinterpret_cast(arg); - *str += fmt::format("addf {} {}\n", q->thread.funct, q->name); + if(0 != hal_list_p(&q, HalQRec::get_qrec_cb, &qrec)) + return; + for(size_t i = 0; i < qrec.size(); i++) { + dst += fmt::format("setp {} {}\n", qrec.rec(i)->name, data_value(qrec.rec(i)->pp.type, qrec.rec(i)->pp.value)); } - return 0; } static void save_threads(std::string &dst) { dst += "# realtime thread/function links\n"; + HalQRec qrec; hal_query_t q = {}; q.qtype = HAL_QTYPE_THREAD_FUNCT; - hal_list_thread(&q, save_threads_cb, &dst); + if(0 != hal_list_thread(&q, HalQRec::get_qrec_cb, &qrec)) + return; + for(size_t i = 0; i < qrec.size(); i++) { + dst += fmt::format("addf {} {}\n", qrec.rec(i)->thread.funct, qrec.rec(i)->name); + } } // initiate session @@ -1734,20 +1705,17 @@ static cmdResponseType getLock(connectionRecType &ctx) return rtOk; } -static int getNet_cb(hal_query_t *q, void *arg) -{ - connectionRecType *ctx = reinterpret_cast(arg); - replynl(*ctx, fmt::format("{} {} {}", q->pp.signal, data_arrow1(q->pp.dir), q->name)); - return 0; -} - static cmdResponseType getNet(connectionRecType &ctx) { // GET NET + HalQRec qrec; hal_query_t q = {}; q.name = ctx.toks[2].c_str(); - int rv = hal_list_p_s(&q, getNet_cb, &ctx); + int rv = hal_list_p_s(&q, HalQRec::get_qrec_cb, &qrec); if(0 == rv) { + for(size_t i = 0; i < qrec.size(); i++) { + replynl(ctx, fmt::format("{} {} {}", qrec.rec(i)->pp.signal, data_arrow1(qrec.rec(i)->pp.dir), qrec.rec(i)->name)); + } return rtOk; } else if(-ENOENT == rv) { errornl(ctx, fmt::format("Signal '{}' not found", ctx.toks[2])); @@ -1874,13 +1842,19 @@ static cmdResponseType setUnload(connectionRecType &ctx) if("all" == ctx.toks[2]) { // Unload all components // Gather all RT components + HalQRec qrec; hal_query_t q = {}; - int rv = hal_list_comp(&q, unloadrt_cb, &comps); + int rv = hal_list_comp(&q, HalQRec::get_qrec_cb, &qrec); if(0 != rv) { errornl(ctx, fmt::format("Failed to gather component list, error={} ({})", ctx.toks[2], rv, hal_strerror(rv))); return rtError; } + for(size_t i = 0; i < qrec.size(); i++) { + if(HAL_COMP_TYPE_REALTIME == qrec.rec(i)->comp.type) { + comps.push_back(qrec.rec(i)->name); + } + } } else { // Unload one specific component hal_query_t q = {}; @@ -2101,10 +2075,10 @@ static hal_type_t haltype_from_str(const std::string &str) { "bool", HAL_BOOL }, { "float", HAL_REAL }, { "real", HAL_REAL }, - { "s32", HAL_S32 }, + { "s32", HAL_SINT }, { "s64", HAL_SINT }, { "sint", HAL_SINT }, - { "u32", HAL_U32 }, + { "u32", HAL_UINT }, { "u64", HAL_UINT }, { "uint", HAL_UINT }, }; @@ -2131,24 +2105,21 @@ static cmdResponseType setNewSig(connectionRecType &ctx) return rtOk; } -static int setDelSig_cb(hal_query_t *q, void *arg) -{ - std::vector *sigs = reinterpret_cast *>(arg); - sigs->push_back(q->name); - return 0; -} - static cmdResponseType setDelSig(connectionRecType &ctx) { // SET DELSIG if(ctx.toks[2] == "all") { std::vector sigs; + HalQRec qrec(256); hal_query_t q = {}; - int rv = hal_list_s(&q, setDelSig_cb, &sigs); + int rv = hal_list_s(&q, HalQRec::get_qrec_cb, &qrec); if(0 != rv) { errornl(ctx, fmt::format("Failed to gather all signal names, error={}", rv)); return rtError; } + for(size_t i = 0; i < qrec.size(); i++) { + sigs.push_back(qrec.rec(i)->name); + } bool fail = false; for(const auto &sig : sigs) { rv = hal_signal_delete(sig.c_str()); diff --git a/src/hal/utils/halsh.c b/src/hal/utils/halsh.c index e0e4d70591c..38ba87dc461 100644 --- a/src/hal/utils/halsh.c +++ b/src/hal/utils/halsh.c @@ -111,13 +111,11 @@ static int halsh_format_one(Tcl_Interp *interp, hal_stream_data_u v) { char buf[64]; switch(hal_stream_element_type(s, idx)) { - case HAL_BIT: snprintf(buf, sizeof(buf), "%d", v.b ? 1 : 0); break; - case HAL_FLOAT: snprintf(buf, sizeof(buf), "%g", v.f); break; - case HAL_S32: snprintf(buf, sizeof(buf), "%lld", (long long)v.s); break; - case HAL_U32: snprintf(buf, sizeof(buf), "%llu", (unsigned long long)v.u); break; - case HAL_S64: snprintf(buf, sizeof(buf), "%lld", (long long)v.l); break; - case HAL_U64: snprintf(buf, sizeof(buf), "%llu", (unsigned long long)v.k); break; - default: snprintf(buf, sizeof(buf), "0"); break; + case HAL_BOOL: snprintf(buf, sizeof(buf), "%d", v.b ? 1 : 0); break; + case HAL_REAL: snprintf(buf, sizeof(buf), "%g", v.f); break; + case HAL_SINT: snprintf(buf, sizeof(buf), "%lld", (long long)v.l); break; + case HAL_UINT: snprintf(buf, sizeof(buf), "%llu", (unsigned long long)v.k); break; + default: snprintf(buf, sizeof(buf), "0"); break; } Tcl_AppendElement(interp, buf); return TCL_OK; diff --git a/src/hal/utils/meter.c b/src/hal/utils/meter.c index e371379955c..967ef4fce97 100644 --- a/src/hal/utils/meter.c +++ b/src/hal/utils/meter.c @@ -543,16 +543,6 @@ static const char *data_value(hal_type_t type, hal_refs_u ref) snprintf(buf, sizeof(buf), "%.7g", (double)hal_get_real(ref.r)); value_str = buf; break; - case HAL_S32: - snprintf(buf, sizeof(buf), "%10ld", (long)hal_get_si32(ref.s)); - value_str = buf; - break; - case HAL_U32: { - unsigned long v = hal_get_ui32(ref.u); - snprintf(buf, sizeof(buf), "%10lu (0x%08lX)", v, v); - value_str = buf; - } - break; case HAL_SINT: snprintf(buf, sizeof(buf), "%10lld", (long long)hal_get_sint(ref.s)); value_str = buf; diff --git a/src/hal/utils/scope_disp.c b/src/hal/utils/scope_disp.c index 4953b697048..b243e9c554c 100644 --- a/src/hal/utils/scope_disp.c +++ b/src/hal/utils/scope_disp.c @@ -163,12 +163,6 @@ static void calculate_offset(int chan_num) { case HAL_REAL: value = dptr->r; break; - case HAL_S32: - value = dptr->s; - break; - case HAL_U32: - value = dptr->u; - break; case HAL_SINT: value = dptr->s; break; @@ -828,12 +822,6 @@ void draw_waveform(int chan_num, int highlight) case HAL_REAL: fy = dptr->r; break; - case HAL_S32: - fy = dptr->s; - break; - case HAL_U32: - fy = dptr->u; - break; case HAL_SINT: fy = dptr->s; break; diff --git a/src/hal/utils/scope_files.c b/src/hal/utils/scope_files.c index 199f37c7f27..19daacb400a 100644 --- a/src/hal/utils/scope_files.c +++ b/src/hal/utils/scope_files.c @@ -628,13 +628,11 @@ void read_log_file(char *filename) chan->min_index = -36; chan->max_index = 36; break; - case HAL_S32: case HAL_SINT: chan->data_len = sizeof(scope_data_t); chan->min_index = -2; chan->max_index = 30; break; - case HAL_U32: case HAL_UINT: chan->data_len = sizeof(scope_data_t); chan->min_index = -2; @@ -753,12 +751,6 @@ void read_log_file(char *filename) case HAL_REAL: dptr->r = (rtapi_real)value; break; - case HAL_S32: - dptr->s = (rtapi_s32)value; - break; - case HAL_U32: - dptr->u = (rtapi_u32)value; - break; case HAL_SINT: dptr->s = (rtapi_sint)value; break; @@ -846,12 +838,6 @@ static void write_sample(FILE *fp, scope_data_t *dptr, hal_type_t type) case HAL_REAL: data_value = dptr->r; break; - case HAL_S32: - data_value = dptr->s; - break; - case HAL_U32: - data_value = dptr->u; - break; case HAL_SINT: data_value = dptr->s; break; diff --git a/src/hal/utils/scope_rt.c b/src/hal/utils/scope_rt.c index cb3aca04b17..742eab77b6c 100644 --- a/src/hal/utils/scope_rt.c +++ b/src/hal/utils/scope_rt.c @@ -128,7 +128,7 @@ int rtapi_app_main(void) init_rt_control_struct(shm_base); /* export scope data sampling function */ - retval = hal_export_funct("scope.sample", sample, NULL, 0, 0, comp_id); + retval = hal_export_funct("scope.sample", sample, NULL, 0, comp_id); if (retval != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "SCOPE_RT: ERROR: sample funct export failed\n"); @@ -266,8 +266,6 @@ static void capture_sample(void) continue; switch(ctrl_rt->data_type[n]) { case HAL_BOOL: dest->b = hal_get_bool(ctrl_rt->data_addr[n].b); dest++; break; - case HAL_S32: dest->s = hal_get_si32(ctrl_rt->data_addr[n].s); dest++; break; - case HAL_U32: dest->u = hal_get_ui32(ctrl_rt->data_addr[n].u); dest++; break; case HAL_SINT: dest->s = hal_get_sint(ctrl_rt->data_addr[n].s); dest++; break; case HAL_UINT: dest->u = hal_get_uint(ctrl_rt->data_addr[n].u); dest++; break; case HAL_REAL: dest->r = hal_get_real(ctrl_rt->data_addr[n].r); dest++; break; @@ -316,15 +314,9 @@ static int check_trigger(void) case HAL_BOOL: compare_result = hal_get_bool(ctrl_rt->data_addr[ctrl_shm->trig_chan - 1].b); break; - case HAL_S32: - compare_result = hal_get_si32(ctrl_rt->data_addr[ctrl_shm->trig_chan - 1].s) > level->s; - break; case HAL_SINT: compare_result = hal_get_sint(ctrl_rt->data_addr[ctrl_shm->trig_chan - 1].s) > level->s; break; - case HAL_U32: - compare_result = hal_get_ui32(ctrl_rt->data_addr[ctrl_shm->trig_chan - 1].u) > level->u; - break; case HAL_UINT: compare_result = hal_get_uint(ctrl_rt->data_addr[ctrl_shm->trig_chan - 1].u) > level->u; break; diff --git a/src/hal/utils/scope_trig.c b/src/hal/utils/scope_trig.c index 68d436ed783..3211e13b18a 100644 --- a/src/hal/utils/scope_trig.c +++ b/src/hal/utils/scope_trig.c @@ -137,24 +137,6 @@ void refresh_trigger(void) case HAL_REAL: ctrl_shm->trig_level.r = fp_level; break; - case HAL_S32: - if (fp_level > (rtapi_real)RTAPI_INT32_MAX) { - fp_level = (rtapi_real)RTAPI_INT32_MAX; - } - if (fp_level < (rtapi_real)RTAPI_INT32_MIN) { - fp_level = (rtapi_real)RTAPI_INT32_MIN; - } - ctrl_shm->trig_level.s = fp_level; - break; - case HAL_U32: - if (fp_level > (rtapi_real)RTAPI_UINT32_MAX) { - fp_level = (rtapi_real)RTAPI_UINT32_MAX; - } - if (fp_level < 0.0) { - fp_level = 0.0; - } - ctrl_shm->trig_level.u = fp_level; - break; case HAL_SINT: if (fp_level > (rtapi_real)RTAPI_SINT_MAX) { fp_level = (rtapi_real)RTAPI_SINT_MAX; diff --git a/src/hal/utils/scope_vert.c b/src/hal/utils/scope_vert.c index daddb16b3c8..120777ca819 100644 --- a/src/hal/utils/scope_vert.c +++ b/src/hal/utils/scope_vert.c @@ -255,13 +255,11 @@ int set_channel_source(int chan_num, int type, char *name) chan->min_index = -36; chan->max_index = 36; break; - case HAL_S32: case HAL_SINT: chan->data_len = sizeof(scope_data_t); chan->min_index = -2; chan->max_index = 30; break; - case HAL_U32: case HAL_UINT: chan->data_len = sizeof(scope_data_t); chan->min_index = -2; diff --git a/src/rtapi/examples/fifo/fifotask.c b/src/rtapi/examples/fifo/fifotask.c index e24cb44a56f..5d0b16843ca 100644 --- a/src/rtapi/examples/fifo/fifotask.c +++ b/src/rtapi/examples/fifo/fifotask.c @@ -119,7 +119,7 @@ int rtapi_app_main(void) /* create the fifo task */ fifo_task = rtapi_task_new(fifo_code, 0 /* arg */ , fifo_prio, module, - FIFO_STACKSIZE, RTAPI_NO_FP); + FIFO_STACKSIZE); if (fifo_task < 0) { rtapi_print("fifotask init: rtapi_task_new failed with %d\n", fifo_task); diff --git a/src/rtapi/examples/semaphore/master.c b/src/rtapi/examples/semaphore/master.c index af7e33df33c..f6549a5fa6f 100644 --- a/src/rtapi/examples/semaphore/master.c +++ b/src/rtapi/examples/semaphore/master.c @@ -102,7 +102,7 @@ int rtapi_app_main(void) /* create the master task */ master_task = rtapi_task_new(master_code, 0 /* arg */ , master_prio, module, - MASTER_STACKSIZE, RTAPI_NO_FP); + MASTER_STACKSIZE); if (master_task < 0) { rtapi_print("sem master init: rtapi_task_new returned %d\n", master_task); diff --git a/src/rtapi/examples/semaphore/slave.c b/src/rtapi/examples/semaphore/slave.c index 87d1d4e401e..de57d800919 100644 --- a/src/rtapi/examples/semaphore/slave.c +++ b/src/rtapi/examples/semaphore/slave.c @@ -68,7 +68,7 @@ int rtapi_app_main(void) /* create the slave task */ slave_task = rtapi_task_new(slave_code, 0 /* arg */ , slave_prio, module, - SLAVE_STACKSIZE, RTAPI_NO_FP); + SLAVE_STACKSIZE); if (slave_task < 0) { rtapi_print("sem slave init: rtapi_task_new returned %d\n", slave_task); diff --git a/src/rtapi/examples/shmem/shmemtask.c b/src/rtapi/examples/shmem/shmemtask.c index 7088ba41328..60c417cd878 100644 --- a/src/rtapi/examples/shmem/shmemtask.c +++ b/src/rtapi/examples/shmem/shmemtask.c @@ -106,7 +106,7 @@ int rtapi_app_main(void) /* create the shmem task */ shmem_task = rtapi_task_new(shmem_code, 0 /* arg */ , shmem_prio, module, - SHMEM_STACKSIZE, RTAPI_NO_FP); + SHMEM_STACKSIZE); if (shmem_task < 0) { rtapi_print("shmemtask init: rtapi_task_new returned %d\n", shmem_task); diff --git a/src/rtapi/examples/timer/timertask.c b/src/rtapi/examples/timer/timertask.c index 68de062b080..baa06077f08 100644 --- a/src/rtapi/examples/timer/timertask.c +++ b/src/rtapi/examples/timer/timertask.c @@ -279,7 +279,7 @@ int rtapi_app_main(void) /* the second arg is an arbitrary int that is passed to the timer task on the first iteration */ timer_task = rtapi_task_new(timer_code, 0 /* arg */ , timer_prio, module, - TIMER_STACKSIZE, RTAPI_NO_FP); + TIMER_STACKSIZE); if (timer_task < 0) { /* See rtapi.h for the error codes returned */ rtapi_print("timertask init: rtapi_task_new returned %d\n", diff --git a/src/rtapi/rtai_rtapi.c b/src/rtapi/rtai_rtapi.c index 0ac0e050361..c15efe70add 100644 --- a/src/rtapi/rtai_rtapi.c +++ b/src/rtapi/rtai_rtapi.c @@ -622,7 +622,7 @@ static int rtapi_trap_handler(int vec, int signo, struct pt_regs *regs, } int rtapi_task_new(void (*taskcode) (void *), void *arg, - int prio, int owner, unsigned long int stacksize, int uses_fp) + int prio, int owner, unsigned long int stacksize) { int n; long task_id; @@ -667,8 +667,7 @@ int rtapi_task_new(void (*taskcode) (void *), void *arg, } task->taskcode = taskcode; task->arg = arg; - /* call OS to initialize the task - use predetermined CPU. - uses_fp is deprecated and ignored; always save FPU state. */ + /* call OS to initialize the task - use predetermined CPU. */ retval = rt_task_init_cpuid(ostask_array[task_id], wrapper, task_id, stacksize, prio, 1 /* always save FPU */, 0 /* signal */, rtapi_data->rt_cpu ); if (retval != 0) { diff --git a/src/rtapi/rtapi.h b/src/rtapi/rtapi.h index 40f5fa56cf1..c0a12aa73f1 100644 --- a/src/rtapi/rtapi.h +++ b/src/rtapi/rtapi.h @@ -378,9 +378,6 @@ RTAPI_BEGIN_DECLS * arbitrary void pointer when the task is started, and can be used to pass any * amount of data to the task (by pointing to a struct, or other such tricks). * - * @c uses_fp is deprecated and ignored. All tasks now unconditionally - * save and restore FPU/SSE state on context switch. This parameter - * will be removed in a future version. * @param taskcode Pointer to the function to be called when the task is * started. * @param arg Argument to be passed to the taskcode function. @@ -388,14 +385,13 @@ RTAPI_BEGIN_DECLS * @param owner ID of the module that is making the call see rtapi_init(). * @param stacksize The amount of stack to be used for the task, be generous, * hardware interrupts may use the same stack. - * @param uses_fp Deprecated and ignored. Kept for API compatibility. * @return On success, returns a positive integer task ID, @c task_id. This ID * is used for all subsequent calls that need to act on the task. On * failure, returns a negative error code as listed above. * @note Call only from within init/cleanup code, not from realtime tasks. */ extern int rtapi_task_new(void (*taskcode) (void *), void *arg, - int prio, int owner, unsigned long int stacksize, int uses_fp); + int prio, int owner, unsigned long int stacksize); /** * @brief Deletes a task. diff --git a/src/rtapi/uspace_rtai.cc b/src/rtapi/uspace_rtai.cc index d2776769fb2..0c4cc2322f1 100644 --- a/src/rtapi/uspace_rtai.cc +++ b/src/rtapi/uspace_rtai.cc @@ -110,7 +110,7 @@ struct RtaiApp : RtapiApp { task->rt_task = rt_task_init_schmod(task->id, task->prio, 0, 0, SCHED_FIFO, cpus_allowed); rt_set_periodic_mode(); start_rt_timer(nano2count(task->period)); - /* uses_fp is deprecated and ignored; always save FPU state */ + /* uses_fp is removed; always save FPU state */ rt_task_use_fpu(task->rt_task, 1); rt_make_hard_real_time(); rt_task_make_periodic_relative_ns(task->rt_task, task->period, task->period); diff --git a/src/rtapi/uspace_rtapi_app.cc b/src/rtapi/uspace_rtapi_app.cc index eecca0ae0d4..699eabb36c7 100644 --- a/src/rtapi/uspace_rtapi_app.cc +++ b/src/rtapi/uspace_rtapi_app.cc @@ -48,7 +48,7 @@ void WithRoot::init(uid_t ruid_ini, uid_t euid_ini) { } RtapiTask::RtapiTask() - : magic{}, id{}, owner{}, uses_fp{}, stacksize{}, prio{}, period{}, nextstart{}, pll_correction{}, + : magic{}, id{}, owner{}, stacksize{}, prio{}, period{}, nextstart{}, pll_correction{}, pll_correction_limit{}, arg{}, taskcode{} { @@ -120,8 +120,7 @@ int RtapiApp::allocate_task_id() { } int RtapiApp::task_new( - void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize, int /*uses_fp*/ -) { + void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize) { /* check requested priority */ if (!prio_check(prio)) { rtapi_print_msg( @@ -144,8 +143,6 @@ int RtapiApp::task_new( stacksize = (1024 * 1024); task->id = n; task->owner = owner; - /* uses_fp is deprecated and ignored; always save FPU state */ - task->uses_fp = 1; task->arg = arg; task->stacksize = stacksize; task->taskcode = taskcode; diff --git a/src/rtapi/uspace_rtapi_app.hh b/src/rtapi/uspace_rtapi_app.hh index beea58e4020..43e55b6b5a6 100644 --- a/src/rtapi/uspace_rtapi_app.hh +++ b/src/rtapi/uspace_rtapi_app.hh @@ -66,7 +66,6 @@ struct RtapiTask { int magic; /* to check for valid handle */ int id; int owner; - int uses_fp; size_t stacksize; int prio; long period; @@ -94,7 +93,7 @@ struct RtapiApp { int prio_next_higher(int prio) const; int prio_next_lower(int prio) const; long clock_set_period(long int period_nsec); - int task_new(void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize, int uses_fp); + int task_new(void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize); virtual RtapiTask *do_task_new() = 0; static int allocate_task_id(); static RtapiTask *get_task(int task_id); diff --git a/src/rtapi/uspace_rtapi_main.cc b/src/rtapi/uspace_rtapi_main.cc index 99f0af8b17d..32c5ddd8df4 100644 --- a/src/rtapi/uspace_rtapi_main.cc +++ b/src/rtapi/uspace_rtapi_main.cc @@ -1642,8 +1642,8 @@ long rtapi_clock_set_period(long nsecs) { return App().clock_set_period(nsecs); } -int rtapi_task_new(void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize, int uses_fp) { - return App().task_new(taskcode, arg, prio, owner, stacksize, uses_fp); +int rtapi_task_new(void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize) { + return App().task_new(taskcode, arg, prio, owner, stacksize); } int rtapi_task_delete(int id) { diff --git a/tcl/bin/halshow.tcl b/tcl/bin/halshow.tcl index 1c8bde45c17..3b7cd81e5c6 100755 --- a/tcl/bin/halshow.tcl +++ b/tcl/bin/halshow.tcl @@ -957,7 +957,7 @@ proc watchHAL {which} { $::cisp create text $::col1_width [expr $i * 20 + 13] -text $label \ -anchor w -tag $label -fill $labelcolor set canvaswidth [winfo width $::cisp] - if {$type == "bit"} { + if {$type == "bit" || $type == "bool"} { $::cisp create oval 10 [expr $i * 20 + 5] 25 [expr $i * 20 + 20] \ -fill lightgray -tag oval$i if {$writable == 1} { @@ -1279,7 +1279,9 @@ proc refreshItem {cnum vartype varname} { } else { switch $varnumtype { u32 - s32 {set varnumtype int} + uint - sint {set varnumtype int} float {set varnumtype float} + real {set varnumtype float} } if [catch { set value [expr $ret] } ] { set value $ret ;# allow display of a nan diff --git a/tests/hal-backslash/expected b/tests/hal-backslash/expected index 9f41ddd057f..a2315b700b5 100644 --- a/tests/hal-backslash/expected +++ b/tests/hal-backslash/expected @@ -1,4 +1,4 @@ Signals: Type Value Name (linked to) -bit TRUE hello +bool TRUE hello diff --git a/tests/hal-link-unlink/hallink.py b/tests/hal-link-unlink/hallink.py index 59587b60a2a..a63c5a7a31b 100755 --- a/tests/hal-link-unlink/hallink.py +++ b/tests/hal-link-unlink/hallink.py @@ -24,8 +24,8 @@ def cmd(arg): assert h['inout'] == 4713 # create virgin signals -cmd("halcmd newsig insig float") -cmd("halcmd newsig inoutsig float") +cmd("halcmd newsig insig real") +cmd("halcmd newsig inoutsig real") # link to them cmd("halcmd net insig linktest.in") diff --git a/tests/hal-show/expected b/tests/hal-show/expected index 7ecb4551e21..dd41b0cf1e4 100644 --- a/tests/hal-show/expected +++ b/tests/hal-show/expected @@ -1,72 +1,72 @@ Component Pins: Owner Type Dir Value Name - 10 bit IN FALSE conv-bit-u32.0.in <== net-conv-bit-u32.0.in - 16 float IN 0 conv-float-s32.0.in <== net-conv-float-s32.0.in - 19 s32 IN 0 conv-s32-float.0.in <== net-conv-s32-float.0.in - 22 s64 IN 0 conv-s64-u64.0.in <== net-conv-s64-u64.0.in - 13 u32 IN 0x00000000 conv-u32-bit.0.in <== net-conv-u32-bit.0.in - 25 u64 IN 0x0000000000000000 conv-u64-s64.0.in <== net-conv-u64-s64.0.in + 10 bool IN FALSE conv-bool-uint.0.in <== net-conv-bool-uint.0.in + 16 real IN 0 conv-real-sint.0.in <== net-conv-real-sint.0.in + 19 sint IN 0 conv-sint-real.0.in <== net-conv-sint-real.0.in + 22 sint IN 0 conv-sint-uint.0.in <== net-conv-sint-uint.0.in + 13 uint IN 0x0000000000000000 conv-uint-bool.0.in <== net-conv-uint-bool.0.in + 25 uint IN 0x0000000000000000 conv-uint-sint.0.in <== net-conv-uint-sint.0.in Signals: Type Value Name (linked to) -bit FALSE net-conv-bit-u32.0.in - ==> conv-bit-u32.0.in -u32 0x00000000 net-conv-bit-u32.0.out - <== conv-bit-u32.0.out -float 0 net-conv-float-s32.0.in - ==> conv-float-s32.0.in -s32 0 net-conv-float-s32.0.out - <== conv-float-s32.0.out -s32 0 net-conv-s32-float.0.in - ==> conv-s32-float.0.in -float 0 net-conv-s32-float.0.out - <== conv-s32-float.0.out -s64 0 net-conv-s64-u64.0.in - ==> conv-s64-u64.0.in -u64 0x0000000000000000 net-conv-s64-u64.0.out - <== conv-s64-u64.0.out -u32 0x00000000 net-conv-u32-bit.0.in - ==> conv-u32-bit.0.in -bit FALSE net-conv-u32-bit.0.out - <== conv-u32-bit.0.out -u64 0x0000000000000000 net-conv-u64-s64.0.in - ==> conv-u64-s64.0.in -s64 0 net-conv-u64-s64.0.out - <== conv-u64-s64.0.out +bool FALSE net-conv-bool-uint.0.in + ==> conv-bool-uint.0.in +uint 0x0000000000000000 net-conv-bool-uint.0.out + <== conv-bool-uint.0.out +real 0 net-conv-real-sint.0.in + ==> conv-real-sint.0.in +sint 0 net-conv-real-sint.0.out + <== conv-real-sint.0.out +sint 0 net-conv-sint-real.0.in + ==> conv-sint-real.0.in +real 0 net-conv-sint-real.0.out + <== conv-sint-real.0.out +sint 0 net-conv-sint-uint.0.in + ==> conv-sint-uint.0.in +uint 0x0000000000000000 net-conv-sint-uint.0.out + <== conv-sint-uint.0.out +uint 0x0000000000000000 net-conv-uint-bool.0.in + ==> conv-uint-bool.0.in +bool FALSE net-conv-uint-bool.0.out + <== conv-uint-bool.0.out +uint 0x0000000000000000 net-conv-uint-sint.0.in + ==> conv-uint-sint.0.in +sint 0 net-conv-uint-sint.0.out + <== conv-uint-sint.0.out Component Pins: Owner Type Dir Value Name - 10 bit IN TRUE conv-bit-u32.0.in <== net-conv-bit-u32.0.in - 16 float IN 2.147484e+09 conv-float-s32.0.in <== net-conv-float-s32.0.in - 19 s32 IN -2147483648 conv-s32-float.0.in <== net-conv-s32-float.0.in - 22 s64 IN -9223372036854775808 conv-s64-u64.0.in <== net-conv-s64-u64.0.in - 13 u32 IN 0xFFFFFFFF conv-u32-bit.0.in <== net-conv-u32-bit.0.in - 25 u64 IN 0xFFFFFFFFFFFFFFFF conv-u64-s64.0.in <== net-conv-u64-s64.0.in + 10 bool IN TRUE conv-bool-uint.0.in <== net-conv-bool-uint.0.in + 16 real IN 2.147484e+09 conv-real-sint.0.in <== net-conv-real-sint.0.in + 19 sint IN -2147483648 conv-sint-real.0.in <== net-conv-sint-real.0.in + 22 sint IN -9223372036854775808 conv-sint-uint.0.in <== net-conv-sint-uint.0.in + 13 uint IN 0x00000000FFFFFFFF conv-uint-bool.0.in <== net-conv-uint-bool.0.in + 25 uint IN 0xFFFFFFFFFFFFFFFF conv-uint-sint.0.in <== net-conv-uint-sint.0.in Signals: Type Value Name (linked to) -bit TRUE net-conv-bit-u32.0.in - ==> conv-bit-u32.0.in -u32 0x00000001 net-conv-bit-u32.0.out - <== conv-bit-u32.0.out -float 2.147484e+09 net-conv-float-s32.0.in - ==> conv-float-s32.0.in -s32 2147483647 net-conv-float-s32.0.out - <== conv-float-s32.0.out -s32 -2147483648 net-conv-s32-float.0.in - ==> conv-s32-float.0.in -float -2.147484e+09 net-conv-s32-float.0.out - <== conv-s32-float.0.out -s64 -9223372036854775808 net-conv-s64-u64.0.in - ==> conv-s64-u64.0.in -u64 0x8000000000000000 net-conv-s64-u64.0.out - <== conv-s64-u64.0.out -u32 0xFFFFFFFF net-conv-u32-bit.0.in - ==> conv-u32-bit.0.in -bit TRUE net-conv-u32-bit.0.out - <== conv-u32-bit.0.out -u64 0xFFFFFFFFFFFFFFFF net-conv-u64-s64.0.in - ==> conv-u64-s64.0.in -s64 -1 net-conv-u64-s64.0.out - <== conv-u64-s64.0.out +bool TRUE net-conv-bool-uint.0.in + ==> conv-bool-uint.0.in +uint 0x0000000000000001 net-conv-bool-uint.0.out + <== conv-bool-uint.0.out +real 2.147484e+09 net-conv-real-sint.0.in + ==> conv-real-sint.0.in +sint 2147483647 net-conv-real-sint.0.out + <== conv-real-sint.0.out +sint -2147483648 net-conv-sint-real.0.in + ==> conv-sint-real.0.in +real -2.147484e+09 net-conv-sint-real.0.out + <== conv-sint-real.0.out +sint -9223372036854775808 net-conv-sint-uint.0.in + ==> conv-sint-uint.0.in +uint 0x8000000000000000 net-conv-sint-uint.0.out + <== conv-sint-uint.0.out +uint 0x00000000FFFFFFFF net-conv-uint-bool.0.in + ==> conv-uint-bool.0.in +bool TRUE net-conv-uint-bool.0.out + <== conv-uint-bool.0.out +uint 0xFFFFFFFFFFFFFFFF net-conv-uint-sint.0.in + ==> conv-uint-sint.0.in +sint -1 net-conv-uint-sint.0.out + <== conv-uint-sint.0.out diff --git a/tests/hal-show/test.hal b/tests/hal-show/test.hal index bbc57afd9ed..3b8fa61638b 100644 --- a/tests/hal-show/test.hal +++ b/tests/hal-show/test.hal @@ -1,52 +1,46 @@ # This should print every data type as input and output loadrt threads -loadrt conv_bit_u32 count=1 -loadrt conv_u32_bit count=1 -loadrt conv_float_s32 count=1 -loadrt conv_s32_float count=1 -loadrt conv_s64_u64 count=1 -loadrt conv_u64_s64 count=1 - -addf conv-bit-u32.0 thread1 -addf conv-u32-bit.0 thread1 -addf conv-float-s32.0 thread1 -addf conv-s32-float.0 thread1 -addf conv-s64-u64.0 thread1 -addf conv-u64-s64.0 thread1 - -net net-conv-float-s32.0.in conv-float-s32.0.in -net net-conv-float-s32.0.out conv-float-s32.0.out -net net-conv-s32-float.0.in conv-s32-float.0.in -net net-conv-s32-float.0.out conv-s32-float.0.out -net net-conv-bit-u32.0.in conv-bit-u32.0.in -net net-conv-bit-u32.0.out conv-bit-u32.0.out -net net-conv-s64-u64.0.in conv-s64-u64.0.in -net net-conv-s64-u64.0.out conv-s64-u64.0.out -net net-conv-u32-bit.0.in conv-u32-bit.0.in -net net-conv-u32-bit.0.out conv-u32-bit.0.out -net net-conv-u64-s64.0.in conv-u64-s64.0.in -net net-conv-u64-s64.0.out conv-u64-s64.0.out +loadrt conv_bool_uint count=1 +loadrt conv_uint_bool count=1 +loadrt conv_real_sint count=1 +loadrt conv_sint_real count=1 +loadrt conv_sint_uint count=1 +loadrt conv_uint_sint count=1 + +addf conv-bool-uint.0 thread1 +addf conv-uint-bool.0 thread1 +addf conv-real-sint.0 thread1 +addf conv-sint-real.0 thread1 +addf conv-sint-uint.0 thread1 +addf conv-uint-sint.0 thread1 + +net net-conv-real-sint.0.in conv-real-sint.0.in +net net-conv-real-sint.0.out conv-real-sint.0.out +net net-conv-sint-real.0.in conv-sint-real.0.in +net net-conv-sint-real.0.out conv-sint-real.0.out +net net-conv-bool-uint.0.in conv-bool-uint.0.in +net net-conv-bool-uint.0.out conv-bool-uint.0.out +net net-conv-sint-uint.0.in conv-sint-uint.0.in +net net-conv-sint-uint.0.out conv-sint-uint.0.out +net net-conv-uint-bool.0.in conv-uint-bool.0.in +net net-conv-uint-bool.0.out conv-uint-bool.0.out +net net-conv-uint-sint.0.in conv-uint-sint.0.in +net net-conv-uint-sint.0.out conv-uint-sint.0.out start loadusr -w sleep 0.1 show pin *.in show sig -sets net-conv-float-s32.0.in 2147483647 -sets net-conv-s32-float.0.in -2147483648 -sets net-conv-bit-u32.0.in 1 -sets net-conv-s64-u64.0.in -9223372036854775808 -sets net-conv-u32-bit.0.in 0xffffffff -sets net-conv-u64-s64.0.in 0xffffffffffffffff +sets net-conv-real-sint.0.in 2147483647 +sets net-conv-sint-real.0.in -2147483648 +sets net-conv-bool-uint.0.in 1 +sets net-conv-sint-uint.0.in -9223372036854775808 +sets net-conv-uint-bool.0.in 0xffffffff +sets net-conv-uint-sint.0.in 0xffffffffffffffff loadusr -w sleep 0.1 show pin *.in show sig - - - - - - diff --git a/tests/halcompile/personalities_mod/4count_2pers.expected b/tests/halcompile/personalities_mod/4count_2pers.expected index 01f5bc56498..81aa9f66ad2 100644 --- a/tests/halcompile/personalities_mod/4count_2pers.expected +++ b/tests/halcompile/personalities_mod/4count_2pers.expected @@ -1,100 +1,100 @@ -bitslice_test u32 IN 0 bitslice-test.0.in -bitslice_test bit OUT FALSE bitslice-test.0.out-00 -bitslice_test bit OUT FALSE bitslice-test.0.out-01 -bitslice_test s32 OUT 0 bitslice-test.0.time -bitslice_test u32 IN 0 bitslice-test.1.in -bitslice_test bit OUT FALSE bitslice-test.1.out-00 -bitslice_test bit OUT FALSE bitslice-test.1.out-01 -bitslice_test bit OUT FALSE bitslice-test.1.out-02 -bitslice_test s32 OUT 0 bitslice-test.1.time -bitslice_test u32 IN 0 bitslice-test.2.in -bitslice_test bit OUT FALSE bitslice-test.2.out-00 -bitslice_test bit OUT FALSE bitslice-test.2.out-01 -bitslice_test s32 OUT 0 bitslice-test.2.time -bitslice_test u32 IN 0 bitslice-test.3.in -bitslice_test bit OUT FALSE bitslice-test.3.out-00 -bitslice_test bit OUT FALSE bitslice-test.3.out-01 -bitslice_test bit OUT FALSE bitslice-test.3.out-02 -bitslice_test s32 OUT 0 bitslice-test.3.time -lincurve_test float IN 0 lincurve-test.0.in -lincurve_test float OUT 0 lincurve-test.0.out -lincurve_test float I/O 0 lincurve-test.0.out-io -lincurve_test s32 OUT 0 lincurve-test.0.time -lincurve_test float IN 0 lincurve-test.1.in -lincurve_test float OUT 0 lincurve-test.1.out -lincurve_test float I/O 0 lincurve-test.1.out-io -lincurve_test s32 OUT 0 lincurve-test.1.time -lincurve_test float IN 0 lincurve-test.2.in -lincurve_test float OUT 0 lincurve-test.2.out -lincurve_test float I/O 0 lincurve-test.2.out-io -lincurve_test s32 OUT 0 lincurve-test.2.time -lincurve_test float IN 0 lincurve-test.3.in -lincurve_test float OUT 0 lincurve-test.3.out -lincurve_test float I/O 0 lincurve-test.3.out-io -lincurve_test s32 OUT 0 lincurve-test.3.time -logic_test bit OUT FALSE logic-test.0.and -logic_test bit IN FALSE logic-test.0.in-00 -logic_test bit IN FALSE logic-test.0.in-01 -logic_test s32 OUT 0 logic-test.0.time -logic_test bit IN FALSE logic-test.1.in-00 -logic_test bit IN FALSE logic-test.1.in-01 -logic_test bit IN FALSE logic-test.1.in-02 -logic_test bit IN FALSE logic-test.1.in-03 -logic_test bit OUT FALSE logic-test.1.or -logic_test s32 OUT 0 logic-test.1.time -logic_test bit OUT FALSE logic-test.2.and -logic_test bit IN FALSE logic-test.2.in-00 -logic_test bit IN FALSE logic-test.2.in-01 -logic_test s32 OUT 0 logic-test.2.time -logic_test bit IN FALSE logic-test.3.in-00 -logic_test bit IN FALSE logic-test.3.in-01 -logic_test bit IN FALSE logic-test.3.in-02 -logic_test bit IN FALSE logic-test.3.in-03 -logic_test bit OUT FALSE logic-test.3.or -logic_test s32 OUT 0 logic-test.3.time +bitslice_test uint IN 0 bitslice-test.0.in +bitslice_test bool OUT FALSE bitslice-test.0.out-00 +bitslice_test bool OUT FALSE bitslice-test.0.out-01 +bitslice_test sint OUT 0 bitslice-test.0.time +bitslice_test uint IN 0 bitslice-test.1.in +bitslice_test bool OUT FALSE bitslice-test.1.out-00 +bitslice_test bool OUT FALSE bitslice-test.1.out-01 +bitslice_test bool OUT FALSE bitslice-test.1.out-02 +bitslice_test sint OUT 0 bitslice-test.1.time +bitslice_test uint IN 0 bitslice-test.2.in +bitslice_test bool OUT FALSE bitslice-test.2.out-00 +bitslice_test bool OUT FALSE bitslice-test.2.out-01 +bitslice_test sint OUT 0 bitslice-test.2.time +bitslice_test uint IN 0 bitslice-test.3.in +bitslice_test bool OUT FALSE bitslice-test.3.out-00 +bitslice_test bool OUT FALSE bitslice-test.3.out-01 +bitslice_test bool OUT FALSE bitslice-test.3.out-02 +bitslice_test sint OUT 0 bitslice-test.3.time +lincurve_test real IN 0 lincurve-test.0.in +lincurve_test real OUT 0 lincurve-test.0.out +lincurve_test real I/O 0 lincurve-test.0.out-io +lincurve_test sint OUT 0 lincurve-test.0.time +lincurve_test real IN 0 lincurve-test.1.in +lincurve_test real OUT 0 lincurve-test.1.out +lincurve_test real I/O 0 lincurve-test.1.out-io +lincurve_test sint OUT 0 lincurve-test.1.time +lincurve_test real IN 0 lincurve-test.2.in +lincurve_test real OUT 0 lincurve-test.2.out +lincurve_test real I/O 0 lincurve-test.2.out-io +lincurve_test sint OUT 0 lincurve-test.2.time +lincurve_test real IN 0 lincurve-test.3.in +lincurve_test real OUT 0 lincurve-test.3.out +lincurve_test real I/O 0 lincurve-test.3.out-io +lincurve_test sint OUT 0 lincurve-test.3.time +logic_test bool OUT FALSE logic-test.0.and +logic_test bool IN FALSE logic-test.0.in-00 +logic_test bool IN FALSE logic-test.0.in-01 +logic_test sint OUT 0 logic-test.0.time +logic_test bool IN FALSE logic-test.1.in-00 +logic_test bool IN FALSE logic-test.1.in-01 +logic_test bool IN FALSE logic-test.1.in-02 +logic_test bool IN FALSE logic-test.1.in-03 +logic_test bool OUT FALSE logic-test.1.or +logic_test sint OUT 0 logic-test.1.time +logic_test bool OUT FALSE logic-test.2.and +logic_test bool IN FALSE logic-test.2.in-00 +logic_test bool IN FALSE logic-test.2.in-01 +logic_test sint OUT 0 logic-test.2.time +logic_test bool IN FALSE logic-test.3.in-00 +logic_test bool IN FALSE logic-test.3.in-01 +logic_test bool IN FALSE logic-test.3.in-02 +logic_test bool IN FALSE logic-test.3.in-03 +logic_test bool OUT FALSE logic-test.3.or +logic_test sint OUT 0 logic-test.3.time -bitslice_test s32 RW 0 bitslice-test.0.tmax -bitslice_test bit RO FALSE bitslice-test.0.tmax-increased -bitslice_test s32 RW 0 bitslice-test.1.tmax -bitslice_test bit RO FALSE bitslice-test.1.tmax-increased -bitslice_test s32 RW 0 bitslice-test.2.tmax -bitslice_test bit RO FALSE bitslice-test.2.tmax-increased -bitslice_test s32 RW 0 bitslice-test.3.tmax -bitslice_test bit RO FALSE bitslice-test.3.tmax-increased -lincurve_test s32 RW 0 lincurve-test.0.tmax -lincurve_test bit RO FALSE lincurve-test.0.tmax-increased -lincurve_test float RW 0 lincurve-test.0.x-val-00 -lincurve_test float RW 0 lincurve-test.0.x-val-01 -lincurve_test float RW 0 lincurve-test.0.y-val-00 -lincurve_test float RW 0 lincurve-test.0.y-val-01 -lincurve_test s32 RW 0 lincurve-test.1.tmax -lincurve_test bit RO FALSE lincurve-test.1.tmax-increased -lincurve_test float RW 0 lincurve-test.1.x-val-00 -lincurve_test float RW 0 lincurve-test.1.x-val-01 -lincurve_test float RW 0 lincurve-test.1.x-val-02 -lincurve_test float RW 0 lincurve-test.1.y-val-00 -lincurve_test float RW 0 lincurve-test.1.y-val-01 -lincurve_test float RW 0 lincurve-test.1.y-val-02 -lincurve_test s32 RW 0 lincurve-test.2.tmax -lincurve_test bit RO FALSE lincurve-test.2.tmax-increased -lincurve_test float RW 0 lincurve-test.2.x-val-00 -lincurve_test float RW 0 lincurve-test.2.x-val-01 -lincurve_test float RW 0 lincurve-test.2.y-val-00 -lincurve_test float RW 0 lincurve-test.2.y-val-01 -lincurve_test s32 RW 0 lincurve-test.3.tmax -lincurve_test bit RO FALSE lincurve-test.3.tmax-increased -lincurve_test float RW 0 lincurve-test.3.x-val-00 -lincurve_test float RW 0 lincurve-test.3.x-val-01 -lincurve_test float RW 0 lincurve-test.3.x-val-02 -lincurve_test float RW 0 lincurve-test.3.y-val-00 -lincurve_test float RW 0 lincurve-test.3.y-val-01 -lincurve_test float RW 0 lincurve-test.3.y-val-02 -logic_test s32 RW 0 logic-test.0.tmax -logic_test bit RO FALSE logic-test.0.tmax-increased -logic_test s32 RW 0 logic-test.1.tmax -logic_test bit RO FALSE logic-test.1.tmax-increased -logic_test s32 RW 0 logic-test.2.tmax -logic_test bit RO FALSE logic-test.2.tmax-increased -logic_test s32 RW 0 logic-test.3.tmax -logic_test bit RO FALSE logic-test.3.tmax-increased +bitslice_test sint RW 0 bitslice-test.0.tmax +bitslice_test bool RO FALSE bitslice-test.0.tmax-increased +bitslice_test sint RW 0 bitslice-test.1.tmax +bitslice_test bool RO FALSE bitslice-test.1.tmax-increased +bitslice_test sint RW 0 bitslice-test.2.tmax +bitslice_test bool RO FALSE bitslice-test.2.tmax-increased +bitslice_test sint RW 0 bitslice-test.3.tmax +bitslice_test bool RO FALSE bitslice-test.3.tmax-increased +lincurve_test sint RW 0 lincurve-test.0.tmax +lincurve_test bool RO FALSE lincurve-test.0.tmax-increased +lincurve_test real RW 0 lincurve-test.0.x-val-00 +lincurve_test real RW 0 lincurve-test.0.x-val-01 +lincurve_test real RW 0 lincurve-test.0.y-val-00 +lincurve_test real RW 0 lincurve-test.0.y-val-01 +lincurve_test sint RW 0 lincurve-test.1.tmax +lincurve_test bool RO FALSE lincurve-test.1.tmax-increased +lincurve_test real RW 0 lincurve-test.1.x-val-00 +lincurve_test real RW 0 lincurve-test.1.x-val-01 +lincurve_test real RW 0 lincurve-test.1.x-val-02 +lincurve_test real RW 0 lincurve-test.1.y-val-00 +lincurve_test real RW 0 lincurve-test.1.y-val-01 +lincurve_test real RW 0 lincurve-test.1.y-val-02 +lincurve_test sint RW 0 lincurve-test.2.tmax +lincurve_test bool RO FALSE lincurve-test.2.tmax-increased +lincurve_test real RW 0 lincurve-test.2.x-val-00 +lincurve_test real RW 0 lincurve-test.2.x-val-01 +lincurve_test real RW 0 lincurve-test.2.y-val-00 +lincurve_test real RW 0 lincurve-test.2.y-val-01 +lincurve_test sint RW 0 lincurve-test.3.tmax +lincurve_test bool RO FALSE lincurve-test.3.tmax-increased +lincurve_test real RW 0 lincurve-test.3.x-val-00 +lincurve_test real RW 0 lincurve-test.3.x-val-01 +lincurve_test real RW 0 lincurve-test.3.x-val-02 +lincurve_test real RW 0 lincurve-test.3.y-val-00 +lincurve_test real RW 0 lincurve-test.3.y-val-01 +lincurve_test real RW 0 lincurve-test.3.y-val-02 +logic_test sint RW 0 logic-test.0.tmax +logic_test bool RO FALSE logic-test.0.tmax-increased +logic_test sint RW 0 logic-test.1.tmax +logic_test bool RO FALSE logic-test.1.tmax-increased +logic_test sint RW 0 logic-test.2.tmax +logic_test bool RO FALSE logic-test.2.tmax-increased +logic_test sint RW 0 logic-test.3.tmax +logic_test bool RO FALSE logic-test.3.tmax-increased diff --git a/tests/halcompile/personalities_mod/4names_2pers.expected b/tests/halcompile/personalities_mod/4names_2pers.expected index 214ddaa56fc..2403c86f4e7 100644 --- a/tests/halcompile/personalities_mod/4names_2pers.expected +++ b/tests/halcompile/personalities_mod/4names_2pers.expected @@ -1,100 +1,100 @@ -bitslice_test u32 IN 0 bs1.in -bitslice_test bit OUT FALSE bs1.out-00 -bitslice_test bit OUT FALSE bs1.out-01 -bitslice_test s32 OUT 0 bs1.time -bitslice_test u32 IN 0 bs2.in -bitslice_test bit OUT FALSE bs2.out-00 -bitslice_test bit OUT FALSE bs2.out-01 -bitslice_test bit OUT FALSE bs2.out-02 -bitslice_test s32 OUT 0 bs2.time -bitslice_test u32 IN 0 bs3.in -bitslice_test bit OUT FALSE bs3.out-00 -bitslice_test bit OUT FALSE bs3.out-01 -bitslice_test s32 OUT 0 bs3.time -bitslice_test u32 IN 0 bs4.in -bitslice_test bit OUT FALSE bs4.out-00 -bitslice_test bit OUT FALSE bs4.out-01 -bitslice_test bit OUT FALSE bs4.out-02 -bitslice_test s32 OUT 0 bs4.time -lincurve_test float IN 0 lc1.in -lincurve_test float OUT 0 lc1.out -lincurve_test float I/O 0 lc1.out-io -lincurve_test s32 OUT 0 lc1.time -lincurve_test float IN 0 lc2.in -lincurve_test float OUT 0 lc2.out -lincurve_test float I/O 0 lc2.out-io -lincurve_test s32 OUT 0 lc2.time -lincurve_test float IN 0 lc3.in -lincurve_test float OUT 0 lc3.out -lincurve_test float I/O 0 lc3.out-io -lincurve_test s32 OUT 0 lc3.time -lincurve_test float IN 0 lc4.in -lincurve_test float OUT 0 lc4.out -lincurve_test float I/O 0 lc4.out-io -lincurve_test s32 OUT 0 lc4.time -logic_test bit OUT FALSE lg1.and -logic_test bit IN FALSE lg1.in-00 -logic_test bit IN FALSE lg1.in-01 -logic_test s32 OUT 0 lg1.time -logic_test bit IN FALSE lg2.in-00 -logic_test bit IN FALSE lg2.in-01 -logic_test bit IN FALSE lg2.in-02 -logic_test bit IN FALSE lg2.in-03 -logic_test bit OUT FALSE lg2.or -logic_test s32 OUT 0 lg2.time -logic_test bit OUT FALSE lg3.and -logic_test bit IN FALSE lg3.in-00 -logic_test bit IN FALSE lg3.in-01 -logic_test s32 OUT 0 lg3.time -logic_test bit IN FALSE lg4.in-00 -logic_test bit IN FALSE lg4.in-01 -logic_test bit IN FALSE lg4.in-02 -logic_test bit IN FALSE lg4.in-03 -logic_test bit OUT FALSE lg4.or -logic_test s32 OUT 0 lg4.time +bitslice_test uint IN 0 bs1.in +bitslice_test bool OUT FALSE bs1.out-00 +bitslice_test bool OUT FALSE bs1.out-01 +bitslice_test sint OUT 0 bs1.time +bitslice_test uint IN 0 bs2.in +bitslice_test bool OUT FALSE bs2.out-00 +bitslice_test bool OUT FALSE bs2.out-01 +bitslice_test bool OUT FALSE bs2.out-02 +bitslice_test sint OUT 0 bs2.time +bitslice_test uint IN 0 bs3.in +bitslice_test bool OUT FALSE bs3.out-00 +bitslice_test bool OUT FALSE bs3.out-01 +bitslice_test sint OUT 0 bs3.time +bitslice_test uint IN 0 bs4.in +bitslice_test bool OUT FALSE bs4.out-00 +bitslice_test bool OUT FALSE bs4.out-01 +bitslice_test bool OUT FALSE bs4.out-02 +bitslice_test sint OUT 0 bs4.time +lincurve_test real IN 0 lc1.in +lincurve_test real OUT 0 lc1.out +lincurve_test real I/O 0 lc1.out-io +lincurve_test sint OUT 0 lc1.time +lincurve_test real IN 0 lc2.in +lincurve_test real OUT 0 lc2.out +lincurve_test real I/O 0 lc2.out-io +lincurve_test sint OUT 0 lc2.time +lincurve_test real IN 0 lc3.in +lincurve_test real OUT 0 lc3.out +lincurve_test real I/O 0 lc3.out-io +lincurve_test sint OUT 0 lc3.time +lincurve_test real IN 0 lc4.in +lincurve_test real OUT 0 lc4.out +lincurve_test real I/O 0 lc4.out-io +lincurve_test sint OUT 0 lc4.time +logic_test bool OUT FALSE lg1.and +logic_test bool IN FALSE lg1.in-00 +logic_test bool IN FALSE lg1.in-01 +logic_test sint OUT 0 lg1.time +logic_test bool IN FALSE lg2.in-00 +logic_test bool IN FALSE lg2.in-01 +logic_test bool IN FALSE lg2.in-02 +logic_test bool IN FALSE lg2.in-03 +logic_test bool OUT FALSE lg2.or +logic_test sint OUT 0 lg2.time +logic_test bool OUT FALSE lg3.and +logic_test bool IN FALSE lg3.in-00 +logic_test bool IN FALSE lg3.in-01 +logic_test sint OUT 0 lg3.time +logic_test bool IN FALSE lg4.in-00 +logic_test bool IN FALSE lg4.in-01 +logic_test bool IN FALSE lg4.in-02 +logic_test bool IN FALSE lg4.in-03 +logic_test bool OUT FALSE lg4.or +logic_test sint OUT 0 lg4.time -bitslice_test s32 RW 0 bs1.tmax -bitslice_test bit RO FALSE bs1.tmax-increased -bitslice_test s32 RW 0 bs2.tmax -bitslice_test bit RO FALSE bs2.tmax-increased -bitslice_test s32 RW 0 bs3.tmax -bitslice_test bit RO FALSE bs3.tmax-increased -bitslice_test s32 RW 0 bs4.tmax -bitslice_test bit RO FALSE bs4.tmax-increased -lincurve_test s32 RW 0 lc1.tmax -lincurve_test bit RO FALSE lc1.tmax-increased -lincurve_test float RW 0 lc1.x-val-00 -lincurve_test float RW 0 lc1.x-val-01 -lincurve_test float RW 0 lc1.y-val-00 -lincurve_test float RW 0 lc1.y-val-01 -lincurve_test s32 RW 0 lc2.tmax -lincurve_test bit RO FALSE lc2.tmax-increased -lincurve_test float RW 0 lc2.x-val-00 -lincurve_test float RW 0 lc2.x-val-01 -lincurve_test float RW 0 lc2.x-val-02 -lincurve_test float RW 0 lc2.y-val-00 -lincurve_test float RW 0 lc2.y-val-01 -lincurve_test float RW 0 lc2.y-val-02 -lincurve_test s32 RW 0 lc3.tmax -lincurve_test bit RO FALSE lc3.tmax-increased -lincurve_test float RW 0 lc3.x-val-00 -lincurve_test float RW 0 lc3.x-val-01 -lincurve_test float RW 0 lc3.y-val-00 -lincurve_test float RW 0 lc3.y-val-01 -lincurve_test s32 RW 0 lc4.tmax -lincurve_test bit RO FALSE lc4.tmax-increased -lincurve_test float RW 0 lc4.x-val-00 -lincurve_test float RW 0 lc4.x-val-01 -lincurve_test float RW 0 lc4.x-val-02 -lincurve_test float RW 0 lc4.y-val-00 -lincurve_test float RW 0 lc4.y-val-01 -lincurve_test float RW 0 lc4.y-val-02 -logic_test s32 RW 0 lg1.tmax -logic_test bit RO FALSE lg1.tmax-increased -logic_test s32 RW 0 lg2.tmax -logic_test bit RO FALSE lg2.tmax-increased -logic_test s32 RW 0 lg3.tmax -logic_test bit RO FALSE lg3.tmax-increased -logic_test s32 RW 0 lg4.tmax -logic_test bit RO FALSE lg4.tmax-increased +bitslice_test sint RW 0 bs1.tmax +bitslice_test bool RO FALSE bs1.tmax-increased +bitslice_test sint RW 0 bs2.tmax +bitslice_test bool RO FALSE bs2.tmax-increased +bitslice_test sint RW 0 bs3.tmax +bitslice_test bool RO FALSE bs3.tmax-increased +bitslice_test sint RW 0 bs4.tmax +bitslice_test bool RO FALSE bs4.tmax-increased +lincurve_test sint RW 0 lc1.tmax +lincurve_test bool RO FALSE lc1.tmax-increased +lincurve_test real RW 0 lc1.x-val-00 +lincurve_test real RW 0 lc1.x-val-01 +lincurve_test real RW 0 lc1.y-val-00 +lincurve_test real RW 0 lc1.y-val-01 +lincurve_test sint RW 0 lc2.tmax +lincurve_test bool RO FALSE lc2.tmax-increased +lincurve_test real RW 0 lc2.x-val-00 +lincurve_test real RW 0 lc2.x-val-01 +lincurve_test real RW 0 lc2.x-val-02 +lincurve_test real RW 0 lc2.y-val-00 +lincurve_test real RW 0 lc2.y-val-01 +lincurve_test real RW 0 lc2.y-val-02 +lincurve_test sint RW 0 lc3.tmax +lincurve_test bool RO FALSE lc3.tmax-increased +lincurve_test real RW 0 lc3.x-val-00 +lincurve_test real RW 0 lc3.x-val-01 +lincurve_test real RW 0 lc3.y-val-00 +lincurve_test real RW 0 lc3.y-val-01 +lincurve_test sint RW 0 lc4.tmax +lincurve_test bool RO FALSE lc4.tmax-increased +lincurve_test real RW 0 lc4.x-val-00 +lincurve_test real RW 0 lc4.x-val-01 +lincurve_test real RW 0 lc4.x-val-02 +lincurve_test real RW 0 lc4.y-val-00 +lincurve_test real RW 0 lc4.y-val-01 +lincurve_test real RW 0 lc4.y-val-02 +logic_test sint RW 0 lg1.tmax +logic_test bool RO FALSE lg1.tmax-increased +logic_test sint RW 0 lg2.tmax +logic_test bool RO FALSE lg2.tmax-increased +logic_test sint RW 0 lg3.tmax +logic_test bool RO FALSE lg3.tmax-increased +logic_test sint RW 0 lg4.tmax +logic_test bool RO FALSE lg4.tmax-increased diff --git a/tests/halmodule/comp-set-get/expected b/tests/halmodule/comp-set-get/expected index 37c7b48be8d..1d5f8e6169a 100644 --- a/tests/halmodule/comp-set-get/expected +++ b/tests/halmodule/comp-set-get/expected @@ -19,10 +19,10 @@ set f 1 ok set f 1.0 ok set f 1 ok set f 89884656743115795386465259539451236680898848947115328636715040578866337902750481566354238661203768010560056939935696678829394884407208311246423715319737062188883946712432742638151109800623047059726541476042502884419075341171231440736956555270413618581675255342293149119973622969239858152417678164812112068608 ok -set s 2147483648 fail -set s -2147483649 fail +set s 2147483648 ok +set s -2147483649 ok set u -1 fail -set u 4294967296 fail +set u 4294967296 ok set f 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216 fail pincheck s True True True pincheck u True True True diff --git a/tests/halmodule/comp-set-get/test.py b/tests/halmodule/comp-set-get/test.py index 46d6d36b0f3..5a4db102b8f 100755 --- a/tests/halmodule/comp-set-get/test.py +++ b/tests/halmodule/comp-set-get/test.py @@ -4,8 +4,8 @@ h = hal.component("x") try: - ps = h.newpin("s", hal.HAL_S32, hal.Dir.OUT) - pu = h.newpin("u", hal.HAL_U32, hal.Dir.OUT) + ps = h.newpin("s", hal.Type.SINT, hal.Dir.OUT) + pu = h.newpin("u", hal.Type.UINT, hal.Dir.OUT) pf = h.newpin("f", hal.Type.REAL, hal.Dir.OUT) param = h.newparam("param", hal.Type.BOOL, hal.Dir.RW) h.ready() @@ -64,13 +64,13 @@ def pin_validate(i, t, d): print("pincheck {} {} {} {}".format( i.get_name(), i.is_pin(), i.get_type() == t, i.get_dir() == d)) - pin_validate(ps, hal.HAL_S32, hal.Dir.OUT) - pin_validate(pu, hal.HAL_U32, hal.Dir.OUT) + pin_validate(ps, hal.Type.SINT, hal.Dir.OUT) + pin_validate(pu, hal.Type.UINT, hal.Dir.OUT) pin_validate(pf, hal.Type.REAL, hal.Dir.OUT) pin = h.getitem("s") - pin_validate(pin, hal.HAL_S32, hal.Dir.OUT) + pin_validate(pin, hal.Type.SINT, hal.Dir.OUT) try: pin = h.getitem("not-found") print("{} {} {}".format("getitem", "not-found", "ok")) @@ -82,7 +82,7 @@ def pin_validate(i, t, d): pin_validate(param, hal.Type.BOOL, hal.Dir.RW) pin = h.getpin("s") - pin_validate(pin, hal.HAL_S32, hal.Dir.OUT) + pin_validate(pin, hal.Type.SINT, hal.Dir.OUT) param = h.getparam("param") pin_validate(param, hal.Type.BOOL, hal.Dir.RW) diff --git a/tests/halmodule/deprecated/deprecated.py b/tests/halmodule/deprecated/deprecated.py new file mode 100755 index 00000000000..d19a2d81a07 --- /dev/null +++ b/tests/halmodule/deprecated/deprecated.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import hal + +# These should all give a FutureWarning +a = hal.HAL_BIT +assert a == hal.Type.BOOL, "Bad BIT/BOOL" +a = hal.HAL_FLOAT +assert a == hal.Type.REAL, "Bad FLOAT/REAL" +a = hal.HAL_S32 +assert a == hal.Type.SINT, "Bad S32/SINT" +a = hal.HAL_U32 +assert a == hal.Type.UINT, "Bad U32/UINT" +a = hal.HAL_S64 +assert a == hal.Type.SINT, "Bad S64/SINT" +a = hal.HAL_U64 +assert a == hal.Type.UINT, "Bad U64/UINT" + diff --git a/tests/halmodule/deprecated/expected b/tests/halmodule/deprecated/expected new file mode 100644 index 00000000000..89f9c5896b8 --- /dev/null +++ b/tests/halmodule/deprecated/expected @@ -0,0 +1,12 @@ +FutureWarning: HAL_BIT has been deprecated. Please use the IntEnum type hal.Type.BOOL + a = hal.HAL_BIT +FutureWarning: HAL_FLOAT has been deprecated. Please use the IntEnum type hal.Type.REAL + a = hal.HAL_FLOAT +FutureWarning: HAL_S32 is no longer supported and replaced by hal.Type.SINT + a = hal.HAL_S32 +FutureWarning: HAL_U32 is no longer supported and replaced by hal.Type.UINT + a = hal.HAL_U32 +FutureWarning: HAL_S64 has been deprecated. Please use the IntEnum type hal.Type.SINT + a = hal.HAL_S64 +FutureWarning: HAL_U64 has been deprecated. Please use the IntEnum type hal.Type.UINT + a = hal.HAL_U64 diff --git a/tests/halmodule/deprecated/test.sh b/tests/halmodule/deprecated/test.sh new file mode 100755 index 00000000000..e75d5284c73 --- /dev/null +++ b/tests/halmodule/deprecated/test.sh @@ -0,0 +1,2 @@ +#!/bin/bash +./deprecated.py 2>&1 | sed -e's,^.*deprecated.py:[0-9]\+:\s*,,' diff --git a/tests/halmodule/halquery/expected b/tests/halmodule/halquery/expected index 18671b2942e..84bb9e1ef74 100644 --- a/tests/halmodule/halquery/expected +++ b/tests/halmodule/halquery/expected @@ -2,24 +2,24 @@ and2.0.in0 {'haltype': 'pin', 'name': 'and2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-a', 'comp': 'and2', 'comp_id': 'ID'} and2.0.in1 {'haltype': 'pin', 'name': 'and2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-b', 'comp': 'and2', 'comp_id': 'ID'} and2.0.out {'haltype': 'pin', 'name': 'and2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'and2', 'comp_id': 'ID'} -and2.0.time {'haltype': 'pin', 'name': 'and2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'and2', 'comp_id': 'ID'} +and2.0.time {'haltype': 'pin', 'name': 'and2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'and2', 'comp_id': 'ID'} or2.0.in0 {'haltype': 'pin', 'name': 'or2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-a', 'comp': 'or2', 'comp_id': 'ID'} or2.0.in1 {'haltype': 'pin', 'name': 'or2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-b', 'comp': 'or2', 'comp_id': 'ID'} or2.0.out {'haltype': 'pin', 'name': 'or2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-b', 'comp': 'or2', 'comp_id': 'ID'} -or2.0.time {'haltype': 'pin', 'name': 'or2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'or2', 'comp_id': 'ID'} +or2.0.time {'haltype': 'pin', 'name': 'or2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'or2', 'comp_id': 'ID'} testthread.threadbeat {'haltype': 'pin', 'name': 'testthread.threadbeat', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': '__testthread', 'comp_id': 'ID'} -testthread.time {'haltype': 'pin', 'name': 'testthread.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': '__testthread', 'comp_id': 'ID'} +testthread.time {'haltype': 'pin', 'name': 'testthread.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': '__testthread', 'comp_id': 'ID'} xor2.0.in0 {'haltype': 'pin', 'name': 'xor2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'xor2', 'comp_id': 'ID'} xor2.0.in1 {'haltype': 'pin', 'name': 'xor2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-b', 'comp': 'xor2', 'comp_id': 'ID'} xor2.0.out {'haltype': 'pin', 'name': 'xor2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-output', 'comp': 'xor2', 'comp_id': 'ID'} -xor2.0.time {'haltype': 'pin', 'name': 'xor2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'xor2', 'comp_id': 'ID'} +xor2.0.time {'haltype': 'pin', 'name': 'xor2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'xor2', 'comp_id': 'ID'} # Params -and2.0.tmax {'haltype': 'parameter', 'name': 'and2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'and2', 'comp_id': 'ID'} +and2.0.tmax {'haltype': 'parameter', 'name': 'and2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'and2', 'comp_id': 'ID'} and2.0.tmax-increased {'haltype': 'parameter', 'name': 'and2.0.tmax-increased', 'type': , 'dir': , 'value': False, 'alias': None, 'comp': 'and2', 'comp_id': 'ID'} -or2.0.tmax {'haltype': 'parameter', 'name': 'or2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'or2', 'comp_id': 'ID'} +or2.0.tmax {'haltype': 'parameter', 'name': 'or2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'or2', 'comp_id': 'ID'} or2.0.tmax-increased {'haltype': 'parameter', 'name': 'or2.0.tmax-increased', 'type': , 'dir': , 'value': False, 'alias': None, 'comp': 'or2', 'comp_id': 'ID'} -testthread.tmax {'haltype': 'parameter', 'name': 'testthread.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': '__testthread', 'comp_id': 'ID'} -xor2.0.tmax {'haltype': 'parameter', 'name': 'xor2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'xor2', 'comp_id': 'ID'} +testthread.tmax {'haltype': 'parameter', 'name': 'testthread.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': '__testthread', 'comp_id': 'ID'} +xor2.0.tmax {'haltype': 'parameter', 'name': 'xor2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'xor2', 'comp_id': 'ID'} xor2.0.tmax-increased {'haltype': 'parameter', 'name': 'xor2.0.tmax-increased', 'type': , 'dir': , 'value': False, 'alias': None, 'comp': 'xor2', 'comp_id': 'ID'} # Signals net-input-a {'haltype': 'signal', 'name': 'net-input-a', 'type': , 'value': False, 'writers': 0, 'readers': 2, 'bidirs': 0, 'driver': None} @@ -53,7 +53,7 @@ thread('does-not-exist') fails correctly signalpins('does-not-exist') fails correctly # Simple named queries Pin: {'haltype': 'pin', 'name': 'or2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-b', 'comp': 'or2', 'comp_id': 'ID'} -Param: {'haltype': 'parameter', 'name': 'testthread.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': '__testthread', 'comp_id': 'ID'} +Param: {'haltype': 'parameter', 'name': 'testthread.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': '__testthread', 'comp_id': 'ID'} Signal: {'haltype': 'signal', 'name': 'net-output', 'type': , 'value': False, 'writers': 1, 'readers': 0, 'bidirs': 0, 'driver': 'xor2.0.out'} Component: {'haltype': 'component', 'name': 'and2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'} Function: {'haltype': 'function', 'name': 'xor2.0', 'comp': 'xor2', 'comp_id': 'ID', 'users': 1, 'reentrant': False} diff --git a/tests/io-startup/test-ui.py b/tests/io-startup/test-ui.py index e818464510d..0ffd32d26d4 100755 --- a/tests/io-startup/test-ui.py +++ b/tests/io-startup/test-ui.py @@ -39,7 +39,7 @@ def wait_for_pin_value(pin_name, value, timeout=5.0): h = hal.component("test-ui") -h.newpin("tool-number", hal.HAL_S32, hal.Dir.IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) h.ready() # mark the component as 'ready' diff --git a/tests/limit3/constraints/test.hal b/tests/limit3/constraints/test.hal index c7eb9f85c68..9d916b2126b 100644 --- a/tests/limit3/constraints/test.hal +++ b/tests/limit3/constraints/test.hal @@ -25,13 +25,13 @@ net triangle <= siggen.0.triangle loadrt mux_generic config=ff8 -net sine => mux-gen.00.in-float-00 -net cosine => mux-gen.00.in-float-01 -net square => mux-gen.00.in-float-02 -net sawtooth => mux-gen.00.in-float-03 -net triangle => mux-gen.00.in-float-04 +net sine => mux-gen.00.in-real-00 +net cosine => mux-gen.00.in-real-01 +net square => mux-gen.00.in-real-02 +net sawtooth => mux-gen.00.in-real-03 +net triangle => mux-gen.00.in-real-04 -net input <= mux-gen.00.out-float +net input <= mux-gen.00.out-real # @@ -49,7 +49,7 @@ setp limit3.0.maxa 15800 net input => limit3.0.in net output <= limit3.0.out -net output => mux-gen.00.in-float-05 +net output => mux-gen.00.in-real-05 # @@ -70,7 +70,7 @@ net out-accel <= ddt.out-accel.out # This part cycles through the muxed signals. It uses a charge pump to # generate a high-frequency square wave, and an encoder in counter-mode, # with a large scale, to produce a slowly growing number (the encoder -# position). The encoder position is converted from a float to a u32, +# position). The encoder position is converted from a float to a uint, # and fed to the mux select pin. # @@ -88,10 +88,10 @@ encoder.0.position-scale = 500 net heartbeat => encoder.0.phase-A net encoder-position <= encoder.0.position -loadrt conv_float_u32 -net encoder-position => conv-float-u32.0.in +loadrt conv_real_uint +net encoder-position => conv-real-uint.0.in -net mux-select <= conv-float-u32.0.out +net mux-select <= conv-real-uint.0.out net mux-select => mux-gen.00.sel-int @@ -113,7 +113,7 @@ loadrt threads name1=t period1=1000000 addf charge-pump t addf encoder.update-counters t addf encoder.capture-position t -addf conv-float-u32.0 t +addf conv-real-uint.0 t addf siggen.0.update t addf mux-gen.00 t diff --git a/tests/mb2hal/mb2hal.1b/expected b/tests/mb2hal/mb2hal.1b/expected index 61a45c4a4c0..2d2ead72ebe 100644 --- a/tests/mb2hal/mb2hal.1b/expected +++ b/tests/mb2hal/mb2hal.1b/expected @@ -1,39 +1,39 @@ Component Pins: Owner Type Dir Value Name - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.00 - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.01 - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.02 - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.03 + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.00 + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.01 + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.02 + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.03 Component Pins: Owner Type Dir Value Name - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.00.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.00.int - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.01.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.01.int - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.02.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.02.int - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.03.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.03.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.00.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.00.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.01.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.01.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.02.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.02.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.03.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.03.int Component Pins: Owner Type Dir Value Name - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.00 - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.01 - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.02 - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.03 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.00 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.01 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.02 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.03 Component Pins: Owner Type Dir Value Name - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.00 - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.01 - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.02 - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.03 + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.00 + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.01 + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.02 + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.03 Component Pins: Owner Type Dir Value Name - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.00 - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.01 - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.02 - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.03 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.00 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.01 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.02 + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.03 diff --git a/tests/mb2hal/mb2hal.2b/expected b/tests/mb2hal/mb2hal.2b/expected index abbcbcb63f8..b2f959b0d5e 100644 --- a/tests/mb2hal/mb2hal.2b/expected +++ b/tests/mb2hal/mb2hal.2b/expected @@ -1,69 +1,69 @@ Component Pins: Owner Type Dir Value Name - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.00.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_02.00.bit-inv - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.01.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_02.01.bit-inv - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.02.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_02.02.bit-inv - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.03.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_02.03.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.00.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_02.00.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.01.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_02.01.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.02.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_02.02.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_02.03.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_02.03.bit-inv Component Pins: Owner Type Dir Value Name - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.00.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.00.int - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.01.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.01.int - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.02.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.02.int - (ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.03.float - (ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.03.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.00.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.00.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.01.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.01.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.02.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.02.int + (ignored comp id) real OUT 0 mb2hal.Modbus_fnct_03.03.float + (ignored comp id) sint OUT 0 mb2hal.Modbus_fnct_03.03.int Component Pins: Owner Type Dir Value Name - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.00.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_06.00.int - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.01.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_06.01.int - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.02.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_06.02.int - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.03.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_06.03.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.00.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_06.00.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.01.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_06.01.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.02.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_06.02.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_06.03.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_06.03.int Component Pins: Owner Type Dir Value Name - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.00.bit - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.01.bit - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.02.bit - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.03.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.00.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.01.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.02.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_15.03.bit Component Pins: Owner Type Dir Value Name - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.00.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_16.00.int - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.01.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_16.01.int - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.02.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_16.02.int - (ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.03.float - (ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_16.03.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.00.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_16.00.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.01.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_16.01.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.02.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_16.02.int + (ignored comp id) real IN 0 mb2hal.Modbus_fnct_16.03.float + (ignored comp id) sint IN 0 mb2hal.Modbus_fnct_16.03.int Component Pins: Owner Type Dir Value Name - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_01.00.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_01.00.bit-inv - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_01.01.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_01.01.bit-inv - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_01.02.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_01.02.bit-inv - (ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_01.03.bit - (ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_01.03.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_01.00.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_01.00.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_01.01.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_01.01.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_01.02.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_01.02.bit-inv + (ignored comp id) bool OUT FALSE mb2hal.Modbus_fnct_01.03.bit + (ignored comp id) bool OUT TRUE mb2hal.Modbus_fnct_01.03.bit-inv Component Pins: Owner Type Dir Value Name - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_05.00.bit - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_05.01.bit - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_05.02.bit - (ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_05.03.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_05.00.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_05.01.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_05.02.bit + (ignored comp id) bool IN FALSE mb2hal.Modbus_fnct_05.03.bit diff --git a/tests/motion/jogwheel-axis/test-ui.py b/tests/motion/jogwheel-axis/test-ui.py index 12fb6aa9473..052a8e2a6f8 100755 --- a/tests/motion/jogwheel-axis/test-ui.py +++ b/tests/motion/jogwheel-axis/test-ui.py @@ -61,17 +61,17 @@ def jog_axis(axis_letter, counts=1, scale=0.001): h = hal.component("test-ui") h.newpin("axis-x-jog-enable", hal.Type.BOOL, hal.Dir.OUT) -h.newpin("axis-x-jog-counts", hal.HAL_S32, hal.Dir.OUT) +h.newpin("axis-x-jog-counts", hal.Type.SINT, hal.Dir.OUT) h.newpin("axis-x-jog-scale", hal.Type.REAL, hal.Dir.OUT) h.newpin("axis-x-position", hal.Type.REAL, hal.Dir.IN) h.newpin("axis-y-jog-enable", hal.Type.BOOL, hal.Dir.OUT) -h.newpin("axis-y-jog-counts", hal.HAL_S32, hal.Dir.OUT) +h.newpin("axis-y-jog-counts", hal.Type.SINT, hal.Dir.OUT) h.newpin("axis-y-jog-scale", hal.Type.REAL, hal.Dir.OUT) h.newpin("axis-y-position", hal.Type.REAL, hal.Dir.IN) h.newpin("axis-z-jog-enable", hal.Type.BOOL, hal.Dir.OUT) -h.newpin("axis-z-jog-counts", hal.HAL_S32, hal.Dir.OUT) +h.newpin("axis-z-jog-counts", hal.Type.SINT, hal.Dir.OUT) h.newpin("axis-z-jog-scale", hal.Type.REAL, hal.Dir.OUT) h.newpin("axis-z-position", hal.Type.REAL, hal.Dir.IN) diff --git a/tests/motion/jogwheel-joint/test-ui.py b/tests/motion/jogwheel-joint/test-ui.py index fbedfc8e6f9..9ac0d33a104 100755 --- a/tests/motion/jogwheel-joint/test-ui.py +++ b/tests/motion/jogwheel-joint/test-ui.py @@ -76,17 +76,17 @@ def jog_joint(joint_number, counts=1, scale=0.001): h = hal.component("test-ui") h.newpin("joint-0-jog-enable", hal.Type.BOOL, hal.Dir.OUT) -h.newpin("joint-0-jog-counts", hal.HAL_S32, hal.Dir.OUT) +h.newpin("joint-0-jog-counts", hal.Type.SINT, hal.Dir.OUT) h.newpin("joint-0-jog-scale", hal.Type.REAL, hal.Dir.OUT) h.newpin("joint-0-position", hal.Type.REAL, hal.Dir.IN) h.newpin("joint-1-jog-enable", hal.Type.BOOL, hal.Dir.OUT) -h.newpin("joint-1-jog-counts", hal.HAL_S32, hal.Dir.OUT) +h.newpin("joint-1-jog-counts", hal.Type.SINT, hal.Dir.OUT) h.newpin("joint-1-jog-scale", hal.Type.REAL, hal.Dir.OUT) h.newpin("joint-1-position", hal.Type.REAL, hal.Dir.IN) h.newpin("joint-2-jog-enable", hal.Type.BOOL, hal.Dir.OUT) -h.newpin("joint-2-jog-counts", hal.HAL_S32, hal.Dir.OUT) +h.newpin("joint-2-jog-counts", hal.Type.SINT, hal.Dir.OUT) h.newpin("joint-2-jog-scale", hal.Type.REAL, hal.Dir.OUT) h.newpin("joint-2-position", hal.Type.REAL, hal.Dir.IN) diff --git a/tests/mux/expected b/tests/mux/expected index 5b8ef33feec..4403fedcd37 100644 --- a/tests/mux/expected +++ b/tests/mux/expected @@ -19,25 +19,25 @@ 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 0 1.110000 0 0 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 0 1.110000 0 0 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 0 1.110000 0 0 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 2.220000 1 1 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 1 3.330000 0 2 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 1 3.330000 0 2 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 1 3.330000 0 2 @@ -58,21 +58,21 @@ 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 0 3.330000 0 2 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 0 3.330000 0 2 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 0 3.330000 0 2 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 0 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 -1 1.000000 1 1 1 5000000000.001000 2147483647 4294967295 1 -100.000000 -100 0 1 4294967295.000000 2147483647 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 0 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 +1 1.000000 1 1 1 5000000000.001000 5000000000 5000000000 1 -100.000000 -100 0 1 4294967295.000000 4294967295 4294967295 1 4.440000 1 3 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 1 5.550000 0 4 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 1 5.550000 0 4 0 0.000000 0 0 0 0.000000 0 0 1 -999.000000 -999 0 0 0.000000 0 0 1 5.550000 0 4 diff --git a/tests/mux/test.hal b/tests/mux/test.hal index ee1c4e18b93..5cd72d1d369 100644 --- a/tests/mux/test.hal +++ b/tests/mux/test.hal @@ -25,20 +25,20 @@ addf mux-gen.16 slow addf mux-gen.17 slow addf sampler.0 slow -net v0 mux-gen.00.in-bit-00 mux-gen.01.in-bit-00 mux-gen.02.in-bit-00 mux-gen.03.in-bit-00 mux-gen.16.in-bit-00 -net v1 mux-gen.04.in-float-00 mux-gen.05.in-float-00 mux-gen.06.in-float-00 mux-gen.07.in-float-00 -net v2 mux-gen.08.in-s32-00 mux-gen.09.in-s32-00 mux-gen.10.in-s32-00 mux-gen.11.in-s32-00 -net v3 mux-gen.12.in-u32-00 mux-gen.13.in-u32-00 mux-gen.14.in-u32-00 mux-gen.15.in-u32-00 +net v0 mux-gen.00.in-bool-00 mux-gen.01.in-bool-00 mux-gen.02.in-bool-00 mux-gen.03.in-bool-00 mux-gen.16.in-bool-00 +net v1 mux-gen.04.in-real-00 mux-gen.05.in-real-00 mux-gen.06.in-real-00 mux-gen.07.in-real-00 +net v2 mux-gen.08.in-sint-00 mux-gen.09.in-sint-00 mux-gen.10.in-sint-00 mux-gen.11.in-sint-00 +net v3 mux-gen.12.in-uint-00 mux-gen.13.in-uint-00 mux-gen.14.in-uint-00 mux-gen.15.in-uint-00 -net v4 mux-gen.00.in-bit-01 mux-gen.01.in-bit-01 mux-gen.02.in-bit-01 mux-gen.03.in-bit-01 mux-gen.16.in-bit-01 -net v5 mux-gen.04.in-float-01 mux-gen.05.in-float-01 mux-gen.06.in-float-01 mux-gen.07.in-float-01 -net v6 mux-gen.08.in-s32-01 mux-gen.09.in-s32-01 mux-gen.10.in-s32-01 mux-gen.11.in-s32-01 -net v7 mux-gen.12.in-u32-01 mux-gen.13.in-u32-01 mux-gen.14.in-u32-01 mux-gen.15.in-u32-01 +net v4 mux-gen.00.in-bool-01 mux-gen.01.in-bool-01 mux-gen.02.in-bool-01 mux-gen.03.in-bool-01 mux-gen.16.in-bool-01 +net v5 mux-gen.04.in-real-01 mux-gen.05.in-real-01 mux-gen.06.in-real-01 mux-gen.07.in-real-01 +net v6 mux-gen.08.in-sint-01 mux-gen.09.in-sint-01 mux-gen.10.in-sint-01 mux-gen.11.in-sint-01 +net v7 mux-gen.12.in-uint-01 mux-gen.13.in-uint-01 mux-gen.14.in-uint-01 mux-gen.15.in-uint-01 -net sel mux-gen.00.sel-bit-00 mux-gen.01.sel-bit-00 mux-gen.02.sel-bit-00 mux-gen.03.sel-bit-00 -net sel mux-gen.04.sel-bit-00 mux-gen.05.sel-bit-00 mux-gen.06.sel-bit-00 mux-gen.07.sel-bit-00 -net sel mux-gen.08.sel-bit-00 mux-gen.09.sel-bit-00 mux-gen.10.sel-bit-00 mux-gen.11.sel-bit-00 -net sel mux-gen.12.sel-bit-00 mux-gen.13.sel-bit-00 mux-gen.14.sel-bit-00 mux-gen.15.sel-bit-00 +net sel mux-gen.00.sel-bit-00 mux-gen.01.sel-bit-00 mux-gen.02.sel-bit-00 mux-gen.03.sel-bit-00 +net sel mux-gen.04.sel-bit-00 mux-gen.05.sel-bit-00 mux-gen.06.sel-bit-00 mux-gen.07.sel-bit-00 +net sel mux-gen.08.sel-bit-00 mux-gen.09.sel-bit-00 mux-gen.10.sel-bit-00 mux-gen.11.sel-bit-00 +net sel mux-gen.12.sel-bit-00 mux-gen.13.sel-bit-00 mux-gen.14.sel-bit-00 mux-gen.15.sel-bit-00 net sel mux-gen.16.sel-bit-00 sets v0 0 @@ -52,33 +52,33 @@ sets v7 0xFFFFFFFF setp mux-gen.16.debounce-us 4000 -setp mux-gen.17.in-float-00 1.11 -setp mux-gen.17.in-float-01 2.22 -setp mux-gen.17.in-float-02 3.33 -setp mux-gen.17.in-float-03 4.44 -setp mux-gen.17.in-float-04 5.55 +setp mux-gen.17.in-real-00 1.11 +setp mux-gen.17.in-real-01 2.22 +setp mux-gen.17.in-real-02 3.33 +setp mux-gen.17.in-real-03 4.44 +setp mux-gen.17.in-real-04 5.55 net sel streamer.0.pin.0 sampler.0.pin.18 net u streamer.0.pin.1 sampler.0.pin.19 mux-gen.17.sel-int -net o0 mux-gen.00.out-bit sampler.0.pin.0 -net o1 mux-gen.01.out-float sampler.0.pin.1 -net o2 mux-gen.02.out-s32 sampler.0.pin.2 -net o3 mux-gen.03.out-u32 sampler.0.pin.3 -net o4 mux-gen.04.out-bit sampler.0.pin.4 -net o5 mux-gen.05.out-float sampler.0.pin.5 -net o6 mux-gen.06.out-s32 sampler.0.pin.6 -net o7 mux-gen.07.out-u32 sampler.0.pin.7 -net o8 mux-gen.08.out-bit sampler.0.pin.8 -net o9 mux-gen.09.out-float sampler.0.pin.9 -net o10 mux-gen.10.out-s32 sampler.0.pin.10 -net o11 mux-gen.11.out-u32 sampler.0.pin.11 -net o12 mux-gen.12.out-bit sampler.0.pin.12 -net o13 mux-gen.13.out-float sampler.0.pin.13 -net o14 mux-gen.14.out-s32 sampler.0.pin.14 -net o15 mux-gen.15.out-u32 sampler.0.pin.15 -net o16 mux-gen.16.out-bit sampler.0.pin.16 -net o17 mux-gen.17.out-float sampler.0.pin.17 +net o0 mux-gen.00.out-bool sampler.0.pin.0 +net o1 mux-gen.01.out-real sampler.0.pin.1 +net o2 mux-gen.02.out-sint sampler.0.pin.2 +net o3 mux-gen.03.out-uint sampler.0.pin.3 +net o4 mux-gen.04.out-bool sampler.0.pin.4 +net o5 mux-gen.05.out-real sampler.0.pin.5 +net o6 mux-gen.06.out-sint sampler.0.pin.6 +net o7 mux-gen.07.out-uint sampler.0.pin.7 +net o8 mux-gen.08.out-bool sampler.0.pin.8 +net o9 mux-gen.09.out-real sampler.0.pin.9 +net o10 mux-gen.10.out-sint sampler.0.pin.10 +net o11 mux-gen.11.out-uint sampler.0.pin.11 +net o12 mux-gen.12.out-bool sampler.0.pin.12 +net o13 mux-gen.13.out-real sampler.0.pin.13 +net o14 mux-gen.14.out-sint sampler.0.pin.14 +net o15 mux-gen.15.out-uint sampler.0.pin.15 +net o16 mux-gen.16.out-bool sampler.0.pin.16 +net o17 mux-gen.17.out-real sampler.0.pin.17 loadusr halstreamer input-signals loadusr -w sleep 0.5 diff --git a/tests/pyvcp/expected b/tests/pyvcp/expected index fcbcdb67b5f..b8dd870993d 100644 --- a/tests/pyvcp/expected +++ b/tests/pyvcp/expected @@ -1,24 +1,24 @@ -mypanel float OUT 0 mypanel.dial-a-out -mypanel float OUT 0 mypanel.dial-b-out -mypanel float IN 0 mypanel.dial-c-in -mypanel float OUT 0 mypanel.dial-c-out -mypanel float OUT 0 mypanel.dial.0.out -mypanel float IN 0 mypanel.dial.0.param_pin -mypanel float IN 0 mypanel.dial.1.param_pin -mypanel float IN 0 mypanel.dial.2.param_pin -mypanel float OUT 0 mypanel.scale-a-out-f -mypanel s32 OUT 0 mypanel.scale-a-out-i -mypanel float OUT 0 mypanel.scale-b-out-f -mypanel s32 OUT 0 mypanel.scale-b-out-i -mypanel float IN 0 mypanel.scale-c-in -mypanel float OUT 0 mypanel.scale-c-out-f -mypanel s32 OUT 0 mypanel.scale-c-out-i -mypanel float OUT 0 mypanel.scale.0-f -mypanel s32 OUT 0 mypanel.scale.0-i -mypanel float IN 0 mypanel.scale.2.param_pin -mypanel float OUT 0 mypanel.spinbox-a-out -mypanel float OUT 0 mypanel.spinbox-b-out -mypanel float IN 0 mypanel.spinbox-c-in -mypanel float OUT 0 mypanel.spinbox-c-out -mypanel float OUT 0 mypanel.spinbox.0 -mypanel float IN 0 mypanel.spinbox.2.param_pin +mypanel real OUT 0 mypanel.dial-a-out +mypanel real OUT 0 mypanel.dial-b-out +mypanel real IN 0 mypanel.dial-c-in +mypanel real OUT 0 mypanel.dial-c-out +mypanel real OUT 0 mypanel.dial.0.out +mypanel real IN 0 mypanel.dial.0.param_pin +mypanel real IN 0 mypanel.dial.1.param_pin +mypanel real IN 0 mypanel.dial.2.param_pin +mypanel real OUT 0 mypanel.scale-a-out-f +mypanel sint OUT 0 mypanel.scale-a-out-i +mypanel real OUT 0 mypanel.scale-b-out-f +mypanel sint OUT 0 mypanel.scale-b-out-i +mypanel real IN 0 mypanel.scale-c-in +mypanel real OUT 0 mypanel.scale-c-out-f +mypanel sint OUT 0 mypanel.scale-c-out-i +mypanel real OUT 0 mypanel.scale.0-f +mypanel sint OUT 0 mypanel.scale.0-i +mypanel real IN 0 mypanel.scale.2.param_pin +mypanel real OUT 0 mypanel.spinbox-a-out +mypanel real OUT 0 mypanel.spinbox-b-out +mypanel real IN 0 mypanel.spinbox-c-in +mypanel real OUT 0 mypanel.spinbox-c-out +mypanel real OUT 0 mypanel.spinbox.0 +mypanel real IN 0 mypanel.spinbox.2.param_pin diff --git a/tests/raster/rastertest.py b/tests/raster/rastertest.py index 4605672698e..9ab7ce83e97 100755 --- a/tests/raster/rastertest.py +++ b/tests/raster/rastertest.py @@ -193,14 +193,14 @@ def main(): 'position': c.newpin("position", hal.Type.REAL, hal.Dir.OUT), 'output': c.newpin("output", hal.Type.REAL, hal.Dir.IN), 'offset': c.newpin("offset", hal.Type.REAL, hal.Dir.IN), - 'bpp': c.newpin("bpp", hal.HAL_S32, hal.Dir.IN), + 'bpp': c.newpin("bpp", hal.Type.SINT, hal.Dir.IN), 'ppu': c.newpin("ppu", hal.Type.REAL, hal.Dir.IN), - 'count': c.newpin("count", hal.HAL_S32, hal.Dir.IN), + 'count': c.newpin("count", hal.Type.SINT, hal.Dir.IN), 'fault': c.newpin("fault", hal.Type.BOOL, hal.Dir.IN), - 'fault_code': c.newpin("fault-code", hal.HAL_S32, hal.Dir.IN), - 'state': c.newpin("state", hal.HAL_S32, hal.Dir.IN), + 'fault_code': c.newpin("fault-code", hal.Type.SINT, hal.Dir.IN), + 'state': c.newpin("state", hal.Type.SINT, hal.Dir.IN), 'bitmap_position': c.newpin("bitmap-position", hal.Type.REAL, hal.Dir.IN), - 'current_pixel_index': c.newpin("current-pixel-index", hal.HAL_S32, hal.Dir.IN), + 'current_pixel_index': c.newpin("current-pixel-index", hal.Type.SINT, hal.Dir.IN), 'current_pixel_value': c.newpin("current-pixel-value", hal.Type.REAL, hal.Dir.IN), 'previous_pixel_value': c.newpin("previous-pixel-value", hal.Type.REAL, hal.Dir.IN), 'fraction': c.newpin("fraction", hal.Type.REAL, hal.Dir.IN), diff --git a/tests/save.0/expected b/tests/save.0/expected index 833c015c198..6b849eb5e0c 100644 --- a/tests/save.0/expected +++ b/tests/save.0/expected @@ -6,20 +6,20 @@ loadrt sampler cfg=bb depth=4096 # pin aliases # param aliases # signals -newsig unlinked bit +newsig unlinked bool # nets net dir stepgen.0.dir => sampler.0.pin.0 net step stepgen.0.step => sampler.0.pin.1 # parameter values setp fast.tmax 0 setp sampler.0.tmax 0 -setp stepgen.0.dirhold 0x00000001 -setp stepgen.0.dirsetup 0x00000001 +setp stepgen.0.dirhold 0x0000000000000001 +setp stepgen.0.dirsetup 0x0000000000000001 setp stepgen.0.maxaccel 2 setp stepgen.0.maxvel 0.15 setp stepgen.0.position-scale 32000 -setp stepgen.0.steplen 0x00000001 -setp stepgen.0.stepspace 0x00000001 +setp stepgen.0.steplen 0x0000000000000001 +setp stepgen.0.stepspace 0x0000000000000001 setp stepgen.capture-position.tmax 0 setp stepgen.make-pulses.tmax 0 setp stepgen.update-freq.tmax 0 diff --git a/tests/tlo/test-ui.py b/tests/tlo/test-ui.py index 5c8bee90b14..42fe9390895 100755 --- a/tests/tlo/test-ui.py +++ b/tests/tlo/test-ui.py @@ -114,7 +114,7 @@ def verify_tool(tool, x, y, z, a, b, c, u, v, w, diameter, front_angle, back_ang h = hal.component("python-ui") -h.newpin("tool-number", hal.HAL_S32, hal.Dir.IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) h.ready() # mark the component as 'ready' diff --git a/tests/tool-info/non-random/test-ui.py b/tests/tool-info/non-random/test-ui.py index b87ee9e05bb..917cfaac0f9 100755 --- a/tests/tool-info/non-random/test-ui.py +++ b/tests/tool-info/non-random/test-ui.py @@ -127,9 +127,9 @@ def wait_for_hal_pin(pin_name, value, timeout=10): h = hal.component("test-ui") -h.newpin("tool-number", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.Dir.IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) h.newpin("tool-prepare", hal.Type.BOOL, hal.Dir.IN) h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) h.newpin("tool-change", hal.Type.BOOL, hal.Dir.IN) diff --git a/tests/tool-info/random-no-startup-tool/test-ui.py b/tests/tool-info/random-no-startup-tool/test-ui.py index be69f2516b3..4f4f0a25af5 100755 --- a/tests/tool-info/random-no-startup-tool/test-ui.py +++ b/tests/tool-info/random-no-startup-tool/test-ui.py @@ -127,9 +127,9 @@ def wait_for_hal_pin(pin_name, value, timeout=10): h = hal.component("test-ui") -h.newpin("tool-number", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.Dir.IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) h.newpin("tool-prepare", hal.Type.BOOL, hal.Dir.IN) h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) h.newpin("tool-change", hal.Type.BOOL, hal.Dir.IN) diff --git a/tests/tool-info/random-with-startup-tool/test-ui.py b/tests/tool-info/random-with-startup-tool/test-ui.py index de4c00a3943..af906bf82b5 100755 --- a/tests/tool-info/random-with-startup-tool/test-ui.py +++ b/tests/tool-info/random-with-startup-tool/test-ui.py @@ -127,9 +127,9 @@ def wait_for_hal_pin(pin_name, value, timeout=10): h = hal.component("test-ui") -h.newpin("tool-number", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.Dir.IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) h.newpin("tool-prepare", hal.Type.BOOL, hal.Dir.IN) h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) h.newpin("tool-change", hal.Type.BOOL, hal.Dir.IN) diff --git a/tests/toolchanger/abort-during-change/test-ui.py b/tests/toolchanger/abort-during-change/test-ui.py index a3cd56a859f..44e93081404 100755 --- a/tests/toolchanger/abort-during-change/test-ui.py +++ b/tests/toolchanger/abort-during-change/test-ui.py @@ -121,16 +121,16 @@ def do_tool_change_handshake(): h = hal.component("python-ui") -h.newpin("tool-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.HAL_IN) -h.newpin("tool-from-pocket", hal.HAL_S32, hal.HAL_IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-from-pocket", hal.Type.SINT, hal.Dir.IN) -h.newpin("tool-prepare", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-prepared", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("tool-prepare", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) -h.newpin("tool-change", hal.HAL_BIT, hal.HAL_IN) -h.newpin("tool-changed", hal.HAL_BIT, hal.HAL_OUT) +h.newpin("tool-change", hal.Type.BOOL, hal.Dir.IN) +h.newpin("tool-changed", hal.Type.BOOL, hal.Dir.OUT) h.ready() diff --git a/tests/toolchanger/m61/test-ui.py b/tests/toolchanger/m61/test-ui.py index 0bc7e78315f..025cc58a36d 100755 --- a/tests/toolchanger/m61/test-ui.py +++ b/tests/toolchanger/m61/test-ui.py @@ -125,10 +125,10 @@ def do_tool_change_handshake(tool_number, pocket_number): h = hal.component("python-ui") -h.newpin("tool-number", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-from-pocket", hal.HAL_S32, hal.Dir.IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-from-pocket", hal.Type.SINT, hal.Dir.IN) h.newpin("tool-prepare", hal.Type.BOOL, hal.Dir.IN) h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) diff --git a/tests/toolchanger/reload-tool/non-random/test-ui.py b/tests/toolchanger/reload-tool/non-random/test-ui.py index ac887ba7bcf..fca46c3e9f6 100755 --- a/tests/toolchanger/reload-tool/non-random/test-ui.py +++ b/tests/toolchanger/reload-tool/non-random/test-ui.py @@ -47,10 +47,10 @@ def wait_for_hal_pin(name, value, timeout=10): h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) h["tool-prepared"] = False -h.newpin("tool-number", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-from-pocket", hal.HAL_S32, hal.Dir.IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-from-pocket", hal.Type.SINT, hal.Dir.IN) h.ready() diff --git a/tests/toolchanger/reload-tool/random/test-ui.py b/tests/toolchanger/reload-tool/random/test-ui.py index 29f3aa56b2c..22509af932d 100755 --- a/tests/toolchanger/reload-tool/random/test-ui.py +++ b/tests/toolchanger/reload-tool/random/test-ui.py @@ -47,10 +47,10 @@ def wait_for_hal_pin(name, value, timeout=10): h.newpin("tool-prepared", hal.Type.BOOL, hal.Dir.OUT) h["tool-prepared"] = False -h.newpin("tool-number", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-prep-number", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-prep-pocket", hal.HAL_S32, hal.Dir.IN) -h.newpin("tool-from-pocket", hal.HAL_S32, hal.Dir.IN) +h.newpin("tool-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-number", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-prep-pocket", hal.Type.SINT, hal.Dir.IN) +h.newpin("tool-from-pocket", hal.Type.SINT, hal.Dir.IN) h.ready() diff --git a/tests/trajectory-planner/circular-arcs/configs/vcp.xml b/tests/trajectory-planner/circular-arcs/configs/vcp.xml index ae91989fc32..97840d2001c 100644 --- a/tests/trajectory-planner/circular-arcs/configs/vcp.xml +++ b/tests/trajectory-planner/circular-arcs/configs/vcp.xml @@ -171,28 +171,28 @@ "Cycle Time" ("Helvetica",14) - + "time-hours" ("Helvetica",14) "2d" - + - + "time-minutes" ("Helvetica",14) "2d" - + - + "time-seconds" ("Helvetica",14) "2d" - +