__`-out-reset` (bit) (only for `-out` pins) TRUE if this pin should be reset when the `-reset` function is executed.
-* `parport.`____`.reset-time` (U32) The time (in nanoseconds) between a pin is set by `-write` and reset by the `-reset` function if it is enabled.
+* `parport.`__
__`.reset-time` (UINT) The time (in nanoseconds) between a pin is set by `-write` and reset by the `-reset` function if it is enabled.
The `-invert` parameter determines whether an output pin is active high or active low.
If `-invert` is FALSE, setting the HAL `-out` pin TRUE drives the physical pin high, and FALSE drives it low.
diff --git a/docs/src/man/man1/halcompile.1.adoc b/docs/src/man/man1/halcompile.1.adoc
index c06cd1b8688..a2d45589cc4 100644
--- a/docs/src/man/man1/halcompile.1.adoc
+++ b/docs/src/man/man1/halcompile.1.adoc
@@ -73,6 +73,8 @@ components.
Extra arguments passed to the C-compiler.
*--extra-link-args*=_args_::
Extra arguments passed to the linker.
+*-w*,*--werror*::
+Treat warnings as errors.
== DESCRIPTION
diff --git a/docs/src/man/man1/mesambccc.1.adoc b/docs/src/man/man1/mesambccc.1.adoc
index 04790753bbf..a5867515f4e 100644
--- a/docs/src/man/man1/mesambccc.1.adoc
+++ b/docs/src/man/man1/mesambccc.1.adoc
@@ -65,19 +65,19 @@ clamped to the acceptable range.
A subset of the Modbus functions is supported (with function number in parentheses):
* `R_COILS` (`1`):
- Maps to 1..2000 HAL output pins of type 'HAL_BIT'.
+ Maps to 1..2000 HAL output pins of type 'HAL_BOOL'.
* `R_INPUTS` (`2`):
- Maps to 1..2000 HAL output pins of type 'HAL_BIT'.
+ Maps to 1..2000 HAL output pins of type 'HAL_BOOL'.
* `R_REGISTERS` (`3`):
Maps to 1..125 HAL output pins depending 'haltype' and 'scale' attributes.
* `R_INPUTREGS` (`4`):
Maps to 1..125 HAL output pins depending 'haltype' and 'scale' attributes.
* `W_COIL` (`5`):
- Maps to single HAL input pin of type 'HAL_BIT'.
+ Maps to single HAL input pin of type 'HAL_BOOL'.
* `W_REGISTER` (`6`):
Maps to single HAL input pins depending 'haltype' and 'scale' attributes.
* `W_COILS` (`15`):
- Maps to 1..2000 HAL input pins of type 'HAL_BIT'.
+ Maps to 1..2000 HAL input pins of type 'HAL_BOOL'.
* `W_REGISTERS` (`16`):
Maps to 1..125 HAL input pins depending 'haltype' and 'scale' attributes.
@@ -395,20 +395,18 @@ Recognized '//' attributes:
A '' in the '' section maps to one or more HAL pins with
specific type using the 'haltype' attribute. Recognized are:
-* 'HAL_BIT'
-* 'HAL_FLOAT'
-* 'HAL_S32'
-* 'HAL_U32'
-* 'HAL_S64'
-* 'HAL_U64'
+* 'BOOL', 'HAL_BOOL'
+* 'REAL', 'HAL_REAL'
+* 'SINT', 'HAL_SINT'
+* 'UINT', 'HAL_UINT'
The types are also recognized without the HAL_ prefix. Note that coil and
binary input functions `R_COILS` (`1`), `R_INPUTS` (`2`), `W_COIL` (`5`)
-and `W_COILS` (`15`) can only map to 'HAL_BIT' and do so implicitly.
+and `W_COILS` (`15`) can only map to 'HAL_BOOL' and do so implicitly.
-The 'HAL_BIT', 'HAL_U32' and 'HAL_U64' types always map to one single HAL pin.
+The 'HAL_BOOL' and 'HAL_UINT' types always map to one single HAL pin.
-The 'HAL_FLOAT', 'HAL_S32' and 'HAL_S64' types can generate one single pin or
+The 'HAL_REAL' and 'HAL_SINT' types can generate one single pin or
can generate multiple pins with 'offset' and 'scale'. Output pins
with `R_REGISTERS` (`3`) and `R_INPUTREGS` (`4`) can add a 'scaled' pin to
the set.
@@ -416,10 +414,18 @@ the set.
Mapping HAL pins to commands requires a 'modbustype' attribute to encode the
format and necessary conversions. Register functions `R_REGISTERS` (`3`),
`R_INPUTREGS` (`4`), `W_REGISTER` (`6`) and `W_REGISTERS` (`16`) may map
-to 'HAL_BIT' only when using unsigned 'modbustype' where a value of zero (0)
+to 'HAL_BOOL' only when using unsigned 'modbustype' where a value of zero (0)
is _false_ and any other value is _true_ for write functions or one (1) for
read functions.
+[NOTE]
+====
+The old 'haltype' values 'HAL_BIT', 'HAL_FLOAT', 'HAL_S32', 'HAL_U32',
+ 'HAL_S64' and 'HAL_U64' are still recognized for compatibility. They map to
+ 'HAL_BOOL', 'HAL_REAL', 'HAL_SINT', 'HAL_UINT', 'HAL_SINT' and 'HAL_UINT'
+respectively.
+====
+
===
The '' section defines one or more '' tags to describe the
Modbus function(s) to execute in a periodical way. Each '' tag maps to
@@ -448,14 +454,14 @@ writes at the specified interval.
----
- Type is implicit HAL_BIT, will become HAL pins:
+ Type is implicit HAL_BOOL, will become HAL pins:
- (out) hm2_modbus.0.wavebox.state-00
- (out) hm2_modbus.0.wavebox.state-01
- (out) hm2_modbus.0.wavebox.state-02
- (out) hm2_modbus.0.wavebox.state-03
-
Too much will kill you...
@@ -469,7 +475,7 @@ writes at the specified interval.
- Will create HAL_BIT pins:
+ Will create HAL_BOOL pins:
- (in) hm2_modbus.0.anyandall-00
- (in) hm2_modbus.0.anyandall-01
The bcanswer flag signifies that a device erroneously sends a reply on
@@ -478,10 +484,10 @@ writes at the specified interval.
-
- 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/motion.9.adoc b/docs/src/man/man9/motion.9.adoc
index 43859fcef14..c49305905ad 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,34 +233,34 @@ 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 may be
required to synchronize task and motion before and after changes to
the pin value.
-*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
@@ -269,10 +269,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)
@@ -280,30 +280,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]
@@ -313,52 +313,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
@@ -367,97 +367,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::
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
@@ -480,63 +480,63 @@ 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::
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::
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
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/builtin-panels/gtk_little_probe/gtk_little_probe.py b/lib/python/gladevcp/builtin-panels/gtk_little_probe/gtk_little_probe.py
index 918d63a08b2..7f790cf2d7b 100644
--- a/lib/python/gladevcp/builtin-panels/gtk_little_probe/gtk_little_probe.py
+++ b/lib/python/gladevcp/builtin-panels/gtk_little_probe/gtk_little_probe.py
@@ -149,27 +149,27 @@ def __init__(self, halcomp,builder,useropts):
self.halcomp = hal.component("probe")
- self.halcomp.newpin( "ps_searchvel", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_probevel", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_z_clearance", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_probe_max", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_probe_latch", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_probe_diam", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_xy_clearance", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_edge_lenght", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_offs_x", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_offs_y", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_offs_z", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_offs_angle", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "set_zero", hal.HAL_BIT, hal.HAL_OUT )
+ self.halcomp.newpin( "ps_searchvel", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_probevel", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_z_clearance", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_probe_max", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_probe_latch", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_probe_diam", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_xy_clearance", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_edge_lenght", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_offs_x", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_offs_y", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_offs_z", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_offs_angle", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "set_zero", hal.Type.BOOL, hal.Dir.OUT )
if self.chk_set_zero.get_active():
self.halcomp["set_zero"] = True
self.hal_led_set_zero.hal_pin.set(1)
- self.halcomp.newpin( "auto_rott", hal.HAL_BIT, hal.HAL_OUT )
+ self.halcomp.newpin( "auto_rott", hal.Type.BOOL, hal.Dir.OUT )
if self.chk_auto_rott.get_active():
self.halcomp["auto_rott"] = True
self.hal_led_auto_rott.hal_pin.set(1)
- self.halcomp.newpin( "ps_error", hal.HAL_FLOAT, hal.HAL_OUT )
+ self.halcomp.newpin( "ps_error", hal.Type.REAL, hal.Dir.OUT )
self.spbtn1_search_vel.set_value( self.prefs.getpref( "ps_searchvel", 300.0, float ) )
self.spbtn1_probe_vel.set_value( self.prefs.getpref( "ps_probevel", 10.0, float ) )
self.spbtn1_z_clearance.set_value( self.prefs.getpref( "ps_z_clearance", 3.0, float ) )
diff --git a/lib/python/gladevcp/builtin-panels/gtk_verser_probe/gtk_verser_probe.py b/lib/python/gladevcp/builtin-panels/gtk_verser_probe/gtk_verser_probe.py
index ff3bfdf9700..b538e0b26d2 100644
--- a/lib/python/gladevcp/builtin-panels/gtk_verser_probe/gtk_verser_probe.py
+++ b/lib/python/gladevcp/builtin-panels/gtk_verser_probe/gtk_verser_probe.py
@@ -151,27 +151,27 @@ def __init__(self, halcomp,builder,useropts):
self.halcomp = hal.component("probe")
- self.halcomp.newpin( "ps_searchvel", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_probevel", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_z_clearance", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_probe_max", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_probe_latch", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_probe_diam", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_xy_clearance", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_edge_lenght", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_offs_x", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_offs_y", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_offs_z", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "ps_offs_angle", hal.HAL_FLOAT, hal.HAL_OUT )
- self.halcomp.newpin( "set_zero", hal.HAL_BIT, hal.HAL_OUT )
+ self.halcomp.newpin( "ps_searchvel", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_probevel", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_z_clearance", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_probe_max", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_probe_latch", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_probe_diam", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_xy_clearance", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_edge_lenght", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_offs_x", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_offs_y", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_offs_z", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "ps_offs_angle", hal.Type.REAL, hal.Dir.OUT )
+ self.halcomp.newpin( "set_zero", hal.Type.BOOL, hal.Dir.OUT )
if self.chk_set_zero.get_active():
self.halcomp["set_zero"] = True
self.hal_led_set_zero.hal_pin.set(1)
- self.halcomp.newpin( "auto_rott", hal.HAL_BIT, hal.HAL_OUT )
+ self.halcomp.newpin( "auto_rott", hal.Type.BOOL, hal.Dir.OUT )
if self.chk_auto_rott.get_active():
self.halcomp["auto_rott"] = True
self.hal_led_auto_rott.hal_pin.set(1)
- self.halcomp.newpin( "ps_error", hal.HAL_FLOAT, hal.HAL_OUT )
+ self.halcomp.newpin( "ps_error", hal.Type.REAL, hal.Dir.OUT )
self.spbtn1_search_vel.set_value( self.prefs.getpref( "ps_searchvel", 300.0, float ) )
self.spbtn1_probe_vel.set_value( self.prefs.getpref( "ps_probevel", 10.0, float ) )
self.spbtn1_z_clearance.set_value( self.prefs.getpref( "ps_z_clearance", 3.0, float ) )
diff --git a/lib/python/gladevcp/core.py b/lib/python/gladevcp/core.py
index fd34bda79c4..260112051a0 100644
--- a/lib/python/gladevcp/core.py
+++ b/lib/python/gladevcp/core.py
@@ -5,7 +5,6 @@
from gi.repository import GObject
import inspect
-import _hal
import hal
import traceback
diff --git a/lib/python/gladevcp/hal_bar.py b/lib/python/gladevcp/hal_bar.py
index db83c789f15..2040e4efc89 100644
--- a/lib/python/gladevcp/hal_bar.py
+++ b/lib/python/gladevcp/hal_bar.py
@@ -221,7 +221,7 @@ def get_value_diff(self, value):
def _hal_init(self):
_HalWidgetBase._hal_init(self)
- self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_FLOAT, hal.HAL_IN)
+ self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.REAL, hal.Dir.IN)
self.hal_pin.connect('value-changed', lambda p: self.set_value(p.value))
self.hal_pin.connect('value-changed', lambda s: self.emit('hal-pin-changed', s))
diff --git a/lib/python/gladevcp/hal_graph.py b/lib/python/gladevcp/hal_graph.py
index 70eab5f2812..661f4afacc4 100644
--- a/lib/python/gladevcp/hal_graph.py
+++ b/lib/python/gladevcp/hal_graph.py
@@ -111,7 +111,7 @@ def __init__(self):
def _hal_init(self):
_HalWidgetBase._hal_init(self)
- self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_FLOAT, hal.HAL_IN)
+ self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.REAL, hal.Dir.IN)
def tick_poll(self, idx):
if self.tick_idx != idx:
diff --git a/lib/python/gladevcp/hal_lightbutton.py b/lib/python/gladevcp/hal_lightbutton.py
index b83ddff4087..f9ede93e68d 100644
--- a/lib/python/gladevcp/hal_lightbutton.py
+++ b/lib/python/gladevcp/hal_lightbutton.py
@@ -375,16 +375,16 @@ def _hal_init(self):
self.set_active(False)
if (self.button_halio_pin):
- self.button_pin = self.hal.newpin(self.hal_name+'-button', hal.HAL_BIT, hal.HAL_IO)
+ self.button_pin = self.hal.newpin(self.hal_name+'-button', hal.Type.BOOL, hal.Dir.IO)
self.button_pin.connect('value-changed', self.button_pin_update)
else:
- self.button_pin = self.hal.newpin(self.hal_name+'-button', hal.HAL_BIT, hal.HAL_OUT)
- self.button_pin_not = self.hal.newpin(self.hal_name+'-button-not', hal.HAL_BIT, hal.HAL_OUT)
+ self.button_pin = self.hal.newpin(self.hal_name+'-button', hal.Type.BOOL, hal.Dir.OUT)
+ self.button_pin_not = self.hal.newpin(self.hal_name+'-button-not', hal.Type.BOOL, hal.Dir.OUT)
if (self.create_enable_pin):
- self.enable_pin = self.hal.newpin(self.hal_name+'-enable', hal.HAL_BIT, hal.HAL_IN)
+ self.enable_pin = self.hal.newpin(self.hal_name+'-enable', hal.Type.BOOL, hal.Dir.IN)
self.enable_pin.connect('value-changed', self.enable_pin_update)
- self.light_pin = self.hal.newpin(self.hal_name+'-light', hal.HAL_BIT, hal.HAL_IN)
+ self.light_pin = self.hal.newpin(self.hal_name+'-light', hal.Type.BOOL, hal.Dir.IN)
self.light_pin.connect('value-changed', self.light_pin_update)
def button_pin_update(self, hal_pin, data=None):
diff --git a/lib/python/gladevcp/hal_meter.py b/lib/python/gladevcp/hal_meter.py
index 017743fc163..8744058a6c6 100644
--- a/lib/python/gladevcp/hal_meter.py
+++ b/lib/python/gladevcp/hal_meter.py
@@ -87,7 +87,7 @@ def __init__(self):
def _hal_init(self):
_HalWidgetBase._hal_init(self)
- self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_FLOAT, hal.HAL_IN)
+ self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.REAL, hal.Dir.IN)
self.hal_pin.connect('value-changed', lambda p: self.set_value(p.value))
self.hal_pin.connect('value-changed', lambda s: self.emit('hal-pin-changed', s))
diff --git a/lib/python/gladevcp/hal_widgets.py b/lib/python/gladevcp/hal_widgets.py
index fa33745f03c..ddb18f0a9e9 100644
--- a/lib/python/gladevcp/hal_widgets.py
+++ b/lib/python/gladevcp/hal_widgets.py
@@ -41,8 +41,8 @@ def hal_update(self):
class _HalToggleBase(_HalWidgetBase):
def _hal_init(self):
self.set_active(False)
- self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_BIT, hal.HAL_OUT)
- self.hal_pin_not = self.hal.newpin(self.hal_name + "-not", hal.HAL_BIT, hal.HAL_OUT)
+ self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.BOOL, hal.Dir.OUT)
+ self.hal_pin_not = self.hal.newpin(self.hal_name + "-not", hal.Type.BOOL, hal.Dir.OUT)
self.connect("toggled", self.hal_update)
def hal_update(self, *a):
@@ -52,8 +52,8 @@ def hal_update(self, *a):
class _HalScaleBase(_HalWidgetBase):
def _hal_init(self):
- self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_FLOAT, hal.HAL_OUT)
- self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.HAL_S32, hal.HAL_OUT)
+ 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.Type.SINT, hal.Dir.OUT)
self.connect("value-changed", self.hal_update)
def hal_update(self, *a):
@@ -62,7 +62,7 @@ def hal_update(self, *a):
class _HalIOScaleBase(_HalWidgetBase):
def _hal_init(self):
- self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_FLOAT, hal.HAL_IO)
+ self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.REAL, hal.Dir.IO)
self.connect("value-changed", self.hal_update)
self.hal_pin.connect('value-changed', lambda s: self.emit('hal-pin-changed', s))
self.hal_current = self.hal_pin.get()
@@ -80,21 +80,21 @@ def hal_update(self, *a):
class _HalSensitiveBase(_HalWidgetBase):
def _hal_init(self):
- self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_BIT, hal.HAL_IN)
+ self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.BOOL, hal.Dir.IN)
self.hal_pin.connect('value-changed', lambda s: self.set_sensitive(s.value))
self.hal_pin.connect('value-changed', lambda s: self.emit('hal-pin-changed', s))
class _HalJogWheelBase(_HalWidgetBase):
def _hal_init(self):
- self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_S32, hal.HAL_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.HAL_FLOAT, hal.HAL_OUT)
+ self.hal_pin_scaled = self.hal.newpin(self.hal_name+'-scaled', hal.Type.REAL, hal.Dir.OUT)
except:
pass
try:
self.get_delta_scaled_value()
- self.hal_pin_delta_scaled = self.hal.newpin(self.hal_name+'-delta-scaled', hal.HAL_FLOAT, hal.HAL_OUT)
+ self.hal_pin_delta_scaled = self.hal.newpin(self.hal_name+'-delta-scaled', hal.Type.REAL, hal.Dir.OUT)
except:
pass
@@ -114,7 +114,7 @@ def hal_update(self, *a):
class _HalSpeedControlBase(_HalWidgetBase):
def _hal_init(self):
- self.hal_pin = self.hal.newpin(self.hal_name + '.value', hal.HAL_FLOAT, hal.HAL_OUT)
+ self.hal_pin = self.hal.newpin(self.hal_name + '.value', hal.Type.REAL, hal.Dir.OUT)
self.connect("value-changed", self.hal_update)
def hal_update(self, *a):
@@ -134,7 +134,7 @@ class HAL_HideTable(Gtk.Grid, _HalWidgetBase):
__gsignals__ = dict([hal_pin_changed_signal])
def _hal_init(self):
- self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_BIT, hal.HAL_IN)
+ self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.BOOL, hal.Dir.IN)
self.hal_pin.connect('value-changed',self.update)
def update(self,*a):
@@ -166,8 +166,8 @@ def do_set_property(self, property, value):
raise AttributeError('unknown property %s' % property.name)
def _hal_init(self):
- self.hal_pin_f = self.hal.newpin(self.hal_name+"-f", hal.HAL_FLOAT, hal.HAL_OUT)
- self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.HAL_S32, hal.HAL_OUT)
+ 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.Type.SINT, hal.Dir.OUT)
self.connect("changed", self.hal_update)
def hal_update(self, *a):
@@ -184,7 +184,7 @@ class HAL_Button(Gtk.Button, _HalWidgetBase):
__gtype_name__ = "HAL_Button"
def _hal_init(self):
- self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_BIT, hal.HAL_OUT)
+ self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.BOOL, hal.Dir.OUT)
def _f(w, data):
self.hal_pin.set(data)
self.connect("pressed", _f, True)
@@ -196,7 +196,7 @@ class HALIO_Button(Gtk.ToggleButton, _HalWidgetBase):
def _hal_init(self):
self.set_active(False)
- self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_BIT, hal.HAL_IO)
+ self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.BOOL, hal.Dir.IO)
def _f(w, data):
self.set_active(True)
self.hal_pin.set(data)
@@ -219,8 +219,8 @@ def hal_update(self, *a):
self.hal_pin_s.set(int(data))
def _hal_init(self):
- self.hal_pin_f = self.hal.newpin(self.hal_name+"-f", hal.HAL_FLOAT, hal.HAL_OUT)
- self.hal_pin_s = self.hal.newpin(self.hal_name+"-s", hal.HAL_S32, hal.HAL_OUT)
+ 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.Type.SINT, hal.Dir.OUT)
self.connect("value-changed", self.hal_update)
self.emit("value-changed")
@@ -278,8 +278,8 @@ def do_set_property(self, property, value):
raise AttributeError('unknown property %s' % property.name)
def _hal_init(self):
- self.hal_pin = self.hal.newpin(self.hal_name, hal.HAL_FLOAT, hal.HAL_IN)
- self.hal_pin_scale = self.hal.newpin(self.hal_name+".scale", hal.HAL_FLOAT, hal.HAL_IN)
+ self.hal_pin = self.hal.newpin(self.hal_name, hal.Type.REAL, hal.Dir.IN)
+ self.hal_pin_scale = self.hal.newpin(self.hal_name+".scale", hal.Type.REAL, hal.Dir.IN)
if self.yellow_limit or self.red_limit:
self.set_fraction(0)
self.modify_bg(Gtk.STATE_PRELIGHT, Gdk.Color.parse('#0f0')[1])
@@ -349,14 +349,14 @@ def do_set_property(self, property, value):
def _hal_init(self):
- types = {0:hal.HAL_S32
- ,1:hal.HAL_FLOAT
- ,2:hal.HAL_U32
+ types = {0:hal.Type.SINT
+ ,1:hal.Type.REAL
+ ,2:hal.Type.UINT
}
pin_type = types.get(self.label_pin_type, None)
if pin_type is None:
raise TypeError("%s: Invalid pin type: %s" % (self.hal_name, self.label_pin_type))
- self.hal_pin = self.hal.newpin(self.hal_name, pin_type, hal.HAL_IN)
+ self.hal_pin = self.hal.newpin(self.hal_name, pin_type, hal.Dir.IN)
self.hal_pin.connect('value-changed',
lambda p: self.set_text(self.text_template % p.value))
self.hal_pin.connect('value-changed', lambda s: self.emit('hal-pin-changed', s))
diff --git a/lib/python/gladevcp/jogwheel.py b/lib/python/gladevcp/jogwheel.py
index 1b762226bb3..e1ccebc5679 100644
--- a/lib/python/gladevcp/jogwheel.py
+++ b/lib/python/gladevcp/jogwheel.py
@@ -96,7 +96,7 @@ def __init__(self, size = 200, cpr = 40):
# init the hal pin management
def _hal_init(self):
_HalJogWheelBase._hal_init(self)
- self.hal_pin_scale = self.hal.newpin(self.hal_name+".scale", hal.HAL_FLOAT, hal.HAL_IN)
+ self.hal_pin_scale = self.hal.newpin(self.hal_name+".scale", hal.Type.REAL, hal.Dir.IN)
self.hal_pin_scale.set(1.0)
# This function is called from hal_widgets.py
diff --git a/lib/python/gladevcp/speedcontrol.py b/lib/python/gladevcp/speedcontrol.py
index 332f025ab0d..61db15711db 100755
--- a/lib/python/gladevcp/speedcontrol.py
+++ b/lib/python/gladevcp/speedcontrol.py
@@ -162,17 +162,17 @@ def _update_widget(self):
def _hal_init(self):
_HalSpeedControlBase._hal_init(self)
# the scale, as the widget may show units per minute, but linuxcnc expects units per second
- self.hal_pin_scale = self.hal.newpin(self.hal_name+".scale", hal.HAL_FLOAT, hal.HAL_IN)
+ self.hal_pin_scale = self.hal.newpin(self.hal_name+".scale", hal.Type.REAL, hal.Dir.IN)
self.hal_pin_scale.connect("value-changed", self._on_scale_changed)
self.hal_pin_scale.set(60.0)
# the scaled value to be handled in hal
- self.hal_pin_scaled_value = self.hal.newpin(self.hal_name+".scaled-value", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.hal_pin_scaled_value = self.hal.newpin(self.hal_name+".scaled-value", hal.Type.REAL, hal.Dir.OUT)
# pins to allow hardware button to be connected to the software button
- self.hal_pin_increase = self.hal.newpin(self.hal_name+".increase", hal.HAL_BIT, hal.HAL_IN)
+ self.hal_pin_increase = self.hal.newpin(self.hal_name+".increase", hal.Type.BOOL, hal.Dir.IN)
self.hal_pin_increase.connect("value-changed", self._on_plus_changed)
- self.hal_pin_decrease = self.hal.newpin(self.hal_name+".decrease", hal.HAL_BIT, hal.HAL_IN)
+ self.hal_pin_decrease = self.hal.newpin(self.hal_name+".decrease", hal.Type.BOOL, hal.Dir.IN)
self.hal_pin_decrease.connect("value-changed", self._on_minus_changed)
# this draws our widget on the screen
diff --git a/lib/python/hal.py b/lib/python/hal.py
index 68fa796eebc..0fa81b63991 100644
--- a/lib/python/hal.py
+++ b/lib/python/hal.py
@@ -11,8 +11,8 @@
import hal, time
h = hal.component("component-name")
# create pins and parameters with calls to h.newpin and h.newparam
-h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN)
-h.newpin("out", hal.HAL_FLOAT, hal.HAL_OUT)
+h.newpin("in", hal.Type.REAL, hal.Dir.IN)
+h.newpin("out", hal.Type.REAL, hal.Dir.OUT)
h.ready() # mark the component as 'ready'
try:
@@ -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 46dba0388bb..bc618ddb4b4 100644
--- a/lib/python/pyvcp_widgets.py
+++ b/lib/python/pyvcp_widgets.py
@@ -59,7 +59,7 @@
class pyvcp_dial(Canvas):
# Dial widget by tomp
- """ A dial that outputs a HAL_FLOAT
+ """ A dial that outputs a HAL_REAL
reacts to both mouse-wheel and mouse dragging
[ 376 ]
@@ -202,11 +202,11 @@ def __init__(self,root,pycomp,halpin=None,halparam=None,param_pin=0,size=200,cpr
if halparam == None:
halparam = "dial." + str(pyvcp_dial.n) + ".param_pin"
self.halparam=halparam
- pycomp.newpin(halparam, HAL_FLOAT, HAL_IN)
+ pycomp.newpin(halparam, Type.REAL, Dir.IN)
pyvcp_dial.n += 1
self.pycomp=pycomp
- pycomp.newpin(halpin, HAL_FLOAT, HAL_OUT)
+ pycomp.newpin(halpin, Type.REAL, Dir.OUT)
pycomp[self.halparam] = self.origValue
self.oldValue = self.origValue
@@ -402,7 +402,7 @@ def __init__(self,root,pycomp,halpin=None, size=200,text=None,subtext=None,min_=
if halpin == None:
self.halpin = "meter."+str(pyvcp_meter.n)+".value"
pyvcp_meter.n += 1
- pycomp.newpin(self.halpin, HAL_FLOAT, HAL_IN)
+ pycomp.newpin(self.halpin, Type.REAL, Dir.IN)
self.value = pycomp[self.halpin]
def rad2deg(self, rad): return rad*180/math.pi
@@ -464,7 +464,7 @@ def draw_ticks(self):
# -------------------------------------------
class pyvcp_jogwheel(Canvas):
- """" A jogwheel that outputs a HAL_FLOAT count
+ """" A jogwheel that outputs a HAL_REAL count
reacts to both mouse-wheel and mouse dragging
[ 33 ] (counts per revolution)
@@ -550,7 +550,7 @@ def __init__(self,root,pycomp,halpin=None,text=None,clear_pin=0,scale_pin=0,
halpin = "jogwheel."+str(pyvcp_jogwheel.n) + name
pyvcp_jogwheel.n += 1
self.halpin=halpin
- pycomp.newpin(halpin, HAL_FLOAT, HAL_OUT)
+ pycomp.newpin(halpin, Type.REAL, Dir.OUT)
pycomp[self.halpin] = self.count
self.pycomp=pycomp
@@ -561,13 +561,13 @@ def __init__(self,root,pycomp,halpin=None,text=None,clear_pin=0,scale_pin=0,
name = ".reset"
clear_pin = halpin + name
self.clear_pin = clear_pin
- pycomp.newpin(clear_pin, HAL_BIT, HAL_IN)
+ pycomp.newpin(clear_pin, Type.BOOL, Dir.IN)
if scale_pin!=0:
name = ".scale"
scale_pin = halpin + name
self.scale_pin = scale_pin
- pycomp.newpin(scale_pin, HAL_FLOAT, HAL_IN)
+ pycomp.newpin(scale_pin, Type.REAL, Dir.IN)
def update_jogscale(self):
if self.scale_pin:
@@ -694,7 +694,7 @@ def __init__(self,master,pycomp,halpin=None,initval=0,orient=None,choices=[],**k
if n==initval:
b.select()
c_halpin=halpin+"."+str(c)
- pycomp.newpin(c_halpin, HAL_BIT, HAL_OUT)
+ pycomp.newpin(c_halpin, Type.BOOL, Dir.OUT)
self.halpins.append(c_halpin)
n+=1
@@ -743,7 +743,7 @@ def __init__(self,master,pycomp,halpin=None,disable_pin=False,**kw):
pyvcp_label.n += 1
halpin_disable = halpin+".disable"
self.halpin_disable = halpin_disable
- pycomp.newpin(halpin_disable, HAL_BIT, HAL_IN)
+ pycomp.newpin(halpin_disable, Type.BOOL, Dir.IN)
def update(self,pycomp):
if self.disable_pin:
@@ -783,7 +783,7 @@ def __init__(self,master,pycomp,halpin=None,disable_pin=False,legends=[],initval
n=0
for c in legends:
c_halpin=halpin+".legend"+str(n)
- pycomp.newpin(c_halpin, HAL_BIT, HAL_IN)
+ pycomp.newpin(c_halpin, Type.BOOL, Dir.IN)
self.halpins.append(c_halpin)
n+=1
#limit to 6 legends
@@ -795,7 +795,7 @@ def __init__(self,master,pycomp,halpin=None,disable_pin=False,legends=[],initval
if disable_pin:
halpin_disable = halpin+".disable"
self.halpin_disable = halpin_disable
- pycomp.newpin(halpin_disable, HAL_BIT, HAL_IN)
+ pycomp.newpin(halpin_disable, Type.BOOL, Dir.IN)
# test for out of range initval number
if initval >= 0 and initval <= self.num_pins :
@@ -983,7 +983,7 @@ def __init__(self,master,pycomp,halpin=None, halparam=None,param_pin=0,
if halparam == None:
halparam = "spinbox." + str(pyvcp_spinbox.n) + ".param_pin"
self.halparam=halparam
- pycomp.newpin(halparam, HAL_FLOAT, HAL_IN)
+ pycomp.newpin(halparam, Type.REAL, Dir.IN)
pyvcp_spinbox.n += 1
@@ -1005,7 +1005,7 @@ def __init__(self,master,pycomp,halpin=None, halparam=None,param_pin=0,
self.min_=min_
self.resolution=resolution
self.v.set( str( self.format % {'b':self.value} ) )
- pycomp.newpin(halpin, HAL_FLOAT, HAL_OUT)
+ pycomp.newpin(halpin, Type.REAL, Dir.OUT)
self.bind('',self.wheel_up)
self.bind('',self.wheel_down)
@@ -1064,7 +1064,7 @@ def __init__(self,master,pycomp,halpin=None,format="2.1f",**kw):
self.value=0.0
dummy = "%(b)"+self.format
self.v.set( str( dummy % {'b':self.value} ) )
- pycomp.newpin(halpin, HAL_FLOAT, HAL_IN)
+ pycomp.newpin(halpin, Type.REAL, Dir.IN)
def update(self,pycomp):
newvalue = pycomp[self.halpin]
@@ -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, HAL_IN)
+ pycomp.newpin(halpin, Type.UINT, Dir.IN)
def update(self,pycomp):
newvalue = pycomp[self.halpin]
@@ -1112,7 +1112,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, HAL_IN)
+ pycomp.newpin(halpin, Type.SINT, Dir.IN)
def update(self,pycomp):
newvalue = pycomp[self.halpin]
@@ -1137,10 +1137,10 @@ def __init__(self,master,pycomp,halpin=None,**kw):
pyvcp_timer.n += 1
self.halpins=[]
c_halpin=halpin+".reset"
- pycomp.newpin(c_halpin, HAL_BIT, HAL_IN)
+ pycomp.newpin(c_halpin, Type.BOOL, Dir.IN)
self.halpins.append(c_halpin)
c_halpin=halpin+".run"
- pycomp.newpin(c_halpin, HAL_BIT, HAL_IN)
+ pycomp.newpin(c_halpin, Type.BOOL, Dir.IN)
self.halpins.append(c_halpin)
self.resetvalue=0
@@ -1231,7 +1231,7 @@ def __init__(self,master,pycomp,fillcolor="green",bgcolor="grey",
self.startval=min_
self.format = "%" + format
- pycomp.newpin(halpin, HAL_FLOAT, HAL_IN)
+ pycomp.newpin(halpin, Type.REAL, Dir.IN)
self.value=0.0 # some dummy value to start with
@@ -1346,11 +1346,11 @@ def __init__(self,master,pycomp, halpin=None,disable_pin=False,
halpin = "led."+str(pyvcp_led.n)
pyvcp_led.n+=1
self.halpin=halpin
- pycomp.newpin(halpin, HAL_BIT, HAL_IN)
+ pycomp.newpin(halpin, Type.BOOL, Dir.IN)
if disable_pin:
halpin_disable = halpin+".disable"
self.halpin_disable = halpin_disable
- pycomp.newpin(halpin_disable, HAL_BIT, HAL_IN)
+ pycomp.newpin(halpin_disable, Type.BOOL, Dir.IN)
def update(self,pycomp):
@@ -1396,11 +1396,11 @@ def __init__(self,master,pycomp, halpin=None,disable_pin=False,
halpin = "led."+str(pyvcp_led.n)
pyvcp_led.n+=1
self.halpin=halpin
- pycomp.newpin(halpin, HAL_BIT, HAL_IN)
+ pycomp.newpin(halpin, Type.BOOL, Dir.IN)
if disable_pin:
halpin_disable = halpin+".disable"
self.halpin_disable = halpin_disable
- pycomp.newpin(halpin_disable, HAL_BIT, HAL_IN)
+ pycomp.newpin(halpin_disable, Type.BOOL, Dir.IN)
def update(self,pycomp):
@@ -1441,10 +1441,10 @@ def __init__(self,master,pycomp,halpin=None,initval=0,**kw):
if halpin == None:
halpin = "checkbutton."+str(pyvcp_checkbutton.n)
self.halpin=halpin
- pycomp.newpin(halpin, HAL_BIT, HAL_OUT)
+ pycomp.newpin(halpin, Type.BOOL, Dir.OUT)
changepin = halpin + ".changepin"
self.changepin=changepin
- pycomp.newpin(changepin, HAL_BIT, HAL_IN)
+ pycomp.newpin(changepin, Type.BOOL, Dir.IN)
pycomp[self.changepin] = 0
pyvcp_checkbutton.n += 1
@@ -1493,11 +1493,11 @@ def __init__(self,master,pycomp,halpin=None,disable_pin=False,**kw):
halpin = "button."+str(pyvcp_button.n)
pyvcp_button.n += 1
self.halpin=halpin
- pycomp.newpin(halpin, HAL_BIT, HAL_OUT)
+ pycomp.newpin(halpin, Type.BOOL, Dir.OUT)
self.disable_pin = disable_pin
if not disable_pin == False:
halpin_disable = halpin + ".disable"
- pycomp.newpin(halpin_disable, HAL_BIT, HAL_IN)
+ pycomp.newpin(halpin_disable, Type.BOOL, Dir.IN)
self.halpin_disable=halpin_disable
self.state=0;
self.bind("", self.pressed)
@@ -1564,12 +1564,12 @@ def __init__(self,master,pycomp,
if halparam == None:
halparam = "scale."+str(pyvcp_scale.n)+".param_pin"
self.halparam=halparam
- pycomp.newpin(halparam, HAL_FLOAT, HAL_IN)
+ pycomp.newpin(halparam, Type.REAL, Dir.IN)
pyvcp_scale.n += 1
- pycomp.newpin(halpin+"-i", HAL_S32, HAL_OUT)
- pycomp.newpin(halpin+"-f", HAL_FLOAT, HAL_OUT)
+ pycomp.newpin(halpin+"-i", Type.SINT, Dir.OUT)
+ pycomp.newpin(halpin+"-f", Type.REAL, Dir.OUT)
self.bind('',self.wheel_up)
self.bind('',self.wheel_down)
@@ -1764,7 +1764,7 @@ def __init__(self, master, pycomp, images, halpin=None, **kw):
self.halpin = halpin
self.value = 0
self.last = None
- pycomp.newpin(halpin, self.pintype, HAL_IN)
+ pycomp.newpin(halpin, self.pintype, Dir.IN)
def update(self, pycomp):
l = pycomp[self.halpin]
@@ -1776,9 +1776,9 @@ def update(self, pycomp):
self.last = l
class pyvcp_image_bit(_pyvcp_image):
- pintype = HAL_BIT
+ 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/core.py b/lib/python/qtvcp/core.py
index d893f645c9c..f293484d731 100644
--- a/lib/python/qtvcp/core.py
+++ b/lib/python/qtvcp/core.py
@@ -5,7 +5,6 @@
from gi.repository import GObject
import inspect
-import _hal
import hal
import traceback
from qtpy.QtCore import QObject, QTimer, Signal
diff --git a/lib/python/qtvcp/lib/message.py b/lib/python/qtvcp/lib/message.py
index 3cc844b7034..825552a3153 100644
--- a/lib/python/qtvcp/lib/message.py
+++ b/lib/python/qtvcp/lib/message.py
@@ -65,18 +65,18 @@ def message_setup(self, hal_comp, window=None, notify=None):
# this is how we make a pin that can be connected to a callback
if ("none" in details):
- D._halpin = self.HAL_GCOMP_.newpin(name, hal.HAL_BIT, hal.HAL_IN)
+ D._halpin = self.HAL_GCOMP_.newpin(name, hal.Type.BOOL, hal.Dir.IN)
else:
- D._halpin = self.HAL_GCOMP_.newpin(name, hal.HAL_BIT, hal.HAL_IO)
+ D._halpin = self.HAL_GCOMP_.newpin(name, hal.Type.BOOL, hal.Dir.IO)
D._halpin.value_changed.connect(self.messageCallback(self['dialog-{}'.format(name)],
D._halpin, name, boldtext, text, pinname, details, icon))
if ("dialog" in details) and not ("nonedialog" in details):
- self.HAL_GCOMP_.newpin(name + "-waiting", hal.HAL_BIT, hal.HAL_OUT)
+ self.HAL_GCOMP_.newpin(name + "-waiting", hal.Type.BOOL, hal.Dir.OUT)
if not ("ok" in details):
- self.HAL_GCOMP_.newpin(name + "-response", hal.HAL_BIT, hal.HAL_OUT)
- self.HAL_GCOMP_.newpin(name + "-response-s32", hal.HAL_S32, hal.HAL_OUT)
+ self.HAL_GCOMP_.newpin(name + "-response", hal.Type.BOOL, 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,13 +88,13 @@ 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.HAL_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, ))
if ("dialog" in details) and not ("nonedialog" in details):
- self.HAL_GCOMP_.newpin(name + "-waiting", hal.HAL_BIT, hal.HAL_OUT)
+ self.HAL_GCOMP_.newpin(name + "-waiting", hal.Type.BOOL, hal.Dir.OUT)
# This weird code is so we can get access to proper variables.
# using clicked.connect( self.on_printmessage(pin,name,bt,t,c) ) apparently doesn't easily
diff --git a/lib/python/qtvcp/lib/qt_vismach/fanuc_200f.py b/lib/python/qtvcp/lib/qt_vismach/fanuc_200f.py
index bc540a84763..ae22fdb0bc7 100755
--- a/lib/python/qtvcp/lib/qt_vismach/fanuc_200f.py
+++ b/lib/python/qtvcp/lib/qt_vismach/fanuc_200f.py
@@ -27,14 +27,14 @@
BASEPATH = os.path.join(os.path.dirname(__file__), 'fanuc_200f_obj')
c = hal.component("fanuc_200f")
-c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint6", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("grip", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("plotclear", hal.HAL_BIT, hal.HAL_IN)
+c.newpin("joint1", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint2", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint3", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint4", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint5", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint6", hal.Type.REAL, hal.Dir.IN)
+c.newpin("grip", hal.Type.REAL, hal.Dir.IN)
+c.newpin("plotclear", hal.Type.BOOL, hal.Dir.IN)
c.ready()
diff --git a/lib/python/qtvcp/lib/qt_vismach/gantry_5axis.py b/lib/python/qtvcp/lib/qt_vismach/gantry_5axis.py
index dd290e695c1..aee2fad223b 100755
--- a/lib/python/qtvcp/lib/qt_vismach/gantry_5axis.py
+++ b/lib/python/qtvcp/lib/qt_vismach/gantry_5axis.py
@@ -41,14 +41,14 @@ def coords(self):
return -self.comp.tool_length, r, 0, r
c = hal.component("5axisgui")
-c.newpin("jx", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("jy", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("jz", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("jb", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("jc", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tool_length", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tool_diam", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("pivot_len", hal.HAL_FLOAT, hal.HAL_OUT)
+c.newpin("jx", hal.Type.REAL, hal.Dir.IN)
+c.newpin("jy", hal.Type.REAL, hal.Dir.IN)
+c.newpin("jz", hal.Type.REAL, hal.Dir.IN)
+c.newpin("jb", hal.Type.REAL, hal.Dir.IN)
+c.newpin("jc", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tool_length", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tool_diam", hal.Type.REAL, hal.Dir.IN)
+c.newpin("pivot_len", hal.Type.REAL, hal.Dir.OUT)
c["pivot_len"] = pivot_len
c.ready()
diff --git a/lib/python/qtvcp/lib/qt_vismach/millturn.py b/lib/python/qtvcp/lib/qt_vismach/millturn.py
index 438755e61d4..b5211ed749f 100755
--- a/lib/python/qtvcp/lib/qt_vismach/millturn.py
+++ b/lib/python/qtvcp/lib/qt_vismach/millturn.py
@@ -19,18 +19,18 @@
# add joints. Mill has 3.
c = hal.component("millturngui")
# follow ZYX directly
-#c.newpin("jointX", hal.HAL_FLOAT, hal.HAL_IN)
-#c.newpin("jointY", hal.HAL_FLOAT, hal.HAL_IN)
-#c.newpin("jointZ", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("jointA", hal.HAL_FLOAT, hal.HAL_IN)
+#c.newpin("jointX", hal.Type.REAL, hal.Dir.IN)
+#c.newpin("jointY", hal.Type.REAL, hal.Dir.IN)
+#c.newpin("jointZ", hal.Type.REAL, hal.Dir.IN)
+c.newpin("jointA", hal.Type.REAL, hal.Dir.IN)
# kinematics pins
-c.newpin("millkins", hal.HAL_BIT, hal.HAL_IN)
+c.newpin("millkins", hal.Type.BOOL, hal.Dir.IN)
# tool length and diameter pins?
-c.newpin("toollength", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tooldiameter", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tool-x-offset", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("toollength", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tooldiameter", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tool-x-offset", hal.Type.REAL, hal.Dir.IN)
# tells loadusr pins is ready
c.ready()
diff --git a/lib/python/qtvcp/qt_halobjects.py b/lib/python/qtvcp/qt_halobjects.py
index 64b5bb0d28e..38846757bc9 100644
--- a/lib/python/qtvcp/qt_halobjects.py
+++ b/lib/python/qtvcp/qt_halobjects.py
@@ -114,16 +114,21 @@ def get_name(self):
return self._a[0]
class _QHal(object):
- HAL_BIT = hal.HAL_BIT
- HAL_FLOAT = hal.HAL_FLOAT
- HAL_S32 = hal.HAL_S32
- HAL_U32 = hal.HAL_U32
-
- HAL_IN = hal.HAL_IN
- HAL_OUT = hal.HAL_OUT
- HAL_IO = hal.HAL_IO
- HAL_RO = hal.HAL_RO
- HAL_RW = hal.HAL_RW
+ HAL_BOOL = hal.Type.BOOL
+ HAL_REAL = hal.Type.REAL
+ HAL_SINT = hal.Type.SINT
+ HAL_UINT = hal.Type.UINT
+
+ HAL_BIT = hal.Type.BOOL # Deprecated
+ HAL_FLOAT = hal.Type.REAL # Deprecated
+ 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
+ HAL_IO = hal.Dir.IO
+ HAL_RO = hal.Dir.RO
+ HAL_RW = hal.Dir.RW
def __new__(cls, *a, **kw):
instance = super(_QHal, cls).__new__(cls)
diff --git a/lib/python/qtvcp/widgets/axis_tool_button.py b/lib/python/qtvcp/widgets/axis_tool_button.py
index d2c58f7a55b..20411a62bdc 100644
--- a/lib/python/qtvcp/widgets/axis_tool_button.py
+++ b/lib/python/qtvcp/widgets/axis_tool_button.py
@@ -131,8 +131,8 @@ def homed_on_test():
else:
pname = self._pin_name_
- self.hal_pin_joint = self.HAL_GCOMP_.newpin(str(pname + '-joint'), hal.HAL_BIT, hal.HAL_OUT)
- self.hal_pin_axis = self.HAL_GCOMP_.newpin(str(pname + '-axis'), hal.HAL_BIT, hal.HAL_OUT)
+ self.hal_pin_joint = self.HAL_GCOMP_.newpin(str(pname + '-joint'), hal.Type.BOOL, hal.Dir.OUT)
+ self.hal_pin_axis = self.HAL_GCOMP_.newpin(str(pname + '-axis'), hal.Type.BOOL, hal.Dir.OUT)
STATUS.connect('general',self.return_value)
def _enableGroup(self, state,bstate):
diff --git a/lib/python/qtvcp/widgets/bar.py b/lib/python/qtvcp/widgets/bar.py
index 36a1a83020a..1d59c283c2b 100644
--- a/lib/python/qtvcp/widgets/bar.py
+++ b/lib/python/qtvcp/widgets/bar.py
@@ -408,8 +408,10 @@ def resetVert(self):
class HALPinType(enum.IntEnum):
NONE = 0
- S32 = hal.HAL_S32
- FLOAT = hal.HAL_FLOAT
+ S32 = hal.Type.SINT # Removed
+ FLOAT= hal.Type.REAL # Deprecated
+ SINT = hal.Type.SINT
+ REAL = hal.Type.REAL
class HalBar(Bar, _HalWidgetBase):
@@ -418,12 +420,14 @@ class HalBar(Bar, _HalWidgetBase):
# older version of pyqt5 need this as well as QEnum
NONE = 0
- S32 = hal.HAL_S32
- FLOAT = hal.HAL_FLOAT
+ 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
@@ -436,11 +440,11 @@ def _hal_init(self):
self._superOpposite = self._opposite
- if self._pin_type == HALPinType.FLOAT:
- self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_FLOAT, hal.HAL_IN)
+ 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.HAL_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):
@@ -456,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/basic_probe.py b/lib/python/qtvcp/widgets/basic_probe.py
index 74f93959ad6..1e9a2bddce9 100644
--- a/lib/python/qtvcp/widgets/basic_probe.py
+++ b/lib/python/qtvcp/widgets/basic_probe.py
@@ -198,7 +198,7 @@ def homed_on_status():
# make pins available for tool measure remaps
oldname = self.HAL_GCOMP_.comp.getprefix()
self.HAL_GCOMP_.comp.setprefix('qtbasicprobe')
- self.probe_loaded = self.HAL_GCOMP_.newpin("probe-loaded", hal.HAL_BIT, hal.HAL_OUT)
+ self.probe_loaded = self.HAL_GCOMP_.newpin("probe-loaded", hal.Type.BOOL, hal.Dir.OUT)
self.HAL_GCOMP_.comp.setprefix(oldname)
# get current style of the line input
diff --git a/lib/python/qtvcp/widgets/camview_widget.py b/lib/python/qtvcp/widgets/camview_widget.py
index 5e11ef65437..0e0fe25e539 100644
--- a/lib/python/qtvcp/widgets/camview_widget.py
+++ b/lib/python/qtvcp/widgets/camview_widget.py
@@ -98,7 +98,7 @@ def __init__(self, parent=None):
def _hal_init(self):
try:
- self.pin_ = self.HAL_GCOMP_.newpin('cam-rotation',hal.HAL_FLOAT, hal.HAL_OUT)
+ self.pin_ = self.HAL_GCOMP_.newpin('cam-rotation',hal.Type.REAL, hal.Dir.OUT)
except:
pass
if LIB_GOOD:
diff --git a/lib/python/qtvcp/widgets/dialog_widget.py b/lib/python/qtvcp/widgets/dialog_widget.py
index c281869bfcb..bbe9a05e167 100644
--- a/lib/python/qtvcp/widgets/dialog_widget.py
+++ b/lib/python/qtvcp/widgets/dialog_widget.py
@@ -441,11 +441,11 @@ def _hal_init(self):
if not hal.component_exists('hal_manualtoolchange'):
oldname = self.HAL_GCOMP_.comp.getprefix()
self.HAL_GCOMP_.comp.setprefix('hal_manualtoolchange')
- self.hal_pin = self.HAL_GCOMP_.newpin('change', hal.HAL_BIT, hal.HAL_IN)
+ 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.HAL_IN)
- self.changed = self.HAL_GCOMP_.newpin('changed', hal.HAL_BIT, hal.HAL_OUT)
- self.ext_ack = self.HAL_GCOMP_.newpin(self.HAL_NAME_ + 'change_button', hal.HAL_BIT, hal.HAL_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)
self.HAL_GCOMP_.comp.setprefix(oldname)
else:
diff --git a/lib/python/qtvcp/widgets/general_hal_input.py b/lib/python/qtvcp/widgets/general_hal_input.py
index 2da821acc0d..3f8cd3be73e 100644
--- a/lib/python/qtvcp/widgets/general_hal_input.py
+++ b/lib/python/qtvcp/widgets/general_hal_input.py
@@ -48,14 +48,14 @@ def _hal_init(self):
else:
pname = self._pin_name
if self._bit_pin_type:
- ptype = hal.HAL_BIT
- self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_, hal.HAL_BIT, hal.HAL_IN)
+ ptype = hal.Type.BOOL
+ self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_, hal.Type.BOOL, hal.Dir.IN)
self.hal_pin.value_changed.connect(lambda data: self.pin_update(data))
elif self._float_pin_type:
- self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_, hal.HAL_FLOAT, hal.HAL_IN)
+ 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.HAL_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 4133cd6979e..bf555cf3d6d 100644
--- a/lib/python/qtvcp/widgets/general_hal_output.py
+++ b/lib/python/qtvcp/widgets/general_hal_output.py
@@ -47,16 +47,16 @@ def _hal_init(self):
else:
pname = self._pin_name
if self._bit_pin_type:
- ptype = hal.HAL_BIT
- self.hal_pin = self.HAL_GCOMP_.newpin(pname, ptype, hal.HAL_OUT)
- self.hal_pin_2 = self.HAL_GCOMP_.newpin(pname + "-not", ptype, hal.HAL_OUT)
+ ptype = hal.Type.BOOL
+ self.hal_pin = self.HAL_GCOMP_.newpin(pname, ptype, hal.Dir.OUT)
+ self.hal_pin_2 = self.HAL_GCOMP_.newpin(pname + "-not", ptype, hal.Dir.OUT)
if self.istate:
self._pin_bit_update(self._initial_float)
else:
- ptype = hal.HAL_S32
- ptype2 = hal.HAL_FLOAT
- self.hal_pin = self.HAL_GCOMP_.newpin(pname + '-s32', ptype, hal.HAL_OUT)
- self.hal_pin_2 = self.HAL_GCOMP_.newpin(pname + "-float", ptype2, hal.HAL_OUT)
+ 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)
if self.istate:
self._pin_value_update(self._initial_float)
diff --git a/lib/python/qtvcp/widgets/hal_label.py b/lib/python/qtvcp/widgets/hal_label.py
index c35ac341d75..add3f4fc664 100644
--- a/lib/python/qtvcp/widgets/hal_label.py
+++ b/lib/python/qtvcp/widgets/hal_label.py
@@ -49,13 +49,13 @@ def _hal_init(self):
else:
pname = self._pin_name
if self._bit_pin_type:
- self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_BIT, hal.HAL_IN)
+ self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.BOOL, hal.Dir.IN)
self.hal_pin.value_changed.connect(lambda data: self._setText(data))
elif self._float_pin_type:
- self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_FLOAT, hal.HAL_IN)
+ 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.HAL_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 3bb466ed9e9..260f46bff26 100644
--- a/lib/python/qtvcp/widgets/hal_selectionbox.py
+++ b/lib/python/qtvcp/widgets/hal_selectionbox.py
@@ -106,16 +106,21 @@ def selected(self,index):
################################################################
class HALSelectionBox(TreeComboBox, _HalWidgetBase):
- HAL_BIT = hal.HAL_BIT
- HAL_FLOAT = hal.HAL_FLOAT
- HAL_S32 = hal.HAL_S32
- HAL_U32 = hal.HAL_U32
-
- HAL_IN = hal.HAL_IN
- HAL_OUT = hal.HAL_OUT
- HAL_IO = hal.HAL_IO
- HAL_RO = hal.HAL_RO
- HAL_RW = hal.HAL_RW
+ HAL_BOOL = hal.Type.BOOL
+ HAL_REAL = hal.Type.REAL
+ HAL_SINT = hal.Type.SINT
+ HAL_UINT = hal.Type.UINT
+
+ HAL_BIT = hal.Type.BOOL # Deprecated
+ HAL_FLOAT = hal.Type.REAL # Deprecated
+ 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
+ HAL_IO = hal.Dir.IO
+ HAL_RO = hal.Dir.RO
+ HAL_RW = hal.Dir.RW
PINS = 1
SIGS = SIGNALS = 2
@@ -123,9 +128,9 @@ class HALSelectionBox(TreeComboBox, _HalWidgetBase):
def __init__(self, parent=None):
super(HALSelectionBox, self).__init__(parent)
- self.PINTYPE = [self.HAL_BIT,self.HAL_FLOAT,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_BIT,self.HAL_FLOAT,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]
@@ -187,30 +192,30 @@ def _hal_init(self):
self.view().adjustSize()
def setShowTypes(self, types):
- ''' Sets the pin type: HAL_BIT,HAL_FLOAT,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_BIT])'''
+ ie. combobox.setShowTypes([combobox.HAL_BOOL])'''
self.SHOWTYPES = types
def setPinTypes(self, \
- types = [HAL_BIT,HAL_FLOAT,HAL_S32,HAL_U32], \
+ types = [HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT], \
direction = [HAL_IN, HAL_OUT]):
- ''' Sets the pin type: HAL_BIT,HAL_FLOAT,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.
- ie. combobox.setPinTypes([combobox.HAL_BIT], direction = [HAL_IN])'''
+ ie. combobox.setPinTypes([combobox.HAL_BOOL], direction = [HAL_IN])'''
self.PINTYPE = types
self.PINDIRECTION = direction
def setSignalTypes(self, \
- types = [HAL_BIT,HAL_FLOAT,HAL_S32,HAL_U32], \
+ types = [HAL_BOOL,HAL_REAL,HAL_SINT,HAL_UINT], \
driven = [True, False]):
- ''' Sets the pin type: HAL_BIT,HAL_FLOAT,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_BIT], direction = [True,False])'''
+ combobox.setSignalTypes([combobox.HAL_BOOL], direction = [True,False])'''
self.SIGTYPE = types
self.SIGDRIVEN = driven
diff --git a/lib/python/qtvcp/widgets/indicatorMixIn.py b/lib/python/qtvcp/widgets/indicatorMixIn.py
index bda4fd8172e..89db9755b97 100644
--- a/lib/python/qtvcp/widgets/indicatorMixIn.py
+++ b/lib/python/qtvcp/widgets/indicatorMixIn.py
@@ -116,10 +116,10 @@ def _hal_init(self):
pname = self.HAL_NAME_
else:
pname = self._pin_name_
- self.hal_pin_led = self.HAL_GCOMP_.newpin(pname + '-led', hal.HAL_BIT, hal.HAL_IN)
+ self.hal_pin_led = self.HAL_GCOMP_.newpin(pname + '-led', hal.Type.BOOL, hal.Dir.IN)
self.hal_pin_led.value_changed.connect(lambda data: self.indicator_update(data))
if self._doubleIndicator:
- self.hal_pin_led2 = self.HAL_GCOMP_.newpin(pname + '-led2', hal.HAL_BIT, hal.HAL_IN)
+ self.hal_pin_led2 = self.HAL_GCOMP_.newpin(pname + '-led2', hal.Type.BOOL, hal.Dir.IN)
self.hal_pin_led2.value_changed.connect(lambda data: self.indicator2_update(data))
elif self._ind_status:
diff --git a/lib/python/qtvcp/widgets/jog_increments.py b/lib/python/qtvcp/widgets/jog_increments.py
index c54caa3ba93..05a079d6a56 100644
--- a/lib/python/qtvcp/widgets/jog_increments.py
+++ b/lib/python/qtvcp/widgets/jog_increments.py
@@ -51,7 +51,7 @@ def _hal_init(self):
pname = self.HAL_NAME_
else:
pname = self._pin_name
- self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_FLOAT, hal.HAL_OUT)
+ self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.REAL, hal.Dir.OUT)
if self.linear:
for item in (INFO.JOG_INCREMENTS):
self.addItem(item)
diff --git a/lib/python/qtvcp/widgets/joypad.py b/lib/python/qtvcp/widgets/joypad.py
index fd35549ebc2..85620e61b8e 100644
--- a/lib/python/qtvcp/widgets/joypad.py
+++ b/lib/python/qtvcp/widgets/joypad.py
@@ -539,9 +539,12 @@ def __setitem__(self, item, value):
class HALPinType(enum.IntEnum):
NONE = 0
- BIT = hal.HAL_BIT
- S32 = hal.HAL_S32
- FLOAT = hal.HAL_FLOAT
+ 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
class HALPad(JoyPad, _HalWidgetBase):
HALPinType = HALPinType
@@ -549,14 +552,17 @@ class HALPad(JoyPad, _HalWidgetBase):
# older version of pyqt5 need this as well as QEnum
NONE = 0
- BIT = hal.HAL_BIT
- S32 = hal.HAL_S32
- FLOAT = hal.HAL_FLOAT
+ 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
def __init__(self, parent=None):
super(HALPad, self).__init__(parent)
self._pin_name = ''
- self._pin_type = HALPinType.BIT
+ self._pin_type = HALPinType.BOOL
self._trueOutputR = 1.0
self._trueOutputL = 1.0
@@ -579,24 +585,24 @@ def _hal_init(self):
pname = self._pin_name
if not self._pin_type == HALPinType.NONE:
ptype = self._pin_type
- self.halPinR = self.HAL_GCOMP_.newpin(pname + '.right', ptype, hal.HAL_OUT)
- self.halPinL = self.HAL_GCOMP_.newpin(pname + '.left', ptype, hal.HAL_OUT)
- self.halPinT = self.HAL_GCOMP_.newpin(pname + '.top', ptype, hal.HAL_OUT)
- self.halPinB = self.HAL_GCOMP_.newpin(pname + '.bottom', ptype, hal.HAL_OUT)
- self.halPinC = self.HAL_GCOMP_.newpin(pname + '.center', ptype, hal.HAL_OUT)
+ self.halPinR = self.HAL_GCOMP_.newpin(pname + '.right', ptype, hal.Dir.OUT)
+ self.halPinL = self.HAL_GCOMP_.newpin(pname + '.left', ptype, hal.Dir.OUT)
+ self.halPinT = self.HAL_GCOMP_.newpin(pname + '.top', ptype, hal.Dir.OUT)
+ self.halPinB = self.HAL_GCOMP_.newpin(pname + '.bottom', ptype, hal.Dir.OUT)
+ self.halPinC = self.HAL_GCOMP_.newpin(pname + '.center', ptype, hal.Dir.OUT)
if not self._highlightPosition == IndicatorPosition.NONE:
- self.halPinLightCenter = self.HAL_GCOMP_.newpin(pname + '.light.center', hal.HAL_BIT, hal.HAL_IN)
+ self.halPinLightCenter = self.HAL_GCOMP_.newpin(pname + '.light.center', hal.Type.BOOL, hal.Dir.IN)
self.halPinLightCenter.value_changed.connect(lambda data: self.setLight(data))
def _pressedOutput(self, btncode):
self.joy_btn_pressed.emit(btncode)
self['joy_{}_pressed'.format(btncode.lower())].emit(True)
- if self._pin_type == HALPinType.BIT:
+ if self._pin_type == HALPinType.BOOL:
data = True
- elif self._pin_type == HALPinType.FLOAT:
+ 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
@@ -609,11 +615,11 @@ def _releasedOutput(self, btncode):
self.joy_btn_released.emit(btncode)
self['joy_{}_released'.format(btncode.lower())].emit(False)
- if self._pin_type == HALPinType.BIT:
+ if self._pin_type == HALPinType.BOOL:
data = False
- elif self._pin_type == HALPinType.FLOAT:
+ 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
@@ -645,7 +651,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.BIT
+ self._pin_type = HALPinType.BOOL
# 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/led_widget.py b/lib/python/qtvcp/widgets/led_widget.py
index 6c55ee8b1aa..bc4409f7074 100644
--- a/lib/python/qtvcp/widgets/led_widget.py
+++ b/lib/python/qtvcp/widgets/led_widget.py
@@ -64,7 +64,7 @@ def _hal_init(self):
else:
pname = self._pin_name_
- self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_BIT, hal.HAL_IN)
+ self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.BOOL, hal.Dir.IN)
self.hal_pin.value_changed.connect(lambda s: self.change_state(s))
@Slot(bool)
diff --git a/lib/python/qtvcp/widgets/round_gauge.py b/lib/python/qtvcp/widgets/round_gauge.py
index 04f3ed64187..f0268f083f2 100644
--- a/lib/python/qtvcp/widgets/round_gauge.py
+++ b/lib/python/qtvcp/widgets/round_gauge.py
@@ -37,9 +37,9 @@ def __init__(self, parent=None):
def _hal_init(self):
if (self._halpin_option):
- self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_ + "_value", hal.HAL_FLOAT, hal.HAL_IN)
+ self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_ + "_value", hal.Type.REAL, hal.Dir.IN)
self.hal_pin.value_changed.connect(lambda value: self.update_value(value))
- self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_ + "_setpoint", hal.HAL_FLOAT, hal.HAL_IN)
+ self.hal_pin = self.HAL_GCOMP_.newpin(self.HAL_NAME_ + "_setpoint", hal.Type.REAL, hal.Dir.IN)
self.hal_pin.value_changed.connect(lambda value: self.set_setpoint(value))
def create_unit_array(self):
diff --git a/lib/python/qtvcp/widgets/simple_widgets.py b/lib/python/qtvcp/widgets/simple_widgets.py
index 8af83620e10..3e814efee42 100644
--- a/lib/python/qtvcp/widgets/simple_widgets.py
+++ b/lib/python/qtvcp/widgets/simple_widgets.py
@@ -45,9 +45,12 @@
class HALPinType(enum.IntEnum):
NONE = 0
- BIT = hal.HAL_BIT
- S32 = hal.HAL_S32
- FLOAT = hal.HAL_FLOAT
+ 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
# reacts to HAL pin changes
class LCDNumber(QtWidgets.QLCDNumber, _HalWidgetBase):
@@ -64,13 +67,13 @@ def _hal_init(self):
else:
pname = self._pin_name_
if self._bit_pin_type:
- self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_BIT, hal.HAL_IN)
+ self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.BOOL, hal.Dir.IN)
self.hal_pin.value_changed.connect(lambda data: self.updateDisplay(data))
elif self._float_pin_type:
- self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_FLOAT, hal.HAL_IN)
+ 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.HAL_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):
@@ -177,9 +180,9 @@ 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.HAL_OUT)
- self.hal_pin_f = self.HAL_GCOMP_.newpin(pname +'-f', hal.HAL_FLOAT, hal.HAL_OUT)
- self.hal_pin_scale = self.HAL_GCOMP_.newpin(pname +'-scale', hal.HAL_FLOAT, hal.HAL_IN)
+ 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)
self.updateValue(self.value())
self.valueChanged.connect(lambda data:self.updateValue(data))
@@ -212,10 +215,10 @@ 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.HAL_OUT)
- self.hal_pin_f = self.HAL_GCOMP_.newpin(pname +'-f', hal.HAL_FLOAT, hal.HAL_OUT)
- self.hal_pin_d = self.HAL_GCOMP_.newpin(pname +'-d', hal.HAL_FLOAT, hal.HAL_OUT)
- self.hal_pin_scale = self.HAL_GCOMP_.newpin(pname +'-scale', hal.HAL_FLOAT, hal.HAL_IN)
+ 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)
self.hal_pin_scale.value_changed.connect(lambda data: self.updateScale(data))
self.hal_pin_scale.set(1)
self.updateCount(self.value())
@@ -359,14 +362,17 @@ class PushButton(QtWidgets.QPushButton, IndicatedMixIn):
# older version of pyqt5 need this as well as QEnum
NONE = 0
- BIT = hal.HAL_BIT
- S32 = hal.HAL_S32
- FLOAT = hal.HAL_FLOAT
+ 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
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
@@ -397,7 +403,7 @@ def _hal_init(self):
pname = self.HAL_NAME_
else:
pname = self._pin_name_
- self.hal_pin = self.HAL_GCOMP_.newpin(str(pname), hal.HAL_BIT, hal.HAL_OUT)
+ self.hal_pin = self.HAL_GCOMP_.newpin(str(pname), hal.Type.BOOL, hal.Dir.OUT)
super(PushButton, self)._hal_init()
@@ -434,7 +440,7 @@ def makeGroupPin(self):
pname = self.HAL_NAME_ + '.exclusive'+name
else:
pname = self._groupPinName
- self.halPinGroup = self.HAL_GCOMP_.newpin(pname , ptype, hal.HAL_OUT)
+ self.halPinGroup = self.HAL_GCOMP_.newpin(pname , ptype, hal.Dir.OUT)
break
break
@@ -452,11 +458,11 @@ def updateGroup(self):
#print('value:',value)
break
- if self._pin_type == HALPinType.BIT:
+ if self._pin_type == HALPinType.BOOL:
data = bool(value)
- elif self._pin_type == HALPinType.FLOAT:
+ 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
@@ -479,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/state_led.py b/lib/python/qtvcp/widgets/state_led.py
index ab6b9c2668a..6a1bddd24fd 100644
--- a/lib/python/qtvcp/widgets/state_led.py
+++ b/lib/python/qtvcp/widgets/state_led.py
@@ -83,7 +83,7 @@ def only_false(data):
pname = self.HAL_NAME_
else:
pname = self._halpin_name
- self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_BIT, hal.HAL_OUT)
+ self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.BOOL, hal.Dir.OUT)
if self.is_estopped:
STATUS.connect('state-estop', lambda w: self._flip_state(True))
STATUS.connect('state-estop-reset', lambda w: self._flip_state(False))
diff --git a/lib/python/qtvcp/widgets/status_slider.py b/lib/python/qtvcp/widgets/status_slider.py
index fa1b93571e8..6daa2fad754 100644
--- a/lib/python/qtvcp/widgets/status_slider.py
+++ b/lib/python/qtvcp/widgets/status_slider.py
@@ -121,7 +121,7 @@ def _hal_init(self):
pname = self.HAL_NAME_
else:
pname = self._pin_name_
- self.hal_pin = self.HAL_GCOMP_.newpin(str(pname), hal.HAL_FLOAT, hal.HAL_OUT)
+ self.hal_pin = self.HAL_GCOMP_.newpin(str(pname), hal.Type.REAL, hal.Dir.OUT)
# connect a signal and callback function to the button
self.doubleValueChanged.connect(self._action)
diff --git a/lib/python/qtvcp/widgets/versa_probe.py b/lib/python/qtvcp/widgets/versa_probe.py
index efa18563d06..8528226a3a3 100644
--- a/lib/python/qtvcp/widgets/versa_probe.py
+++ b/lib/python/qtvcp/widgets/versa_probe.py
@@ -234,17 +234,17 @@ def homed_on_test():
# make pins available for tool measure remaps
oldname = self.HAL_GCOMP_.comp.getprefix()
self.HAL_GCOMP_.comp.setprefix('qtversaprobe')
- self.pin_svel = self.HAL_GCOMP_.newpin("searchvel", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.pin_svel = self.HAL_GCOMP_.newpin("searchvel", hal.Type.REAL, hal.Dir.OUT)
self.pin_svel.set(float(self.input_search_vel.text()))
- self.pin_pvel = self.HAL_GCOMP_.newpin("probevel", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.pin_pvel = self.HAL_GCOMP_.newpin("probevel", hal.Type.REAL, hal.Dir.OUT)
self.pin_pvel.set(float(self.input_probe_vel.text()))
- self.pin_pheight = self.HAL_GCOMP_.newpin("probeheight", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.pin_pheight = self.HAL_GCOMP_.newpin("probeheight", hal.Type.REAL, hal.Dir.OUT)
self.pin_pheight.set(float(self.input_tool_probe_height.text()))
- self.pin_bheight = self.HAL_GCOMP_.newpin("blockheight", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.pin_bheight = self.HAL_GCOMP_.newpin("blockheight", hal.Type.REAL, hal.Dir.OUT)
self.pin_bheight.set(float(self.input_tool_block_height.text()))
- self.pin_latch_rtn = self.HAL_GCOMP_.newpin("backoffdist", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.pin_latch_rtn = self.HAL_GCOMP_.newpin("backoffdist", hal.Type.REAL, hal.Dir.OUT)
self.pin_latch_rtn.set(float(self.input_latch_return_dist.text()))
- self.probe_loaded = self.HAL_GCOMP_.newpin("probe-loaded", hal.HAL_BIT, hal.HAL_OUT)
+ self.probe_loaded = self.HAL_GCOMP_.newpin("probe-loaded", hal.Type.BOOL, hal.Dir.OUT)
self.HAL_GCOMP_.comp.setprefix(oldname)
# install callbacks to update HAL pins
diff --git a/lib/python/qtvcp/widgets/widget_baseclass.py b/lib/python/qtvcp/widgets/widget_baseclass.py
index 23bfa396f45..67f048285bd 100644
--- a/lib/python/qtvcp/widgets/widget_baseclass.py
+++ b/lib/python/qtvcp/widgets/widget_baseclass.py
@@ -120,8 +120,8 @@ def _hal_init(self):
pname = self.HAL_NAME_
else:
pname = self._pin_name_
- self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_BIT, hal.HAL_OUT)
- self.hal_pin_not = self.HAL_GCOMP_.newpin(pname + "-not", hal.HAL_BIT, hal.HAL_OUT)
+ self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.BOOL, hal.Dir.OUT)
+ self.hal_pin_not = self.HAL_GCOMP_.newpin(pname + "-not", hal.Type.BOOL, hal.Dir.OUT)
self.toggled.connect(lambda data: self._pin_update(data))
def _pin_update(self, state):
@@ -142,8 +142,8 @@ def _hal_init(self):
pname = self.HAL_NAME_
else:
pname = self._pin_name_
- self.hal_pin_f = self.HAL_GCOMP_.newpin(pname + "-f", hal.HAL_FLOAT, hal.HAL_OUT)
- self.hal_pin_s = self.HAL_GCOMP_.newpin(pname + "-s", hal.HAL_S32, hal.HAL_OUT)
+ 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.Type.SINT, hal.Dir.OUT)
self.valueChanged.connect(lambda data: self._pin_update(data))
# default scale
self.input = 1
@@ -169,7 +169,7 @@ def _hal_init(self):
pname = self.HAL_NAME_
else:
pname = self._pin_name_
- self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.HAL_BIT, hal.HAL_IN)
+ self.hal_pin = self.HAL_GCOMP_.newpin(pname, hal.Type.BOOL, hal.Dir.IN)
self.hal_pin.value_changed.connect(lambda s: self.setEnabled(s))
def set_pin_name(self, value):
diff --git a/lib/python/raster.py b/lib/python/raster.py
index 4e87095c3bb..37676dd5756 100644
--- a/lib/python/raster.py
+++ b/lib/python/raster.py
@@ -54,10 +54,10 @@ def __init__(self, name):
"""
self.__timeout = 5.0
self.component = hal.component(name)
- self.port = self.component.newpin("program", hal.HAL_PORT, hal.HAL_OUT)
- self.faultCode = self.component.newpin("fault-code", hal.HAL_S32, hal.HAL_IN)
- self.enabled = self.component.newpin("enabled", hal.HAL_BIT, hal.HAL_IN)
- self.run = self.component.newpin("run", hal.HAL_BIT, hal.HAL_OUT)
+ self.port = self.component.newpin("program", hal.Type.PORT, hal.Dir.OUT)
+ 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()
self.run.value = False
diff --git a/lib/python/vismach.py b/lib/python/vismach.py
index a35f2b2ee5a..009103df62a 100644
--- a/lib/python/vismach.py
+++ b/lib/python/vismach.py
@@ -1558,7 +1558,7 @@ def main(model, tool, work, size=10, hud=0, rotation_vectors=None, lat=0, lon=0)
t.after(100, lambda: t.set_viewangle(lat, lon, forcerotate=1))
vcomp = hal.component("vismach")
- vcomp.newpin("plotclear",hal.HAL_BIT,hal.HAL_IN)
+ vcomp.newpin("plotclear",hal.Type.BOOL,hal.Dir.IN)
vcomp.ready()
#there's probably a better way of doing this
diff --git a/nc_files/remap_lib/python-stdglue/stdglue.py b/nc_files/remap_lib/python-stdglue/stdglue.py
index a3b93019afa..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.HAL_OUT)
- h.newpin("wear", hal.HAL_S32, hal.HAL_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/gscreen/skins/silverdragon/silverdragon_handler.py b/share/gscreen/skins/silverdragon/silverdragon_handler.py
index 3d08239aee7..e78c1a1db8c 100644
--- a/share/gscreen/skins/silverdragon/silverdragon_handler.py
+++ b/share/gscreen/skins/silverdragon/silverdragon_handler.py
@@ -326,18 +326,18 @@ def init_sensitive_all_homed(self):
def initialize_pins(self):
# pins for block height
- self.halcomp.newpin("sensor_height", hal.HAL_FLOAT, hal.HAL_OUT)
- pin = self.halcomp.newpin("block_height", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.halcomp.newpin("sensor_height", hal.Type.REAL, hal.Dir.OUT)
+ pin = self.halcomp.newpin("block_height", hal.Type.REAL, hal.Dir.OUT)
hal_glib.GPin(pin).connect("value_changed", self.on_blockheight_changed)
self.halcomp["block_height"] = self.gscreen.prefs.getpref("blockheight", 0.0, float)
# pins for probing
- self.halcomp.newpin("search_vel", hal.HAL_FLOAT, hal.HAL_OUT)
- self.halcomp.newpin("probe_vel", hal.HAL_FLOAT, hal.HAL_OUT)
- self.halcomp.newpin("maxprobe", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.halcomp.newpin("search_vel", hal.Type.REAL, hal.Dir.OUT)
+ self.halcomp.newpin("probe_vel", hal.Type.REAL, hal.Dir.OUT)
+ self.halcomp.newpin("maxprobe", hal.Type.REAL, hal.Dir.OUT)
# pins for clear_mdi button
- self.halcomp.newpin("clear_mdi", hal.HAL_BIT, hal.HAL_OUT)
- pin = self.halcomp.newpin("clear_mdi-waiting", hal.HAL_BIT, hal.HAL_OUT)
- pin = self.halcomp.newpin("clear_mdi-response", hal.HAL_BIT, hal.HAL_OUT)
+ self.halcomp.newpin("clear_mdi", hal.Type.BOOL, hal.Dir.OUT)
+ pin = self.halcomp.newpin("clear_mdi-waiting", hal.Type.BOOL, hal.Dir.OUT)
+ pin = self.halcomp.newpin("clear_mdi-response", hal.Type.BOOL, hal.Dir.OUT)
hal_glib.GPin(pin).connect("value_changed", self.on_clear_mdi_changed)
# every 100 milli seconds this gets called
diff --git a/share/gscreen/skins/spartan/spartan_handler.py b/share/gscreen/skins/spartan/spartan_handler.py
index a681cbf108f..258f986308d 100644
--- a/share/gscreen/skins/spartan/spartan_handler.py
+++ b/share/gscreen/skins/spartan/spartan_handler.py
@@ -110,16 +110,16 @@ def initialize_pins(self):
self.gscreen.init_jog_pins()
self.gscreen.init_override_pins()
self.gscreen.init_control_pins()
- self.gscreen.halcomp.newpin("spindle-spd-disp", hal.HAL_FLOAT, hal.HAL_IN)
- self.gscreen.halcomp.newpin("jog-spd-out", hal.HAL_FLOAT, hal.HAL_OUT)
- self.gscreen.halcomp.newpin("jog-inc-out", hal.HAL_FLOAT, hal.HAL_OUT)
- self.data['ext-estop'] = hal_glib.GPin(self.gscreen.halcomp.newpin('ext-estop', hal.HAL_BIT, hal.HAL_IN))
+ self.gscreen.halcomp.newpin("spindle-spd-disp", hal.Type.REAL, hal.Dir.IN)
+ self.gscreen.halcomp.newpin("jog-spd-out", hal.Type.REAL, hal.Dir.OUT)
+ self.gscreen.halcomp.newpin("jog-inc-out", hal.Type.REAL, hal.Dir.OUT)
+ self.data['ext-estop'] = hal_glib.GPin(self.gscreen.halcomp.newpin('ext-estop', hal.Type.BOOL, hal.Dir.IN))
self.data['ext-estop'].connect('value-changed', self.on_estop_in)
- self.data['enc-fault-x'] = hal_glib.GPin(self.gscreen.halcomp.newpin('enc-fault-x', hal.HAL_BIT, hal.HAL_IN))
+ self.data['enc-fault-x'] = hal_glib.GPin(self.gscreen.halcomp.newpin('enc-fault-x', hal.Type.BOOL, hal.Dir.IN))
self.data['enc-fault-x'].connect('value-changed', self.on_x_enc_fault)
- self.data['enc-fault-y'] = hal_glib.GPin(self.gscreen.halcomp.newpin('enc-fault-y', hal.HAL_BIT, hal.HAL_IN))
+ self.data['enc-fault-y'] = hal_glib.GPin(self.gscreen.halcomp.newpin('enc-fault-y', hal.Type.BOOL, hal.Dir.IN))
self.data['enc-fault-y'].connect('value-changed', self.on_y_enc_fault)
- self.data['enc-fault-x'] = hal_glib.GPin(self.gscreen.halcomp.newpin('enc-fault-z', hal.HAL_BIT, hal.HAL_IN))
+ self.data['enc-fault-x'] = hal_glib.GPin(self.gscreen.halcomp.newpin('enc-fault-z', hal.Type.BOOL, hal.Dir.IN))
self.data['enc-fault-x'].connect('value-changed', self.on_z_enc_fault)
def on_emc_off(self,*args):
diff --git a/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim_handler.py b/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim_handler.py
index 8e6ea7632fb..9214601d5ed 100644
--- a/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim_handler.py
+++ b/share/qtvcp/panels/qtplasmac_sim/qtplasmac_sim_handler.py
@@ -53,15 +53,15 @@ def initialized__(self):
appPath = os.path.realpath(os.path.dirname(sys.argv[0]))
self.iconBase = '/usr' if appPath == '/usr/bin' else appPath.replace('/bin', '/debian/extras/usr')
self.w.setWindowIcon(QIcon(os.path.join(self.iconBase, self.iconPath)))
- self.arcVoltsOffsetPin = self.hal.newpin('arc_voltage_offset-f', hal.HAL_FLOAT, hal.HAL_OUT)
- self.breakPin = self.hal.newpin('sensor_breakaway', hal.HAL_BIT, hal.HAL_OUT)
- self.floatPin = self.hal.newpin('sensor_float', hal.HAL_BIT, hal.HAL_OUT)
- self.materialPin = self.hal.newpin('material_height', hal.HAL_FLOAT, hal.HAL_IN)
- self.ohmicPin = self.hal.newpin('sensor_ohmic', hal.HAL_BIT, hal.HAL_OUT)
- self.torchPin = self.hal.newpin('torch_on', hal.HAL_BIT, hal.HAL_IN)
- self.statePin = self.hal.newpin('state', hal.HAL_S32, hal.HAL_IN)
- self.stylePin = self.hal.newpin('style_update', hal.HAL_BIT, hal.HAL_IN)
- self.zPosPin = self.hal.newpin('z_position', hal.HAL_FLOAT, hal.HAL_IN)
+ self.arcVoltsOffsetPin = self.hal.newpin('arc_voltage_offset-f', hal.Type.REAL, hal.Dir.OUT)
+ self.breakPin = self.hal.newpin('sensor_breakaway', hal.Type.BOOL, hal.Dir.OUT)
+ self.floatPin = self.hal.newpin('sensor_float', hal.Type.BOOL, hal.Dir.OUT)
+ 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.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
for sig in hal.get_info_signals():
if sig['NAME'] == 'Zjoint-pos-fb':
diff --git a/share/qtvcp/panels/test_button/test_button_handler.py b/share/qtvcp/panels/test_button/test_button_handler.py
index e25ca9ce492..27098841928 100644
--- a/share/qtvcp/panels/test_button/test_button_handler.py
+++ b/share/qtvcp/panels/test_button/test_button_handler.py
@@ -121,8 +121,8 @@ def addButton(self):
# combo box for HAL pin selection
cb = HALSelectionBox()
cb.setShowTypes([cb.PINS,cb.SIGNALS])
- cb.setPinTypes([cb.HAL_BIT], direction = [cb.HAL_IN])
- cb.setSignalTypes([cb.HAL_BIT], driven = [False,True])
+ cb.setPinTypes([cb.HAL_BOOL], direction = [cb.HAL_IN])
+ cb.setSignalTypes([cb.HAL_BOOL], driven = [False,True])
cb.hal_init()
cb.objectSelected.connect(lambda w: self.selectedUpdated(w, button))
diff --git a/share/qtvcp/panels/test_dial/test_dial_handler.py b/share/qtvcp/panels/test_dial/test_dial_handler.py
index 4dd967e3941..cde6d1d9906 100644
--- a/share/qtvcp/panels/test_dial/test_dial_handler.py
+++ b/share/qtvcp/panels/test_dial/test_dial_handler.py
@@ -56,7 +56,7 @@ def initialized__(self):
cb = HALSelectionBox()
cb.setShowTypes([cb.SIGNALS])
- cb.setSignalTypes([cb.HAL_FLOAT], driven = [False,True])
+ cb.setSignalTypes([cb.HAL_REAL], driven = [False,True])
cb.hal_init()
cb.currentTextChanged.connect(self.signalSelected)
hbox.addWidget(cb)
diff --git a/share/qtvcp/panels/test_led/test_led_handler.py b/share/qtvcp/panels/test_led/test_led_handler.py
index bd4189018c7..a91a543d888 100644
--- a/share/qtvcp/panels/test_led/test_led_handler.py
+++ b/share/qtvcp/panels/test_led/test_led_handler.py
@@ -121,8 +121,8 @@ def addLED(self):
# combo box for HAL pin selection
cb = HALSelectionBox()
cb.setShowTypes([cb.PINS,cb.SIGNALS])
- cb.setPinTypes([cb.HAL_BIT])
- cb.setSignalTypes([cb.HAL_BIT], driven = [False,True])
+ cb.setPinTypes([cb.HAL_BOOL])
+ cb.setSignalTypes([cb.HAL_BOOL], driven = [False,True])
cb.hal_init()
cb.selectionUpdated.connect(lambda w: self.signalSelected(w,led))
diff --git a/share/qtvcp/panels/vismach_router_atc/vismach_router_atc_handler.py b/share/qtvcp/panels/vismach_router_atc/vismach_router_atc_handler.py
index 20f62320160..9f5d3821b58 100644
--- a/share/qtvcp/panels/vismach_router_atc/vismach_router_atc_handler.py
+++ b/share/qtvcp/panels/vismach_router_atc/vismach_router_atc_handler.py
@@ -23,9 +23,9 @@
#import hal
#c = hal.component("router_atc")
-#c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN)
-#c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN)
-#c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN)
+#c.newpin("joint0", hal.Type.REAL, hal.Dir.IN)
+#c.newpin("joint1", hal.Type.REAL, hal.Dir.IN)
+#c.newpin("joint2", hal.Type.REAL, hal.Dir.IN)
#c.ready()
diff --git a/share/qtvcp/screens/qtaxis/qtaxis_handler.py b/share/qtvcp/screens/qtaxis/qtaxis_handler.py
index 0f447aca9ab..9fbea092ec9 100644
--- a/share/qtvcp/screens/qtaxis/qtaxis_handler.py
+++ b/share/qtvcp/screens/qtaxis/qtaxis_handler.py
@@ -399,14 +399,14 @@ def init_pins(self):
# external jogging control pins
for i in INFO.AVAILABLE_JOINTS:
self['jog_joint_{}_pin'.format(i)] = \
- QHAL.newpin("joint-{}-selected".format(i), QHAL.HAL_BIT, QHAL.HAL_OUT)
+ QHAL.newpin("joint-{}-selected".format(i), QHAL.HAL_BOOL, QHAL.HAL_OUT)
for i in INFO.AVAILABLE_AXES:
self['jog_axis_{}_pin'.format(i)] = \
- QHAL.newpin("axis-{}-selected".format(i.lower()), QHAL.HAL_BIT, QHAL.HAL_OUT)
+ 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_BIT, QHAL.HAL_IN)
+ self.pin_mpg_enabled = QHAL.newpin('mpg-enable',QHAL.HAL_BOOL, QHAL.HAL_IN)
def saveSettings(self):
# Record the toolbar settings
diff --git a/share/qtvcp/screens/qtdragon/qtdragon_handler.py b/share/qtvcp/screens/qtdragon/qtdragon_handler.py
index e6460795b0e..d69b9a00515 100644
--- a/share/qtvcp/screens/qtdragon/qtdragon_handler.py
+++ b/share/qtvcp/screens/qtdragon/qtdragon_handler.py
@@ -331,51 +331,51 @@ def init_utils(self):
#############################
def init_pins(self):
# spindle control pins
- pin = QHAL.newPin("spindle-amps", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ pin = QHAL.newPin("spindle-amps", QHAL.HAL_REAL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v))
- pin = QHAL.newPin("spindle-volts", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ 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_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.mb_connection_changed(v))
- QHAL.newPin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT)
+ QHAL.newPin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT)
- pin = QHAL.newPin("external-pause", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("external-pause", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.btn_pause_clicked(v))
# external offset control pins
- QHAL.newPin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT)
- QHAL.newPin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT)
+ 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)
- pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BIT, QHAL.HAL_IN)
+ 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_FLOAT, QHAL.HAL_IN)
+ 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
- pin = QHAL.newPin("dialog-ok", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("dialog-ok", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,1))
- pin = QHAL.newPin("dialog-no", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("dialog-no", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,2))
- pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,0))
def init_preferences(self):
diff --git a/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py b/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py
index fcba159bd4b..a8c4d45c378 100644
--- a/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py
+++ b/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py
@@ -260,58 +260,58 @@ def initialized__(self):
#############################
def init_pins(self):
# spindle control pins
- pin = QHAL.newPin("spindle-amps", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ pin = QHAL.newPin("spindle-amps", QHAL.HAL_REAL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v))
- pin = QHAL.newPin("spindle-volts", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ 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_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.mb_connection_changed(v))
- QHAL.newPin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT)
+ QHAL.newPin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT)
- pin = QHAL.newPin("external-pause", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("external-pause", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.btn_pause_clicked(v))
# external offset control pins
- QHAL.newPin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT)
- QHAL.newPin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT)
+ 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)
- pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BIT, QHAL.HAL_IN)
+ 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)
# total external offsets
- pin = QHAL.newPin("eoffset-value", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ 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_BIT, QHAL.HAL_OUT)
- QHAL.newPin("spindle-lift-on", QHAL.HAL_BIT, QHAL.HAL_OUT)
+ 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
- pin = QHAL.newPin("dialog-ok", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("dialog-ok", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,1))
- pin = QHAL.newPin("dialog-no", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("dialog-no", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,2))
- pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,0))
def init_preferences(self):
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 589c95b4959..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
@@ -260,58 +260,58 @@ def initialized__(self):
#############################
def init_pins(self):
# spindle control pins
- pin = QHAL.newPin("spindle-amps", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ pin = QHAL.newPin("spindle-amps", QHAL.HAL_REAL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v))
- pin = QHAL.newPin("spindle-volts", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ 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_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.mb_connection_changed(v))
- QHAL.newPin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT)
+ QHAL.newPin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT)
- pin = QHAL.newPin("external-pause", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("external-pause", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.btn_pause_clicked(v))
# external offset control pins
- QHAL.newPin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT)
- QHAL.newPin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT)
+ 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)
- pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BIT, QHAL.HAL_IN)
+ 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)
# total external offsets
- pin = QHAL.newPin("eoffset-value", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ 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_BIT, Qhal.HAL_OUT)
- QHAL.newPin("spindle-lift-on", Qhal.HAL_BIT, Qhal.HAL_OUT)
+ 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
- pin = QHAL.newPin("dialog-ok", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("dialog-ok", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,1))
- pin = QHAL.newPin("dialog-no", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("dialog-no", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,2))
- pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,0))
def init_preferences(self):
diff --git a/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py b/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py
index e1a480d7ffe..e9069833b7e 100644
--- a/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py
+++ b/share/qtvcp/screens/qtdragon_lathe/qtdragon_lathe_handler.py
@@ -321,50 +321,50 @@ def init_utils(self):
#############################
def init_pins(self):
# spindle control pins
- pin = QHAL.newPin("spindle-amps", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ pin = QHAL.newPin("spindle-amps", QHAL.HAL_REAL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.spindle_pwr_changed(v))
- pin = QHAL.newPin("spindle-volts", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ 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_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("spindle-modbus-connection", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.mb_connection_changed(v))
- QHAL.newPin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT)
+ QHAL.newPin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT)
- pin = QHAL.newPin("external-pause", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("external-pause", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.btn_pause_clicked(v))
# external offset control pins
- QHAL.newPin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT)
- QHAL.newPin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT)
+ 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)
- pin = QHAL.newPin("eoffset-is-active", QHAL.HAL_BIT, QHAL.HAL_IN)
+ 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_FLOAT, QHAL.HAL_IN)
+ 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
- pin = QHAL.newPin("dialog-ok", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("dialog-ok", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,1))
- pin = QHAL.newPin("dialog-no", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("dialog-no", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,2))
- pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BIT, QHAL.HAL_IN)
+ pin = QHAL.newPin("dialog-cancel", QHAL.HAL_BOOL, QHAL.HAL_IN)
pin.pinValueChanged.connect(lambda p,v: self.dialog_ext_control(p,v,0))
def init_preferences(self):
diff --git a/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py b/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py
index dfdaeab8c85..dc922774bb9 100644
--- a/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py
+++ b/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py
@@ -839,97 +839,97 @@ def new_process_error(self, w, kind, text):
#########################################################################################################################
def make_hal_pins(self):
- self.consChangePin = self.h.newpin('consumable_changing', hal.HAL_BIT, hal.HAL_IN)
- self.convTabDisable = self.h.newpin('conv_disable', hal.HAL_BIT, hal.HAL_IN)
- self.cutTypePin = self.h.newpin('cut_type', hal.HAL_S32, hal.HAL_IN)
- self.developmentPin = self.h.newpin('development', hal.HAL_BIT, hal.HAL_IN)
- self.extAbortPin = self.h.newpin('ext_abort', hal.HAL_BIT, hal.HAL_IN)
- self.extAutoVoltsEnablePin = self.h.newpin('ext_auto_volts_enable', hal.HAL_BIT, hal.HAL_IN)
- self.extChangeConsPin = self.h.newpin('ext_consumables', hal.HAL_BIT, hal.HAL_IN)
- self.extCornerLockEnablePin = self.h.newpin('ext_cornerlock_enable', hal.HAL_BIT, hal.HAL_IN)
- self.extCutRecCancelPin = self.h.newpin('ext_cutrec_cancel', hal.HAL_BIT, hal.HAL_IN)
- self.extCutRecRevPin = self.h.newpin('ext_cutrec_rev', hal.HAL_BIT, hal.HAL_IN)
- self.extCutRecFwdPin = self.h.newpin('ext_cutrec_fwd', hal.HAL_BIT, hal.HAL_IN)
- self.extCutRecNPin = self.h.newpin('ext_cutrec_n', hal.HAL_BIT, hal.HAL_IN)
- self.extCutRecNEPin = self.h.newpin('ext_cutrec_ne', hal.HAL_BIT, hal.HAL_IN)
- self.extCutRecEPin = self.h.newpin('ext_cutrec_e', hal.HAL_BIT, hal.HAL_IN)
- self.extCutRecSEPin = self.h.newpin('ext_cutrec_se', hal.HAL_BIT, hal.HAL_IN)
- self.extCutRecSPin = self.h.newpin('ext_cutrec_s', hal.HAL_BIT, hal.HAL_IN)
- self.extCutRecSWPin = self.h.newpin('ext_cutrec_sw', hal.HAL_BIT, hal.HAL_IN)
- self.extCutRecWPin = self.h.newpin('ext_cutrec_w', hal.HAL_BIT, hal.HAL_IN)
- self.extCutRecNWPin = self.h.newpin('ext_cutrec_nw', hal.HAL_BIT, hal.HAL_IN)
- self.extFramingPin = self.h.newpin('ext_frame_job', hal.HAL_BIT, hal.HAL_IN)
- self.extHeightOvrCountsPin = self.h.newpin('ext_height_ovr_counts', hal.HAL_S32, hal.HAL_IN)
- self.extHeightOvrCountEnablePin = self.h.newpin('ext_height_ovr_count_enable', hal.HAL_BIT, hal.HAL_IN)
- self.extHeightOvrMinusPin = self.h.newpin('ext_height_ovr_minus', hal.HAL_BIT, hal.HAL_IN)
- self.extHeightOvrPlusPin = self.h.newpin('ext_height_ovr_plus', hal.HAL_BIT, hal.HAL_IN)
- self.extHeightOvrResetPin = self.h.newpin('ext_height_ovr_reset', hal.HAL_BIT, hal.HAL_IN)
- self.extHeightOvrScalePin = self.h.newpin('ext_height_ovr_scale', hal.HAL_FLOAT, hal.HAL_IN)
- self.extIgnoreArcOkPin = self.h.newpin('ext_ignore_arc_ok', hal.HAL_BIT, hal.HAL_IN)
- self.extJogSlowPin = self.h.newpin('ext_jog_slow', hal.HAL_BIT, hal.HAL_IN)
-# self.extKerfCrossEnablePin = self.h.newpin('ext_kerfcross_enable', hal.HAL_BIT, hal.HAL_IN)
- self.extLaserTouchOffPin = self.h.newpin('ext_laser_touchoff', hal.HAL_BIT, hal.HAL_IN)
- self.extLaserTogglePin = self.h.newpin('ext_laser_toggle', hal.HAL_BIT, hal.HAL_IN)
- self.extMeshModePin = self.h.newpin('ext_mesh_mode', hal.HAL_BIT, hal.HAL_IN)
- self.extOhmicPin = self.h.newpin('ext_ohmic', hal.HAL_BIT, hal.HAL_IN)
- self.extOhmicProbeEnablePin = self.h.newpin('ext_ohmic_probe_enable', hal.HAL_BIT, hal.HAL_IN)
- self.extPausePin = self.h.newpin('ext_pause', hal.HAL_BIT, hal.HAL_IN)
- self.extPauseOnlyPin = self.h.newpin('ext_pause_only', hal.HAL_BIT, hal.HAL_IN)
- self.extPowerPin = self.h.newpin('ext_power', hal.HAL_BIT, hal.HAL_IN)
- self.extProbePin = self.h.newpin('ext_probe', hal.HAL_BIT, hal.HAL_IN)
- self.extPulsePin = self.h.newpin('ext_pulse', hal.HAL_BIT, hal.HAL_IN)
- self.extResumePin = self.h.newpin('ext_resume', hal.HAL_BIT, hal.HAL_IN)
- self.extRunPausePin = self.h.newpin('ext_run_pause', hal.HAL_BIT, hal.HAL_IN)
- self.extRunPin = self.h.newpin('ext_run', hal.HAL_BIT, hal.HAL_IN)
- self.extThcEnablePin = self.h.newpin('ext_thc_enable', hal.HAL_BIT, hal.HAL_IN)
- self.extTorchEnablePin = self.h.newpin('ext_torch_enable', hal.HAL_BIT, hal.HAL_IN)
- self.extTouchOffPin = self.h.newpin('ext_touchoff', hal.HAL_BIT, hal.HAL_IN)
- self.extVoidLockEnablePin = self.h.newpin('ext_voidlock_enable', hal.HAL_BIT, hal.HAL_IN)
- self.gcodeScalePin = self.h.newpin('gcode_scale', hal.HAL_FLOAT, hal.HAL_OUT)
- self.heightOverridePin = self.h.newpin('height_override', hal.HAL_FLOAT, hal.HAL_OUT)
- self.jogInhibited = self.h.newpin('jog_inhibited', hal.HAL_BIT, hal.HAL_IN)
- self.laserOnPin = self.h.newpin('laser_on', hal.HAL_BIT, hal.HAL_OUT)
- self.offsetSetProbePin = self.h.newpin('offset_set_probe', hal.HAL_BIT, hal.HAL_OUT)
- self.offsetSetScribePin = self.h.newpin('offset_set_scribe', hal.HAL_BIT, hal.HAL_OUT)
- self.laserRecStatePin = self.h.newpin('laser_recovery_state', hal.HAL_S32, hal.HAL_IN)
- self.materialChangePin = self.h.newpin('material_change', hal.HAL_S32, hal.HAL_IN)
- self.materialChangeNumberPin = self.h.newpin('material_change_number', hal.HAL_S32, hal.HAL_IN)
- self.materialChangeTimeoutPin = self.h.newpin('material_change_timeout', hal.HAL_BIT, hal.HAL_IN)
- self.materialReloadPin = self.h.newpin('material_reload', hal.HAL_BIT, hal.HAL_IN)
- self.materialTempPin = self.h.newpin('material_temp', hal.HAL_S32, hal.HAL_IN)
- self.offsetsActivePin = self.h.newpin('offsets_active', hal.HAL_BIT, hal.HAL_IN)
- self.ohmicLedInPin = self.h.newpin('ohmic_led_in', hal.HAL_BIT, hal.HAL_IN)
- self.paramTabDisable = self.h.newpin('param_disable', hal.HAL_BIT, hal.HAL_IN)
- self.settingsTabDisable = self.h.newpin('settings_disable', hal.HAL_BIT, hal.HAL_IN)
- self.simStyleUpdate = self.h.newpin('sim_style_update', hal.HAL_BIT, hal.HAL_OUT)
- self.plasmacStatePin = self.h.newpin('plasmac_state', hal.HAL_S32, hal.HAL_IN)
- self.plasmacStopPin = self.h.newpin('plasmac_stop', hal.HAL_S32, hal.HAL_IN)
- self.pmx485CurrentPin = self.h.newpin('pmx485_current', hal.HAL_FLOAT, hal.HAL_IN)
- self.pmx485CurrentMaxPin = self.h.newpin('pmx485_current_max', hal.HAL_FLOAT, hal.HAL_IN)
- self.pmx485CurrentMinPin = self.h.newpin('pmx485_current_min', hal.HAL_FLOAT, hal.HAL_IN)
- self.pmx485FaultPin = self.h.newpin('pmx485_fault', hal.HAL_FLOAT, hal.HAL_IN)
- self.pmx485ModePin = self.h.newpin('pmx485_mode', hal.HAL_FLOAT, hal.HAL_IN)
- self.pmx485PressurePin = self.h.newpin('pmx485_pressure', hal.HAL_FLOAT, hal.HAL_IN)
- self.pmx485PressureMaxPin = self.h.newpin('pmx485_pressure_max', hal.HAL_FLOAT, hal.HAL_IN)
- self.pmx485PressureMinPin = self.h.newpin('pmx485_pressure_min', hal.HAL_FLOAT, hal.HAL_IN)
- self.pmx485StatusPin = self.h.newpin('pmx485_status', hal.HAL_BIT, hal.HAL_IN)
- self.pmx485ArcTimePin = self.h.newpin('pmx485_arc_time', hal.HAL_FLOAT, hal.HAL_IN)
- self.probeTestErrorPin = self.h.newpin('probe_test_error', hal.HAL_BIT, hal.HAL_IN)
- self.out0Pin = self.h.newpin('ext_out_0', hal.HAL_BIT, hal.HAL_OUT)
- self.out1Pin = self.h.newpin('ext_out_1', hal.HAL_BIT, hal.HAL_OUT)
- self.out2Pin = self.h.newpin('ext_out_2', hal.HAL_BIT, hal.HAL_OUT)
- self.sensorActive = self.h.newpin('sensor_active', hal.HAL_BIT, hal.HAL_IN)
- self.tabsAlwaysEnabled = self.h.newpin('tabs_always_enabled', hal.HAL_BIT, hal.HAL_IN)
- self.thcFeedRatePin = self.h.newpin('thc_feed_rate', hal.HAL_FLOAT, hal.HAL_OUT)
- self.velReduct = self.h.newpin('vel_reduct', hal.HAL_FLOAT, hal.HAL_IN)
- self.xOffsetPin = self.h.newpin('x_offset', hal.HAL_FLOAT, hal.HAL_IN)
- self.yOffsetPin = self.h.newpin('y_offset', hal.HAL_FLOAT, hal.HAL_IN)
- self.zHeightPin = self.h.newpin('z_height', hal.HAL_FLOAT, hal.HAL_IN)
- self.zOffsetPin = self.h.newpin('z_offset_counts', hal.HAL_S32, hal.HAL_IN)
- self.xMinPierceExtentPin = self.h.newpin('x_min_pierce_extent', hal.HAL_FLOAT, hal.HAL_IN)
- self.xMaxPierceExtentPin = self.h.newpin('x_max_pierce_extent', hal.HAL_FLOAT, hal.HAL_IN)
- self.yMinPierceExtentPin = self.h.newpin('y_min_pierce_extent', hal.HAL_FLOAT, hal.HAL_IN)
- self.yMaxPierceExtentPin = self.h.newpin('y_max_pierce_extent', hal.HAL_FLOAT, hal.HAL_IN)
+ 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.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)
+ self.extChangeConsPin = self.h.newpin('ext_consumables', hal.Type.BOOL, hal.Dir.IN)
+ self.extCornerLockEnablePin = self.h.newpin('ext_cornerlock_enable', hal.Type.BOOL, hal.Dir.IN)
+ self.extCutRecCancelPin = self.h.newpin('ext_cutrec_cancel', hal.Type.BOOL, hal.Dir.IN)
+ self.extCutRecRevPin = self.h.newpin('ext_cutrec_rev', hal.Type.BOOL, hal.Dir.IN)
+ self.extCutRecFwdPin = self.h.newpin('ext_cutrec_fwd', hal.Type.BOOL, hal.Dir.IN)
+ self.extCutRecNPin = self.h.newpin('ext_cutrec_n', hal.Type.BOOL, hal.Dir.IN)
+ self.extCutRecNEPin = self.h.newpin('ext_cutrec_ne', hal.Type.BOOL, hal.Dir.IN)
+ self.extCutRecEPin = self.h.newpin('ext_cutrec_e', hal.Type.BOOL, hal.Dir.IN)
+ self.extCutRecSEPin = self.h.newpin('ext_cutrec_se', hal.Type.BOOL, hal.Dir.IN)
+ self.extCutRecSPin = self.h.newpin('ext_cutrec_s', hal.Type.BOOL, hal.Dir.IN)
+ self.extCutRecSWPin = self.h.newpin('ext_cutrec_sw', hal.Type.BOOL, hal.Dir.IN)
+ 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.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)
+ self.extHeightOvrResetPin = self.h.newpin('ext_height_ovr_reset', hal.Type.BOOL, hal.Dir.IN)
+ self.extHeightOvrScalePin = self.h.newpin('ext_height_ovr_scale', hal.Type.REAL, hal.Dir.IN)
+ self.extIgnoreArcOkPin = self.h.newpin('ext_ignore_arc_ok', hal.Type.BOOL, hal.Dir.IN)
+ self.extJogSlowPin = self.h.newpin('ext_jog_slow', hal.Type.BOOL, hal.Dir.IN)
+# self.extKerfCrossEnablePin = self.h.newpin('ext_kerfcross_enable', hal.Type.BOOL, hal.Dir.IN)
+ self.extLaserTouchOffPin = self.h.newpin('ext_laser_touchoff', hal.Type.BOOL, hal.Dir.IN)
+ self.extLaserTogglePin = self.h.newpin('ext_laser_toggle', hal.Type.BOOL, hal.Dir.IN)
+ self.extMeshModePin = self.h.newpin('ext_mesh_mode', hal.Type.BOOL, hal.Dir.IN)
+ self.extOhmicPin = self.h.newpin('ext_ohmic', hal.Type.BOOL, hal.Dir.IN)
+ self.extOhmicProbeEnablePin = self.h.newpin('ext_ohmic_probe_enable', hal.Type.BOOL, hal.Dir.IN)
+ self.extPausePin = self.h.newpin('ext_pause', hal.Type.BOOL, hal.Dir.IN)
+ self.extPauseOnlyPin = self.h.newpin('ext_pause_only', hal.Type.BOOL, hal.Dir.IN)
+ self.extPowerPin = self.h.newpin('ext_power', hal.Type.BOOL, hal.Dir.IN)
+ self.extProbePin = self.h.newpin('ext_probe', hal.Type.BOOL, hal.Dir.IN)
+ self.extPulsePin = self.h.newpin('ext_pulse', hal.Type.BOOL, hal.Dir.IN)
+ self.extResumePin = self.h.newpin('ext_resume', hal.Type.BOOL, hal.Dir.IN)
+ self.extRunPausePin = self.h.newpin('ext_run_pause', hal.Type.BOOL, hal.Dir.IN)
+ self.extRunPin = self.h.newpin('ext_run', hal.Type.BOOL, hal.Dir.IN)
+ self.extThcEnablePin = self.h.newpin('ext_thc_enable', hal.Type.BOOL, hal.Dir.IN)
+ self.extTorchEnablePin = self.h.newpin('ext_torch_enable', hal.Type.BOOL, hal.Dir.IN)
+ self.extTouchOffPin = self.h.newpin('ext_touchoff', hal.Type.BOOL, hal.Dir.IN)
+ self.extVoidLockEnablePin = self.h.newpin('ext_voidlock_enable', hal.Type.BOOL, hal.Dir.IN)
+ self.gcodeScalePin = self.h.newpin('gcode_scale', hal.Type.REAL, hal.Dir.OUT)
+ self.heightOverridePin = self.h.newpin('height_override', hal.Type.REAL, hal.Dir.OUT)
+ self.jogInhibited = self.h.newpin('jog_inhibited', hal.Type.BOOL, hal.Dir.IN)
+ 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.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.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.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)
+ self.pmx485FaultPin = self.h.newpin('pmx485_fault', hal.Type.REAL, hal.Dir.IN)
+ self.pmx485ModePin = self.h.newpin('pmx485_mode', hal.Type.REAL, hal.Dir.IN)
+ self.pmx485PressurePin = self.h.newpin('pmx485_pressure', hal.Type.REAL, hal.Dir.IN)
+ self.pmx485PressureMaxPin = self.h.newpin('pmx485_pressure_max', hal.Type.REAL, hal.Dir.IN)
+ self.pmx485PressureMinPin = self.h.newpin('pmx485_pressure_min', hal.Type.REAL, hal.Dir.IN)
+ self.pmx485StatusPin = self.h.newpin('pmx485_status', hal.Type.BOOL, hal.Dir.IN)
+ self.pmx485ArcTimePin = self.h.newpin('pmx485_arc_time', hal.Type.REAL, hal.Dir.IN)
+ self.probeTestErrorPin = self.h.newpin('probe_test_error', hal.Type.BOOL, hal.Dir.IN)
+ self.out0Pin = self.h.newpin('ext_out_0', hal.Type.BOOL, hal.Dir.OUT)
+ self.out1Pin = self.h.newpin('ext_out_1', hal.Type.BOOL, hal.Dir.OUT)
+ self.out2Pin = self.h.newpin('ext_out_2', hal.Type.BOOL, hal.Dir.OUT)
+ self.sensorActive = self.h.newpin('sensor_active', hal.Type.BOOL, hal.Dir.IN)
+ self.tabsAlwaysEnabled = self.h.newpin('tabs_always_enabled', hal.Type.BOOL, hal.Dir.IN)
+ self.thcFeedRatePin = self.h.newpin('thc_feed_rate', hal.Type.REAL, hal.Dir.OUT)
+ self.velReduct = self.h.newpin('vel_reduct', hal.Type.REAL, hal.Dir.IN)
+ 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.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)
+ self.yMaxPierceExtentPin = self.h.newpin('y_max_pierce_extent', hal.Type.REAL, hal.Dir.IN)
def link_hal_pins(self):
# arc parameters
@@ -5656,10 +5656,10 @@ def pmx485_setup(self):
'cut_mode-f', 'pmx485_mode',
'cut_amps-f', 'pmx485_current', 'pmx485_current_min', 'pmx485_current_max',
'gas_pressure-f', 'pmx485_pressure', 'pmx485_pressure_min', 'pmx485_pressure_max', 'pmx485_arc_time']
- pinType = [hal.HAL_BIT, hal.HAL_BIT, hal.HAL_FLOAT,
- hal.HAL_FLOAT, hal.HAL_FLOAT,
- hal.HAL_FLOAT, hal.HAL_FLOAT, hal.HAL_FLOAT, hal.HAL_FLOAT,
- hal.HAL_FLOAT, hal.HAL_FLOAT, hal.HAL_FLOAT, hal.HAL_FLOAT, hal.HAL_FLOAT]
+ pinType = [hal.Type.BOOL, hal.Type.BOOL, hal.Type.REAL,
+ hal.Type.REAL, hal.Type.REAL,
+ hal.Type.REAL, hal.Type.REAL, hal.Type.REAL, hal.Type.REAL,
+ hal.Type.REAL, hal.Type.REAL, hal.Type.REAL, hal.Type.REAL, hal.Type.REAL]
for pin in self.pins485Comp:
hal.new_sig(f'plasmac:{pin.replace("pmx485.", "pmx485_")}', pinType[self.pins485Comp.index(pin)])
hal.connect(pin, f'plasmac:{pin.replace("pmx485.", "pmx485_")}')
diff --git a/share/qtvcp/screens/qttouchy/qttouchy_handler.py b/share/qtvcp/screens/qttouchy/qttouchy_handler.py
index e52e74a08f3..69a66c97f37 100644
--- a/share/qtvcp/screens/qttouchy/qttouchy_handler.py
+++ b/share/qtvcp/screens/qttouchy/qttouchy_handler.py
@@ -57,20 +57,20 @@ 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_BIT, QHAL.HAL_IN)
+ self.pin_cycle_start_in = QHAL.newpin('cycle-start-in',QHAL.HAL_BOOL, QHAL.HAL_IN)
self.pin_cycle_start_in.value_changed.connect(lambda s: self.cycleStart(s))
- self.pin_abort = QHAL.newpin('abort',QHAL.HAL_BIT, QHAL.HAL_IN)
+ self.pin_abort = QHAL.newpin('abort',QHAL.HAL_BOOL, QHAL.HAL_IN)
self.pin_abort.value_changed.connect(lambda s: self.abort(s))
- self.wheel_x = QHAL.newpin('jogwheel.x-enable',QHAL.HAL_BIT, QHAL.HAL_OUT)
- self.wheel_y = QHAL.newpin('jogwheel.y-enable',QHAL.HAL_BIT, QHAL.HAL_OUT)
- self.wheel_z = QHAL.newpin('jogwheel.z-enable',QHAL.HAL_BIT, QHAL.HAL_OUT)
+ self.wheel_x = QHAL.newpin('jogwheel.x-enable',QHAL.HAL_BOOL, QHAL.HAL_OUT)
+ self.wheel_y = QHAL.newpin('jogwheel.y-enable',QHAL.HAL_BOOL, QHAL.HAL_OUT)
+ self.wheel_z = QHAL.newpin('jogwheel.z-enable',QHAL.HAL_BOOL, QHAL.HAL_OUT)
- self.jog_increment = QHAL.newpin('jogwheel.increment',QHAL.HAL_FLOAT, QHAL.HAL_OUT)
+ self.jog_increment = QHAL.newpin('jogwheel.increment',QHAL.HAL_REAL, QHAL.HAL_OUT)
STATUS.connect('feed-override-changed', lambda w, data: self.w.pushbutton_fo.setText('FO {0:.0f}%'.format(data)))
STATUS.connect('rapid-override-changed', lambda w, data: self.w.pushbutton_ro.setText('RO {0:.0f}%'.format(data)))
diff --git a/share/qtvcp/screens/woodpecker/woodpecker_handler.py b/share/qtvcp/screens/woodpecker/woodpecker_handler.py
index c1c9126ab70..7b254d3727c 100644
--- a/share/qtvcp/screens/woodpecker/woodpecker_handler.py
+++ b/share/qtvcp/screens/woodpecker/woodpecker_handler.py
@@ -246,28 +246,28 @@ def init_utils(self):
#############################
def init_pins(self):
# spindle control pins
- pin = QHAL.newpin("spindle-amps", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ pin = QHAL.newpin("spindle-amps", QHAL.HAL_REAL, QHAL.HAL_IN)
pin.value_changed.connect(self.spindle_pwr_changed)
- pin = QHAL.newpin("spindle-volts", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ 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_BIT, QHAL.HAL_OUT)
+ QHAL.newpin("spindle-inhibit", QHAL.HAL_BOOL, QHAL.HAL_OUT)
# external offset control pins
- QHAL.newpin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT)
- QHAL.newpin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT)
- QHAL.newpin("eoffset-count", QHAL.HAL_S32, QHAL.HAL_OUT)
- pin = QHAL.newpin("eoffset-value", QHAL.HAL_FLOAT, QHAL.HAL_IN)
+ 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_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.HAL_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.HAL_BIT, hal.HAL_OUT)
- self.wheel_y = self.h.newpin('jog.wheel.y',hal.HAL_BIT, hal.HAL_OUT)
- self.wheel_z = self.h.newpin('jog.wheel.z',hal.HAL_BIT, hal.HAL_OUT)
- self.wheel_a = self.h.newpin('jog.wheel.a',hal.HAL_BIT, hal.HAL_OUT)
- self.jog_increment = self.h.newpin('jog.wheel.increment',hal.HAL_FLOAT, hal.HAL_OUT)
+ 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)
+ self.wheel_z = self.h.newpin('jog.wheel.z',hal.Type.BOOL, hal.Dir.OUT)
+ self.wheel_a = self.h.newpin('jog.wheel.a',hal.Type.BOOL, hal.Dir.OUT)
+ self.jog_increment = self.h.newpin('jog.wheel.increment',hal.Type.REAL, hal.Dir.OUT)
def init_preferences(self):
if not self.w.PREFS_:
diff --git a/src/Makefile b/src/Makefile
index 2c56a18ed3a..d6545133cc9 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -553,7 +553,7 @@ genclean:
-rm -f ../lib/*.so.[0-9]*
-rm -f $(GENERATED_MANPAGES)
-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 8905ad05d13..2aaf9af43df 100644
--- a/src/emc/motion/command.c
+++ b/src/emc/motion/command.c
@@ -1853,7 +1853,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 2ddf587b484..8fb473ea504 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;
@@ -225,8 +225,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;
@@ -235,7 +235,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;
}
@@ -522,12 +522,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);
@@ -1043,7 +1043,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 */
@@ -1066,7 +1066,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;
@@ -1895,8 +1895,8 @@ static void output_to_hal(void)
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]);
+ 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
@@ -1970,9 +1970,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);
@@ -1998,14 +1998,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++){
@@ -2223,7 +2223,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 64cbb507132..011c1b221c2 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 d2cb7615958..9985268e232 100644
--- a/src/emc/motion/motion.c
+++ b/src/emc/motion/motion.c
@@ -594,7 +594,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"));
@@ -602,12 +602,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 */
@@ -622,21 +622,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));
@@ -646,7 +646,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"));
@@ -724,11 +724,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));
@@ -760,7 +760,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));
@@ -1014,7 +1014,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",
@@ -1022,7 +1022,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",
@@ -1031,14 +1031,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 1312b5e45dd..2a38bd2b7a4 100644
--- a/src/emc/motion/motion.h
+++ b/src/emc/motion/motion.h
@@ -483,7 +483,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;
@@ -534,7 +534,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 d0f2d4b8b63..a5c3a3a6913 100644
--- a/src/emc/rs274ngc/interp_namedparams.cc
+++ b/src/emc/rs274ngc/interp_namedparams.cc
@@ -326,8 +326,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 c14064dead9..ba6889b4196 100644
--- a/src/emc/rs274ngc/rs274ngc_pre.cc
+++ b/src/emc/rs274ngc/rs274ngc_pre.cc
@@ -2264,7 +2264,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 f9f04cc72a5..350e1dab87d 100755
--- a/src/emc/usr_intf/axis/scripts/axis.py
+++ b/src/emc/usr_intf/axis/scripts/axis.py
@@ -3942,22 +3942,22 @@ def select_run_from(e):
if hal_present == 1 :
comp = hal.component("axisui")
- comp.newpin("jog.x", hal.HAL_BIT, hal.HAL_OUT)
- comp.newpin("jog.y", hal.HAL_BIT, hal.HAL_OUT)
- comp.newpin("jog.z", hal.HAL_BIT, hal.HAL_OUT)
- comp.newpin("jog.a", hal.HAL_BIT, hal.HAL_OUT)
- comp.newpin("jog.b", hal.HAL_BIT, hal.HAL_OUT)
- comp.newpin("jog.c", hal.HAL_BIT, hal.HAL_OUT)
- comp.newpin("jog.u", hal.HAL_BIT, hal.HAL_OUT)
- comp.newpin("jog.v", hal.HAL_BIT, hal.HAL_OUT)
- comp.newpin("jog.w", hal.HAL_BIT, hal.HAL_OUT)
- comp.newpin("jog.increment", hal.HAL_FLOAT, hal.HAL_OUT)
- comp.newpin("notifications-clear",hal.HAL_BIT,hal.HAL_IN)
- comp.newpin("notifications-clear-info",hal.HAL_BIT,hal.HAL_IN)
- comp.newpin("notifications-clear-error",hal.HAL_BIT,hal.HAL_IN)
- comp.newpin("resume-inhibit",hal.HAL_BIT,hal.HAL_IN)
- comp.newpin("error", hal.HAL_BIT, hal.HAL_OUT)
- comp.newpin("abort", hal.HAL_BIT, hal.HAL_OUT)
+ comp.newpin("jog.x", hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("jog.y", hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("jog.z", hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("jog.a", hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("jog.b", hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("jog.c", hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("jog.u", hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("jog.v", hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("jog.w", hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("jog.increment", hal.Type.REAL, hal.Dir.OUT)
+ comp.newpin("notifications-clear",hal.Type.BOOL,hal.Dir.IN)
+ comp.newpin("notifications-clear-info",hal.Type.BOOL,hal.Dir.IN)
+ comp.newpin("notifications-clear-error",hal.Type.BOOL,hal.Dir.IN)
+ comp.newpin("resume-inhibit",hal.Type.BOOL,hal.Dir.IN)
+ comp.newpin("error", hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("abort", hal.Type.BOOL, hal.Dir.OUT)
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 6308fb73865..65ec28150ec 100644
--- a/src/emc/usr_intf/axis/scripts/hal_manualtoolchange.py
+++ b/src/emc/usr_intf/axis/scripts/hal_manualtoolchange.py
@@ -78,10 +78,10 @@ def get_tool_change_message(n):
h = hal.component("hal_manualtoolchange")
-h.newpin("number", hal.HAL_S32, hal.HAL_IN)
-h.newpin("change", hal.HAL_BIT, hal.HAL_IN)
-h.newpin("change_button", hal.HAL_BIT, hal.HAL_IN)
-h.newpin("changed", hal.HAL_BIT, hal.HAL_OUT)
+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)
h.ready()
import nf, rs274.options
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/axis/scripts/tracking-test.py b/src/emc/usr_intf/axis/scripts/tracking-test.py
index 0fbc7695a80..d7e0d2244a5 100755
--- a/src/emc/usr_intf/axis/scripts/tracking-test.py
+++ b/src/emc/usr_intf/axis/scripts/tracking-test.py
@@ -15,18 +15,18 @@
compname = "tracking-test"
c = hal.component(compname)
#declare hal pins here
-c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("axis0", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("axis1", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("axis2", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("axis3", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("axis4", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("axis5", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("joint0", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint1", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint2", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint3", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint4", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint5", hal.Type.REAL, hal.Dir.IN)
+c.newpin("axis0", hal.Type.REAL, hal.Dir.IN)
+c.newpin("axis1", hal.Type.REAL, hal.Dir.IN)
+c.newpin("axis2", hal.Type.REAL, hal.Dir.IN)
+c.newpin("axis3", hal.Type.REAL, hal.Dir.IN)
+c.newpin("axis4", hal.Type.REAL, hal.Dir.IN)
+c.newpin("axis5", hal.Type.REAL, hal.Dir.IN)
c.ready()
diff --git a/src/emc/usr_intf/gmoccapy/gmoccapy.py b/src/emc/usr_intf/gmoccapy/gmoccapy.py
index f468e9ca8a9..d6e9bb4f11c 100644
--- a/src/emc/usr_intf/gmoccapy/gmoccapy.py
+++ b/src/emc/usr_intf/gmoccapy/gmoccapy.py
@@ -2640,20 +2640,20 @@ def _init_user_messages(self):
return
for message in user_messages:
if message[1] == "status":
- pin = hal_glib.GPin(self.halcomp.newpin("messages." + message[2], hal.HAL_BIT, hal.HAL_IN))
+ pin = hal_glib.GPin(self.halcomp.newpin("messages." + message[2], hal.Type.BOOL, hal.Dir.IN))
pin.connect("value_changed", self._show_user_message, message)
elif message[1] == "okdialog":
- pin = hal_glib.GPin(self.halcomp.newpin("messages." + message[2], hal.HAL_BIT, hal.HAL_IN))
+ pin = hal_glib.GPin(self.halcomp.newpin("messages." + message[2], hal.Type.BOOL, hal.Dir.IN))
pin.connect("value_changed", self._show_user_message, message)
pin = hal_glib.GPin(
- self.halcomp.newpin("messages." + message[2] + "-waiting", hal.HAL_BIT, hal.HAL_OUT))
+ self.halcomp.newpin("messages." + message[2] + "-waiting", hal.Type.BOOL, hal.Dir.OUT))
elif message[1] == "yesnodialog":
- pin = hal_glib.GPin(self.halcomp.newpin("messages." + message[2], hal.HAL_BIT, hal.HAL_IN))
+ pin = hal_glib.GPin(self.halcomp.newpin("messages." + message[2], hal.Type.BOOL, hal.Dir.IN))
pin.connect("value_changed", self._show_user_message, message)
pin = hal_glib.GPin(
- self.halcomp.newpin("messages." + message[2] + "-waiting", hal.HAL_BIT, hal.HAL_OUT))
+ self.halcomp.newpin("messages." + message[2] + "-waiting", hal.Type.BOOL, hal.Dir.OUT))
pin = hal_glib.GPin(
- self.halcomp.newpin("messages." + message[2] + "-response", hal.HAL_BIT, hal.HAL_OUT))
+ self.halcomp.newpin("messages." + message[2] + "-response", hal.Type.BOOL, hal.Dir.OUT))
else:
LOG.error(_("Message type {0} not supported").format(message[1]))
@@ -6399,135 +6399,135 @@ def _get_child_button(self, location, number = None):
def _make_hal_pins(self):
# generate the horizontal button pins
for h_button in range(0, 10):
- pin = self.halcomp.newpin("h-button.button-{0}".format(h_button), hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("h-button.button-{0}".format(h_button), hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._button_pin_changed)
# generate the vertical button pins
for v_button in range(0, 7):
- pin = self.halcomp.newpin("v-button.button-{0}".format(v_button), hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("v-button.button-{0}".format(v_button), hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._button_pin_changed)
# buttons for jogging the axis
for jog_button in self.axis_list:
- pin = self.halcomp.newpin("jog.axis.jog-{0}-plus".format(jog_button), hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("jog.axis.jog-{0}-plus".format(jog_button), hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_pin_jog_changed, "{0}+".format(jog_button))
- pin = self.halcomp.newpin("jog.axis.jog-{0}-minus".format(jog_button), hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("jog.axis.jog-{0}-minus".format(jog_button), hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_pin_jog_changed, "{0}-".format(jog_button))
if self.stat.kinematics_type != linuxcnc.KINEMATICS_IDENTITY:
for joint_button in range(0, self.stat.joints):
- pin = self.halcomp.newpin("jog.joint.jog-{0}-plus".format(joint_button), hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("jog.joint.jog-{0}-plus".format(joint_button), hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_pin_jog_changed, "{0}+".format(joint_button))
- pin = self.halcomp.newpin("jog.joint.jog-{0}-minus".format(joint_button), hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("jog.joint.jog-{0}-minus".format(joint_button), hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_pin_jog_changed, "{0}+".format(joint_button))
# jog_increment out pin
- self.halcomp.newpin("jog.jog-increment", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.halcomp.newpin("jog.jog-increment", hal.Type.REAL, hal.Dir.OUT)
# generate the pins to set the increments
for buttonnumber in range(0, len(self.jog_increments)):
- pin = self.halcomp.newpin("jog.jog-inc-{0}".format(buttonnumber), hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("jog.jog-inc-{0}".format(buttonnumber), hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_pin_incr_changed, buttonnumber)
# make the pin for unlocking settings page
- pin = self.halcomp.newpin("unlock-settings", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("unlock-settings", hal.Type.BOOL, hal.Dir.IN)
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.HAL_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.HAL_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.HAL_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.HAL_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.HAL_BIT, hal.HAL_IN)
- self.halcomp.newpin("spindle.spindle-override.count-enable", hal.HAL_BIT, hal.HAL_IN)
- self.halcomp.newpin("jog.jog-velocity.count-enable", hal.HAL_BIT, hal.HAL_IN)
- self.halcomp.newpin("rapid.rapid-override.count-enable", hal.HAL_BIT, hal.HAL_IN)
+ 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)
+ self.halcomp.newpin("jog.jog-velocity.count-enable", hal.Type.BOOL, hal.Dir.IN)
+ self.halcomp.newpin("rapid.rapid-override.count-enable", hal.Type.BOOL, hal.Dir.IN)
# generate the pins to connect analog inputs for sliders
- pin = self.halcomp.newpin("feed.feed-override.analog-enable", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("feed.feed-override.analog-enable", hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_analog_enable_changed, "spc_feed")
- pin = self.halcomp.newpin("spindle.spindle-override.analog-enable", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("spindle.spindle-override.analog-enable", hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_analog_enable_changed, "spc_spindle")
- pin = self.halcomp.newpin("jog.jog-velocity.analog-enable", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("jog.jog-velocity.analog-enable", hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_analog_enable_changed, "spc_lin_jog_vel")
- pin = self.halcomp.newpin("rapid.rapid-override.analog-enable", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("rapid.rapid-override.analog-enable", hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_analog_enable_changed, "spc_rapid")
- pin = self.halcomp.newpin("feed.feed-override.direct-value", hal.HAL_FLOAT, hal.HAL_IN)
+ pin = self.halcomp.newpin("feed.feed-override.direct-value", hal.Type.REAL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_analog_value_changed, "spc_feed")
- pin = self.halcomp.newpin("spindle.spindle-override.direct-value", hal.HAL_FLOAT, hal.HAL_IN)
+ pin = self.halcomp.newpin("spindle.spindle-override.direct-value", hal.Type.REAL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_analog_value_changed, "spc_spindle")
- pin = self.halcomp.newpin("jog.jog-velocity.direct-value", hal.HAL_FLOAT, hal.HAL_IN)
+ pin = self.halcomp.newpin("jog.jog-velocity.direct-value", hal.Type.REAL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_analog_value_changed, "spc_lin_jog_vel")
- pin = self.halcomp.newpin("rapid.rapid-override.direct-value", hal.HAL_FLOAT, hal.HAL_IN)
+ pin = self.halcomp.newpin("rapid.rapid-override.direct-value", hal.Type.REAL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_analog_value_changed, "spc_rapid")
# make a pin to set turtle jog vel
- pin = self.halcomp.newpin("jog.turtle-jog", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("jog.turtle-jog", hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._on_pin_turtle_jog)
# make the pins for tool measurement
- self.halcomp.newpin("probeheight", hal.HAL_FLOAT, hal.HAL_OUT)
- pin = self.halcomp.newpin("blockheight", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.halcomp.newpin("probeheight", hal.Type.REAL, hal.Dir.OUT)
+ pin = self.halcomp.newpin("blockheight", hal.Type.REAL, hal.Dir.OUT)
hal_glib.GPin(pin).connect("value_changed", self._on_blockheight_value_changed)
preset = self.prefs.getpref("blockheight", 0.0, float)
self.halcomp["blockheight"] = preset
- self.halcomp.newpin("toolmeasurement", hal.HAL_BIT, hal.HAL_OUT)
- self.halcomp.newpin("searchvel", hal.HAL_FLOAT, hal.HAL_OUT)
- self.halcomp.newpin("probevel", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.halcomp.newpin("toolmeasurement", hal.Type.BOOL, hal.Dir.OUT)
+ self.halcomp.newpin("searchvel", hal.Type.REAL, hal.Dir.OUT)
+ self.halcomp.newpin("probevel", hal.Type.REAL, hal.Dir.OUT)
# make pins to react to tool_offset changes
- pin = self.halcomp.newpin("tooloffset-x", hal.HAL_FLOAT, hal.HAL_IN)
+ pin = self.halcomp.newpin("tooloffset-x", hal.Type.REAL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._offset_changed, "tooloffset-x")
- pin = self.halcomp.newpin("tooloffset-z", hal.HAL_FLOAT, hal.HAL_IN)
+ pin = self.halcomp.newpin("tooloffset-z", hal.Type.REAL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._offset_changed, "tooloffset-z")
- self.halcomp.newpin("tool-diameter", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.halcomp.newpin("tool-diameter", hal.Type.REAL, hal.Dir.OUT)
# make a pin to delete a notification message
- pin = self.halcomp.newpin("delete-message", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("delete-message", hal.Type.BOOL, hal.Dir.IN)
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.HAL_IN)
- self.halcomp.newpin("toolchange-changed", hal.HAL_BIT, hal.HAL_OUT)
- pin = self.halcomp.newpin('toolchange-change', hal.HAL_BIT, hal.HAL_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)
- self.halcomp.newpin('toolchange-confirm', hal.HAL_BIT, hal.HAL_IN)
+ self.halcomp.newpin('toolchange-confirm', hal.Type.BOOL, hal.Dir.IN)
# make a pin to confirm a warning dialog
- self.halcomp.newpin('warning-confirm', hal.HAL_BIT, hal.HAL_IN)
+ self.halcomp.newpin('warning-confirm', hal.Type.BOOL, hal.Dir.IN)
# make a pin to reset feed override to 100 %
- pin = self.halcomp.newpin("feed.reset-feed-override", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("feed.reset-feed-override", hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._reset_override, "feed")
# make a pin to reset rapid override to 100 %
- pin = self.halcomp.newpin("rapid.reset-rapid-override", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("rapid.reset-rapid-override", hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._reset_override, "rapid")
# make a pin to reset spindle override to 100 %
- pin = self.halcomp.newpin("spindle.reset-spindle-override", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("spindle.reset-spindle-override", hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._reset_override, "spindle")
# make an error pin to indicate a error to hardware
- self.halcomp.newpin("error", hal.HAL_BIT, hal.HAL_OUT)
+ 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.HAL_OUT)
- self.halcomp.newpin("program.current-line", hal.HAL_S32, hal.HAL_OUT)
- self.halcomp.newpin("program.progress", hal.HAL_FLOAT, hal.HAL_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
- pin = self.halcomp.newpin("ignore-limits", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("ignore-limits", hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._ignore_limits)
# make pins to set optional stops and block delete
- pin = self.halcomp.newpin("optional-stop", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("optional-stop", hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._optional_blocks)
- pin = self.halcomp.newpin("blockdelete", hal.HAL_BIT, hal.HAL_IN)
+ pin = self.halcomp.newpin("blockdelete", hal.Type.BOOL, hal.Dir.IN)
hal_glib.GPin(pin).connect("value_changed", self._blockdelete)
diff --git a/src/emc/usr_intf/gscreen/gscreen.py b/src/emc/usr_intf/gscreen/gscreen.py
index a8d10ca6058..42ca2ec21e1 100755
--- a/src/emc/usr_intf/gscreen/gscreen.py
+++ b/src/emc/usr_intf/gscreen/gscreen.py
@@ -1652,49 +1652,49 @@ def initialize_pins(self):
def init_spindle_pins(self):
"""creates a HAL float in pin for control the spindle readout meter
"""
- self.halcomp.newpin("spindle-readout-in", hal.HAL_FLOAT, hal.HAL_IN)
+ self.halcomp.newpin("spindle-readout-in", hal.Type.REAL, hal.Dir.IN)
def init_coolant_pins(self):
- """create HAL BIT out pins to control coolant
+ """create HAL BOOL out pins to control coolant
"""
- self.halcomp.newpin("aux-coolant-m7-out", hal.HAL_BIT, hal.HAL_OUT)
- self.halcomp.newpin("aux-coolant-m8-out", hal.HAL_BIT, hal.HAL_OUT)
- self.halcomp.newpin("mist-coolant-out", hal.HAL_BIT, hal.HAL_OUT)
- self.halcomp.newpin("flood-coolant-out", hal.HAL_BIT, hal.HAL_OUT)
+ self.halcomp.newpin("aux-coolant-m7-out", hal.Type.BOOL, hal.Dir.OUT)
+ self.halcomp.newpin("aux-coolant-m8-out", hal.Type.BOOL, hal.Dir.OUT)
+ self.halcomp.newpin("mist-coolant-out", hal.Type.BOOL, hal.Dir.OUT)
+ self.halcomp.newpin("flood-coolant-out", hal.Type.BOOL, hal.Dir.OUT)
def init_jog_pins(self):
- """create HAL BIT out pins for all axis jog enable
- create HAL BIT out for jog mode enabled
- create HAL FLOAT out pin for current jog increment
+ """create HAL BOOL out pins for all axis jog enable
+ create HAL BOOL out for jog mode enabled
+ create HAL REAL out pin for current jog increment
These could be used for MPG selecting
"""
for axis in self.data.axis_list:
- self.halcomp.newpin("jog-enable-%s-out"% (axis), hal.HAL_BIT, hal.HAL_OUT)
- self.halcomp.newpin("jog-enable-out", hal.HAL_BIT, hal.HAL_OUT)
- self.halcomp.newpin("jog-increment-out", hal.HAL_FLOAT, hal.HAL_OUT)
- #self.data['jog-increment-in'] = hal_glib.GPin(self.halcomp.newpin('jog-increment-in', hal.HAL_S32, hal.HAL_IN))
+ 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.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.HAL_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
def init_override_pins(self):
- """creates HAL BIT pins for spindle,feed and Max velocity overrides.
+ """creates HAL BOOL pins for spindle,feed and Max velocity overrides.
used as selection pins for an encoder to set values
"""
- self.halcomp.newpin("s-override-enable-out", hal.HAL_BIT, hal.HAL_OUT)
- self.halcomp.newpin("f-override-enable-out", hal.HAL_BIT, hal.HAL_OUT)
- self.halcomp.newpin("mv-override-enable-out", hal.HAL_BIT, hal.HAL_OUT)
+ self.halcomp.newpin("s-override-enable-out", hal.Type.BOOL, hal.Dir.OUT)
+ self.halcomp.newpin("f-override-enable-out", hal.Type.BOOL, hal.Dir.OUT)
+ self.halcomp.newpin("mv-override-enable-out", hal.Type.BOOL, hal.Dir.OUT)
def init_control_pins(self):
"""Creates and registers function calls for start,abort and feed_hold pins
calls self.on_cycle_start_changed, self.on_abort_changed, self.on_feed_hold_changed
"""
- self.data['cycle_start'] = hal_glib.GPin(self.halcomp.newpin('cycle-start', hal.HAL_BIT, hal.HAL_IN))
+ self.data['cycle_start'] = hal_glib.GPin(self.halcomp.newpin('cycle-start', hal.Type.BOOL, hal.Dir.IN))
self.data['cycle_start'].connect('value-changed', self.on_cycle_start_changed)
- self.data['abort'] = hal_glib.GPin(self.halcomp.newpin('abort', hal.HAL_BIT, hal.HAL_IN))
+ self.data['abort'] = hal_glib.GPin(self.halcomp.newpin('abort', hal.Type.BOOL, hal.Dir.IN))
self.data['abort'].connect('value-changed', self.on_abort_changed)
- self.data['feed_hold'] = hal_glib.GPin(self.halcomp.newpin('feed-hold', hal.HAL_BIT, hal.HAL_IN))
+ self.data['feed_hold'] = hal_glib.GPin(self.halcomp.newpin('feed-hold', hal.Type.BOOL, hal.Dir.IN))
self.data['feed_hold'].connect('value-changed', self.on_feed_hold_changed)
def initialize_manual_toolchange(self):
@@ -1706,9 +1706,9 @@ def initialize_manual_toolchange(self):
or the default function
"""
# for manual tool change dialog
- self.halcomp.newpin("tool-number", hal.HAL_S32, hal.HAL_IN)
- self.halcomp.newpin("tool-changed", hal.HAL_BIT, hal.HAL_OUT)
- self.data['change-tool'] = hal_glib.GPin(self.halcomp.newpin('change-tool', hal.HAL_BIT, hal.HAL_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
if "on_tool_change" in dir(self.handler_instance):
self.data['change-tool'].connect('value-changed', self.handler_instance.on_tool_change)
@@ -3808,12 +3808,12 @@ def message_setup(self):
continue
if not name == None:
# this is how we make a pin that can be connected to a callback
- self.data['name'] = hal_glib.GPin(self.halcomp.newpin(name, hal.HAL_BIT, hal.HAL_IN))
+ self.data['name'] = hal_glib.GPin(self.halcomp.newpin(name, hal.Type.BOOL, hal.Dir.IN))
self.data['name'].connect('value-changed', self.on_printmessage,name,bt,t,c)
if ("dialog" in c):
- self.halcomp.newpin(name+"-waiting", hal.HAL_BIT, hal.HAL_OUT)
+ self.halcomp.newpin(name+"-waiting", hal.Type.BOOL, hal.Dir.OUT)
if not ("ok" in c):
- self.halcomp.newpin(name+"-response", hal.HAL_BIT, hal.HAL_OUT)
+ self.halcomp.newpin(name+"-response", hal.Type.BOOL, hal.Dir.OUT)
# display dialog
def warning_dialog(self,message, displaytype, secondary=None,pinname=None):
diff --git a/src/emc/usr_intf/mdro/mdro.py b/src/emc/usr_intf/mdro/mdro.py
index e1ac9c3a635..f0848ca4136 100755
--- a/src/emc/usr_intf/mdro/mdro.py
+++ b/src/emc/usr_intf/mdro/mdro.py
@@ -34,10 +34,10 @@ def __init__(self):
self.h = hal.component("mdro")
self.pins = ["axis."+str(p) for p in range(params["naxes"])]
for pin in self.pins:
- self.h.newpin(pin, hal.HAL_FLOAT, hal.HAL_IN)
+ self.h.newpin(pin, hal.Type.REAL, hal.Dir.IN)
self.indexes = ["index-enable."+str(p) for p in range(params["naxes"])]
for pin in self.indexes:
- self.h.newpin(pin, hal.HAL_BIT, hal.HAL_IO)
+ self.h.newpin(pin, hal.Type.BOOL, hal.Dir.IO)
self.h.ready()
if params["verbose"]:
print("Linuxcnc interface up")
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 10f411ef3d9..09242a401b2 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.HAL_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(" ")
@@ -1425,15 +1425,15 @@ def make_blank(self,container,boardnum,number):
def make_enc(self,container,boardnum,number):
encname = "brd.%d.enc.%d.reset" % (boardnum,number)
print("making HAL pin enc bit Brd %d,num %d"%(boardnum,number))
- self.hal.c.newpin(encname, hal.HAL_BIT, hal.HAL_OUT)
- hal.new_sig(encname+"-signal",hal.HAL_BIT)
+ self.hal.c.newpin(encname, hal.Type.BOOL, hal.Dir.OUT)
+ hal.new_sig(encname+"-signal",hal.Type.BOOL)
hal.connect("testpanel."+encname,encname+"-signal")
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.HAL_IN)
- hal.new_sig(encname+"-signal",hal.HAL_S32)
+ 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)
@@ -1442,12 +1442,12 @@ def make_enc(self,container,boardnum,number):
# This creates widgets and HAL pins for stepper controls
def make_stp(self,container,boardnum,number):
stpname = "brd.%d.stp.%d.position-cmd" % (boardnum,number)
- self.hal.c.newpin(stpname, hal.HAL_FLOAT, hal.HAL_OUT)
- hal.new_sig(stpname+"-signal",hal.HAL_FLOAT)
+ self.hal.c.newpin(stpname, hal.Type.REAL, hal.Dir.OUT)
+ hal.new_sig(stpname+"-signal",hal.Type.REAL)
hal.connect("testpanel."+stpname,stpname+"-signal")
stpname = "brd.%d.stp.%d.enable" % (boardnum,number)
- self.hal.c.newpin(stpname, hal.HAL_BIT, hal.HAL_OUT)
- hal.new_sig(stpname+"-signal",hal.HAL_BIT)
+ self.hal.c.newpin(stpname, hal.Type.BOOL, hal.Dir.OUT)
+ hal.new_sig(stpname+"-signal",hal.Type.BOOL)
hal.connect("testpanel."+stpname,stpname+"-signal")
adj = Gtk.Adjustment(0.0, -1000.0, 1000.0, 1.0, 5.0, 0.0)
spin = self.data2["brd%dstp%dcmd" % (boardnum,number)]= Gtk.SpinButton(adj, 0, 1)
@@ -1462,13 +1462,13 @@ def make_stp(self,container,boardnum,number):
def make_pwm(self,container,boardnum,number):
pwmname = "brd.%d.pwm.%d.value" % (boardnum,number)
print("making HAL pin pwm float brd%d num %d"%(boardnum,number))
- self.hal.c.newpin(pwmname, hal.HAL_FLOAT, hal.HAL_OUT)
- hal.new_sig(pwmname+"-signal",hal.HAL_FLOAT)
+ self.hal.c.newpin(pwmname, hal.Type.REAL, hal.Dir.OUT)
+ hal.new_sig(pwmname+"-signal",hal.Type.REAL)
hal.connect("testpanel."+pwmname,pwmname+"-signal")
pwmname = "brd.%d.pwm.%d.enable" % (boardnum,number)
print("making HAL pin pwm bit brd %d num %d"%(boardnum,number))
- self.hal.c.newpin(pwmname, hal.HAL_BIT, hal.HAL_OUT)
- hal.new_sig(pwmname+"-signal",hal.HAL_BIT)
+ self.hal.c.newpin(pwmname, hal.Type.BOOL, hal.Dir.OUT)
+ hal.new_sig(pwmname+"-signal",hal.Type.BOOL)
hal.connect("testpanel."+pwmname,pwmname+"-signal")
adj = self.data2["brd%dpwm%dadj" % (boardnum,number)] = Gtk.Adjustment(0.0, -10.0, 10.0, 0.1, 0.5, 0.0)
adj.connect("value_changed", self.pwm_callback,"pwm",boardnum,number,None)
@@ -1486,8 +1486,8 @@ def make_pwm(self,container,boardnum,number):
def make_led(self,container,boardnum,number):
ledname = "brd.%d.led.%d" % (boardnum,number)
print("making HAL pin led bit brd %d num %d"%(boardnum,number))
- self.hal.c.newpin(ledname, hal.HAL_BIT, hal.HAL_IN)
- hal.new_sig(ledname+"-signal",hal.HAL_BIT)
+ self.hal.c.newpin(ledname, hal.Type.BOOL, hal.Dir.IN)
+ hal.new_sig(ledname+"-signal",hal.Type.BOOL)
hal.connect("testpanel."+ledname,ledname+"-signal")
led = self.data2["brd%dled%d" % (boardnum,number)] = LED(self)
led.set_color("off",[1,0,0]) # red
@@ -1503,8 +1503,8 @@ def make_switch(self,container,boardnum,number):
# make a HAL pin
switchname = "brd.%d.switch.%d" % (boardnum,number)
print("making HAL pin switch bit brd %d num %d"%(boardnum,number))
- self.hal.c.newpin(switchname, hal.HAL_BIT, hal.HAL_OUT)
- hal.new_sig(switchname+"-signal",hal.HAL_BIT)
+ self.hal.c.newpin(switchname, hal.Type.BOOL, hal.Dir.OUT)
+ hal.new_sig(switchname+"-signal",hal.Type.BOOL)
hal.connect("testpanel."+switchname,switchname+"-signal")
# add button to container using boarnum and number as a reference
button = self.data2["brd%dswch%d" % (boardnum,number)]= Gtk.Button("OUT-%d"% number)
diff --git a/src/emc/usr_intf/pyui/widgets.py b/src/emc/usr_intf/pyui/widgets.py
index 0a037ea216b..bb63b98452a 100644
--- a/src/emc/usr_intf/pyui/widgets.py
+++ b/src/emc/usr_intf/pyui/widgets.py
@@ -30,19 +30,19 @@ def hal_init(self, master, comp, name,metadata,command,widgets,dbg):
# convert and set pintype and states based on metadata types
if self.metadata['OUTPUT'] == 'S32':
- self.pintype=hal.HAL_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
+ 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'] == 'FLOAT':
- self.pintype=hal.HAL_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'] == 'BIT':
- self.pintype=hal.HAL_BIT
+ self.pintype=hal.Type.BOOL
self.true_state = True#self.metadata['TRUE_STATE']
self.false_state = False#self.metadata['FALSE_STATE']
elif self.metadata['OUTPUT'] == 'COMMAND':
@@ -104,12 +104,12 @@ def _hal_init(self):
pass
# If not a command output requested make the pins
if pintype not in(None,'COMMAND','ZMQ'):
- self.hal_pin = self.hal.newpin(self.hal_name, pintype, hal.HAL_OUT)
- self.hal_pin_not = self.hal.newpin(self.hal_name + "-not", pintype, hal.HAL_OUT)
+ self.hal_pin = self.hal.newpin(self.hal_name, pintype, hal.Dir.OUT)
+ self.hal_pin_not = self.hal.newpin(self.hal_name + "-not", pintype, hal.Dir.OUT)
# If there is a status requested make there pins
if self.status_pin:
- self.hal_status_pin = self.hal.newpin(self.hal_name+ "-state", hal.HAL_BIT, hal.HAL_OUT)
- self.hal_status_pin_not = self.hal.newpin(self.hal_name+ "-state-not", hal.HAL_BIT, hal.HAL_OUT)
+ self.hal_status_pin = self.hal.newpin(self.hal_name+ "-state", hal.Type.BOOL, hal.Dir.OUT)
+ self.hal_status_pin_not = self.hal.newpin(self.hal_name+ "-state-not", hal.Type.BOOL, hal.Dir.OUT)
# Update the pin to the proper state, but don't print debug for this
if pintype not in ('COMMAND','ZMQ'):
DBG_suppress = True
diff --git a/src/emc/usr_intf/touchy/hal_interface.py b/src/emc/usr_intf/touchy/hal_interface.py
index f53808f3683..18802297492 100644
--- a/src/emc/usr_intf/touchy/hal_interface.py
+++ b/src/emc/usr_intf/touchy/hal_interface.py
@@ -22,67 +22,67 @@ def __init__(self, gui, emc_control, mdi_control, emc):
self.emc_stat = self.emc.stat()
self.mdi_control = mdi_control
self.c = hal.component("touchy")
- self.c.newpin("status-indicator", hal.HAL_BIT, hal.HAL_OUT)
- self.c.newpin("jog.active", hal.HAL_BIT, hal.HAL_OUT)
- self.c.newpin("jog.wheel.x", hal.HAL_BIT, hal.HAL_OUT)
- self.c.newpin("jog.wheel.y", hal.HAL_BIT, hal.HAL_OUT)
- self.c.newpin("jog.wheel.z", hal.HAL_BIT, hal.HAL_OUT)
- self.c.newpin("jog.wheel.a", hal.HAL_BIT, hal.HAL_OUT)
- self.c.newpin("jog.wheel.b", hal.HAL_BIT, hal.HAL_OUT)
- self.c.newpin("jog.wheel.c", hal.HAL_BIT, hal.HAL_OUT)
- self.c.newpin("jog.wheel.u", hal.HAL_BIT, hal.HAL_OUT)
- self.c.newpin("jog.wheel.v", hal.HAL_BIT, hal.HAL_OUT)
- self.c.newpin("jog.wheel.w", hal.HAL_BIT, hal.HAL_OUT)
- self.c.newpin("jog.wheel.increment", hal.HAL_FLOAT, hal.HAL_OUT)
-
- self.c.newpin("jog.continuous.x.positive", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("status-indicator", hal.Type.BOOL, hal.Dir.OUT)
+ self.c.newpin("jog.active", hal.Type.BOOL, hal.Dir.OUT)
+ self.c.newpin("jog.wheel.x", hal.Type.BOOL, hal.Dir.OUT)
+ self.c.newpin("jog.wheel.y", hal.Type.BOOL, hal.Dir.OUT)
+ self.c.newpin("jog.wheel.z", hal.Type.BOOL, hal.Dir.OUT)
+ self.c.newpin("jog.wheel.a", hal.Type.BOOL, hal.Dir.OUT)
+ self.c.newpin("jog.wheel.b", hal.Type.BOOL, hal.Dir.OUT)
+ self.c.newpin("jog.wheel.c", hal.Type.BOOL, hal.Dir.OUT)
+ self.c.newpin("jog.wheel.u", hal.Type.BOOL, hal.Dir.OUT)
+ self.c.newpin("jog.wheel.v", hal.Type.BOOL, hal.Dir.OUT)
+ self.c.newpin("jog.wheel.w", hal.Type.BOOL, hal.Dir.OUT)
+ self.c.newpin("jog.wheel.increment", hal.Type.REAL, hal.Dir.OUT)
+
+ self.c.newpin("jog.continuous.x.positive", hal.Type.BOOL, hal.Dir.IN)
self.xp = 0
- self.c.newpin("jog.continuous.x.negative", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.x.negative", hal.Type.BOOL, hal.Dir.IN)
self.xn = 0
- self.c.newpin("jog.continuous.y.positive", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.y.positive", hal.Type.BOOL, hal.Dir.IN)
self.yp = 0
- self.c.newpin("jog.continuous.y.negative", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.y.negative", hal.Type.BOOL, hal.Dir.IN)
self.yn = 0
- self.c.newpin("jog.continuous.z.positive", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.z.positive", hal.Type.BOOL, hal.Dir.IN)
self.zp = 0
- self.c.newpin("jog.continuous.z.negative", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.z.negative", hal.Type.BOOL, hal.Dir.IN)
self.zn = 0
- self.c.newpin("jog.continuous.a.positive", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.a.positive", hal.Type.BOOL, hal.Dir.IN)
self.ap = 0
- self.c.newpin("jog.continuous.a.negative", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.a.negative", hal.Type.BOOL, hal.Dir.IN)
self.an = 0
- self.c.newpin("jog.continuous.b.positive", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.b.positive", hal.Type.BOOL, hal.Dir.IN)
self.bp = 0
- self.c.newpin("jog.continuous.b.negative", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.b.negative", hal.Type.BOOL, hal.Dir.IN)
self.bn = 0
- self.c.newpin("jog.continuous.c.positive", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.c.positive", hal.Type.BOOL, hal.Dir.IN)
self.cp = 0
- self.c.newpin("jog.continuous.c.negative", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.c.negative", hal.Type.BOOL, hal.Dir.IN)
self.cn = 0
- self.c.newpin("jog.continuous.u.positive", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.u.positive", hal.Type.BOOL, hal.Dir.IN)
self.up = 0
- self.c.newpin("jog.continuous.u.negative", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.u.negative", hal.Type.BOOL, hal.Dir.IN)
self.un = 0
- self.c.newpin("jog.continuous.v.positive", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.v.positive", hal.Type.BOOL, hal.Dir.IN)
self.vp = 0
- self.c.newpin("jog.continuous.v.negative", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.v.negative", hal.Type.BOOL, hal.Dir.IN)
self.vn = 0
- self.c.newpin("jog.continuous.w.positive", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.w.positive", hal.Type.BOOL, hal.Dir.IN)
self.wp = 0
- self.c.newpin("jog.continuous.w.negative", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("jog.continuous.w.negative", hal.Type.BOOL, hal.Dir.IN)
self.wn = 0
- self.c.newpin("quill-up", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("quill-up", hal.Type.BOOL, hal.Dir.IN)
self.quillup = 0
- self.c.newpin("cycle-start", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("cycle-start", hal.Type.BOOL, hal.Dir.IN)
self.cyclestart = 0
- self.c.newpin("abort", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("abort", hal.Type.BOOL, hal.Dir.IN)
self.abort = 0
- self.c.newpin("single-block", hal.HAL_BIT, hal.HAL_IN)
+ self.c.newpin("single-block", hal.Type.BOOL, hal.Dir.IN)
self.singleblock = 0
- self.c.newpin("wheel-counts", hal.HAL_S32, hal.HAL_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..3c4b9d5f762 100644
--- a/src/hal/components/bldc.comp
+++ b/src/hal/components/bldc.comp
@@ -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,7 +289,7 @@ 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;
@@ -431,7 +431,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 +455,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 +624,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 +781,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 dbf18cd3a1c..f1aa680e45e 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 e0cc93f1478..07dba0092f8 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 "0: rotate - shortest move; 1: always rotate clockwise; 2: always rotate counterclockwise";
+pin in sint mode "0: rotate - shortest move; 1: always rotate clockwise; 2: always rotate counterclockwise";
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";
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..b29c5e0d77d 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";
@@ -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..1fa8ce4c5e1 100644
--- a/src/hal/components/time.comp
+++ b/src/hal/components/time.comp
@@ -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 ea9e39839a0..250c194f8dd 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 dfbe4466ace..9ad18245083 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;
license "GPL";
diff --git a/src/hal/components/xyzbca_trsrn.comp b/src/hal/components/xyzbca_trsrn.comp
index b8f451c17f9..79dc4a621e6 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;
license "GPL";
diff --git a/src/hal/drivers/hal_ax5214h.c b/src/hal/drivers/hal_ax5214h.c
index 84dd3781d51..17c10b28fde 100644
--- a/src/hal/drivers/hal_ax5214h.c
+++ b/src/hal/drivers/hal_ax5214h.c
@@ -236,7 +236,7 @@ int rtapi_app_main(void)
for (n = 0; n < num_boards; n++) {
/* export read function */
retval = hal_export_functf(read_board, &(board_array[n]),
- 0, 0, comp_id, "ax5214h.%d.read", n);
+ 0, comp_id, "ax5214h.%d.read", n);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"AX5214H: ERROR: port %d read funct export failed\n", n);
@@ -245,7 +245,7 @@ int rtapi_app_main(void)
}
/* export write function */
retval = hal_export_functf(write_board, &(board_array[n]),
- 0, 0, comp_id, "ax5214h.%d.write", n);
+ 0, comp_id, "ax5214h.%d.write", n);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"AX5214H: ERROR: port %d write funct export failed\n", n);
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_evoreg.c b/src/hal/drivers/hal_evoreg.c
index 01c82f992d5..23e8ff52678 100644
--- a/src/hal/drivers/hal_evoreg.c
+++ b/src/hal/drivers/hal_evoreg.c
@@ -243,7 +243,7 @@ int rtapi_app_main(void)
/* STEP 4: export function */
- retval = hal_export_functf(update_port, &(port_data_array[n]), 1, 0,
+ retval = hal_export_functf(update_port, &(port_data_array[n]), 0,
comp_id, "evoreg.%d.update", n + 1);
if (retval < 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
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_motenc.c b/src/hal/drivers/hal_motenc.c
index 01471f7c679..660e1822e25 100644
--- a/src/hal/drivers/hal_motenc.c
+++ b/src/hal/drivers/hal_motenc.c
@@ -522,7 +522,7 @@ Device_ExportEncoderPinsParametersFunctions(Device *this, int componentId, int b
// Export functions.
if(!halError){
- halError = hal_export_functf(Device_EncoderRead, this, 1, 0, componentId, "motenc.%d.encoder-read", boardId);
+ halError = hal_export_functf(Device_EncoderRead, this, 0, componentId, "motenc.%d.encoder-read", boardId);
}
if(halError){
@@ -559,7 +559,7 @@ Device_ExportDacPinsParametersFunctions(Device *this, int componentId, int board
// Export functions.
if(!halError){
- halError = hal_export_functf(Device_DacWrite, this, 1, 0, componentId, "motenc.%d.dac-write", boardId);
+ halError = hal_export_functf(Device_DacWrite, this, 0, componentId, "motenc.%d.dac-write", boardId);
}
if(halError){
@@ -596,7 +596,7 @@ Device_ExportAdcPinsParametersFunctions(Device *this, int componentId, int board
// Export functions.
if(!halError){
- halError = hal_export_functf(Device_AdcRead, this, 1, 0, componentId, "motenc.%d.adc-read", boardId);
+ halError = hal_export_functf(Device_AdcRead, this, 0, componentId, "motenc.%d.adc-read", boardId);
}
if(halError){
@@ -628,7 +628,7 @@ Device_ExportDigitalInPinsParametersFunctions(Device *this, int componentId, int
// Export functions.
if(!halError){
- halError = hal_export_functf(Device_DigitalInRead, this, 0, 0, componentId, "motenc.%d.digital-in-read", boardId);
+ halError = hal_export_functf(Device_DigitalInRead, this, 0, componentId, "motenc.%d.digital-in-read", boardId);
}
if(halError){
@@ -661,7 +661,7 @@ Device_ExportDigitalOutPinsParametersFunctions(Device *this, int componentId, in
// Export functions.
if(!halError){
- halError = hal_export_functf(Device_DigitalOutWrite, this, 0, 0, componentId, "motenc.%d.digital-out-write", boardId);
+ halError = hal_export_functf(Device_DigitalOutWrite, this, 0, componentId, "motenc.%d.digital-out-write", boardId);
}
if(halError){
@@ -700,7 +700,7 @@ Device_ExportMiscPinsParametersFunctions(Device *this, int componentId, int boar
// Export functions.
if(!halError){
- halError = hal_export_functf(Device_MiscUpdate, this, 0, 0, componentId, "motenc.%d.misc-update", boardId);
+ halError = hal_export_functf(Device_MiscUpdate, this, 0, componentId, "motenc.%d.misc-update", boardId);
}
if(halError){
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_skeleton.c b/src/hal/drivers/hal_skeleton.c
index 2496f066152..e1d9c064736 100644
--- a/src/hal/drivers/hal_skeleton.c
+++ b/src/hal/drivers/hal_skeleton.c
@@ -172,7 +172,7 @@ int rtapi_app_main(void)
}
/* STEP 4: export write function */
- retval = hal_export_functf(write_port, &(port_data_array[n]), 0, 0,
+ retval = hal_export_functf(write_port, &(port_data_array[n]), 0,
comp_id, "skeleton.%d.write", n);
if (retval < 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
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/hal_stg.c b/src/hal/drivers/hal_stg.c
index 95d2c5c1766..9ec3838e2bf 100644
--- a/src/hal/drivers/hal_stg.c
+++ b/src/hal/drivers/hal_stg.c
@@ -413,7 +413,7 @@ int rtapi_app_main(void)
/* export functions */
retval = hal_export_funct("stg.capture-position", stg_counter_capture,
- stg_driver, 1, 0, comp_id);
+ stg_driver, 0, comp_id);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"STG: ERROR: stg.counter-capture funct export failed\n");
@@ -424,7 +424,7 @@ int rtapi_app_main(void)
"STG: installed %d encoder counters\n", num_chan);
retval = hal_export_funct("stg.write-dacs", stg_dacs_write,
- stg_driver, 1, 0, comp_id);
+ stg_driver, 0, comp_id);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"STG: ERROR: stg.write-dacs funct export failed\n");
@@ -435,7 +435,7 @@ int rtapi_app_main(void)
"STG: installed %d dacs\n", num_chan);
retval = hal_export_funct("stg.read-adcs", stg_adcs_read,
- stg_driver, 1, 0, comp_id);
+ stg_driver, 0, comp_id);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"STG: ERROR: stg.read-adcs funct export failed\n");
@@ -446,7 +446,7 @@ int rtapi_app_main(void)
"STG: installed %d adcs\n", num_chan);
retval = hal_export_funct("stg.di-read", stg_di_read,
- stg_driver, 0, 0, comp_id);
+ stg_driver, 0, comp_id);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"STG: ERROR: stg.di-read funct export failed\n");
@@ -458,7 +458,7 @@ int rtapi_app_main(void)
"STG: installed %d digital inputs\n", inputpinnum);
retval = hal_export_funct("stg.do-write", stg_do_write,
- stg_driver, 0, 0, comp_id);
+ stg_driver, 0, comp_id);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"STG: ERROR: stg.do-write funct export failed\n");
@@ -469,7 +469,7 @@ int rtapi_app_main(void)
"STG: installed %d digital outputs\n", outpinnum);
/*
- retval = hal_export_funct("stg.debug_print", stg_debug_print, stg_driver, 0, 0, comp_id);
+ retval = hal_export_funct("stg.debug_print", stg_debug_print, stg_driver, 0, comp_id);
if (retval != 0)
{
rtapi_print_msg(RTAPI_MSG_ERR,
diff --git a/src/hal/drivers/hal_tiro.c b/src/hal/drivers/hal_tiro.c
index eba33782d3a..046799b979a 100644
--- a/src/hal/drivers/hal_tiro.c
+++ b/src/hal/drivers/hal_tiro.c
@@ -158,7 +158,7 @@ int rtapi_app_main(void)
}
/* export functions */
retval = hal_export_funct("tiro.capture-position", capture,
- counter_array, 1, 0, comp_id);
+ counter_array, 0, comp_id);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"TIRO: ERROR: capture funct export failed\n");
diff --git a/src/hal/drivers/hal_vti.c b/src/hal/drivers/hal_vti.c
index 7f5cb7c7ce8..4777e63b213 100644
--- a/src/hal/drivers/hal_vti.c
+++ b/src/hal/drivers/hal_vti.c
@@ -338,7 +338,7 @@ int rtapi_app_main(void)
/* export functions */
retval = hal_export_funct("vti.capture-position", vti_counter_capture,
- vti_driver, 1, 0, comp_id);
+ vti_driver, 0, comp_id);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"VTI: ERROR: vti.counter-capture funct export failed\n");
@@ -349,7 +349,7 @@ int rtapi_app_main(void)
"VTI: installed %d encoder counters\n", num_chan);
retval = hal_export_funct("vti.write-dacs", vti_dacs_write,
- vti_driver, 1, 0, comp_id);
+ vti_driver, 0, comp_id);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"VTI: ERROR: vti.write-dacs funct export failed\n");
@@ -359,7 +359,7 @@ int rtapi_app_main(void)
rtapi_print_msg(RTAPI_MSG_INFO, "VTI: installed %d dacs\n", num_chan);
retval = hal_export_funct("vti.read-adcs", vti_adcs_read,
- vti_driver, 1, 0, comp_id);
+ vti_driver, 0, comp_id);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"VTI: ERROR: vti.read-adcs funct export failed\n");
@@ -369,7 +369,7 @@ int rtapi_app_main(void)
rtapi_print_msg(RTAPI_MSG_INFO, "VTI: installed %d adcs\n", 0);
retval = hal_export_funct("vti.di-read", vti_di_read,
- vti_driver, 0, 0, comp_id);
+ vti_driver, 0, comp_id);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"VTI: ERROR: vti.di-read funct export failed\n");
@@ -381,7 +381,7 @@ int rtapi_app_main(void)
"VTI: installed %d digital inputs\n", inputpinnum);
retval = hal_export_funct("vti.do-write", vti_do_write,
- vti_driver, 0, 0, comp_id);
+ vti_driver, 0, comp_id);
if (retval != 0) {
rtapi_print_msg(RTAPI_MSG_ERR,
"VTI: ERROR: vti.do-write funct export failed\n");
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-hostmot2/modbus/analogue.mod b/src/hal/drivers/mesa-hostmot2/modbus/analogue.mod
index f2e3b899c98..73cfef7d94f 100644
--- a/src/hal/drivers/mesa-hostmot2/modbus/analogue.mod
+++ b/src/hal/drivers/mesa-hostmot2/modbus/analogue.mod
@@ -6,7 +6,7 @@ The format of the channel descriptors is:
{TYPE, FUNC, ADDR, COUNT, pin_name}
-TYPE is one of HAL_BIT, HAL_FLOAT, HAL_S32, HAL_U32, ENCODER
+TYPE is one of HAL_BOOL, HAL_REAL, HAL_SINT, HAL_UINT, ENCODER
FUNC = 1, 2, 3, 4, 5, 6, 15, 16 - Modbus commands
COUNT = number of coils/registers to read
*/
@@ -15,7 +15,7 @@ COUNT = number of coils/registers to read
static const hm2_modbus_chan_descriptor_t channels[] = {
/* {TYPE, FUNC, ADDR, COUNT, pin_name} */
- {HAL_FLOAT, 3, 0x0000, 1, "volts"},
+ {HAL_REAL, 3, 0x0000, 1, "volts"},
};
/* Optionally #define DEBUG to aid with troubleshooting.
diff --git a/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.c.tmpl b/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.c.tmpl
index 05b2b3dad34..5e825090fe0 100644
--- a/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.c.tmpl
+++ b/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.c.tmpl
@@ -259,7 +259,7 @@ int rtapi_app_main(void){
p = 0; // HAL pin index, not aligned to channel index
for (c = 0; c < inst->num_chans; c++){
hm2_modbus_channel_t *ch = &(inst->chans[c]);
- hal_pin_dir_t dir;
+ hal_pdir_t dir;
rtapi_print_msg(RTAPI_MSG_INFO, "ch %i is at %p\n", c, ch);
ch->type = channels[c].type;
ch->func = channels[c].func;
@@ -324,7 +324,7 @@ int rtapi_app_main(void){
case 4: // read input registers
for (j = 0; j < ch->count; j++){
switch (ch->type){
- case HAL_U32:
+ case HAL_UINT:
if (ch->count > 1) {
retval = hal_pin_new_ui32(comp_id, dir,
&(inst->hal->pins[p].u),
@@ -338,7 +338,7 @@ int rtapi_app_main(void){
}
p++;
break;
- case HAL_S32:
+ case HAL_SINT:
if (ch->count > 1) {
retval = hal_pin_new_si32(comp_id, dir,
&(inst->hal->pins[p].s),
@@ -369,7 +369,7 @@ int rtapi_app_main(void){
inst->hal->buff[p] = 0;
p++;
break;
- case HAL_FLOAT:
+ case HAL_REAL:
if (ch->count > 1) {
retval = hal_pin_new_real(comp_id, dir,
&(inst->hal->pins[p].r),
@@ -681,13 +681,13 @@ static int build_data_frame(hm2_modbus_inst_t *inst){
case 6: //Write single register
r += ch_append16(ch, ch->addr);
switch (ch->type){
- case HAL_U32:
+ case HAL_UINT:
r += ch_append16(ch, (rtapi_u16)hal_get_ui32(hal->pins[p].u));
break;
- case HAL_S32:
+ case HAL_SINT:
r += ch_append16(ch, (rtapi_s16)hal_get_si32(hal->pins[p].s));
break;
- case HAL_FLOAT:
+ case HAL_REAL:
rtapi_print_msg(RTAPI_MSG_INFO, "671 %f %f %f \n", hal_get_real(hal->pins[p].r), hal_get_real(hal->pin2[p].r), hal_get_real(hal->scale[p]));
if (hal_get_real(hal->scale[p]) <= -EPSILON || hal_get_real(hal->scale[p]) >= +EPSILON){
r+= ch_append16(ch, (rtapi_u16)((hal_get_real(hal->pins[p].r) - hal_get_real(hal->pin2[p].r)) / hal_get_real(hal->scale[p]))) ;
@@ -716,13 +716,13 @@ static int build_data_frame(hm2_modbus_inst_t *inst){
r += ch_append8(ch, ch->count * 2);
for (i = 0; i < ch->count; i++){
switch (ch->type){
- case HAL_U32:
+ case HAL_UINT:
r += ch_append16(ch, (rtapi_u16)hal_get_ui32(hal->pins[p].u));
break;
- case HAL_S32:
+ case HAL_SINT:
r += ch_append16(ch, (rtapi_s16)hal_get_si32(hal->pins[p].s));
break;
- case HAL_FLOAT:
+ case HAL_REAL:
if (hal_get_real(hal->scale[p]) <= -EPSILON || hal_get_real(hal->scale[p]) >= +EPSILON){
r+= ch_append16(ch, (rtapi_u16)((hal_get_real(hal->pins[p].r) - hal_get_real(hal->pin2[p].r)) / hal_get_real(hal->scale[p]))) ;
} else {
@@ -793,12 +793,12 @@ static int parse_data_frame(hm2_modbus_inst_t *inst){
w = 3;
for (i = 0; i < bytes[2] / 2; i++){
switch (ch->type){
- case HAL_U32:
+ case HAL_UINT:
hal_set_ui32(hal->pins[p].u, 256 * bytes[w] + bytes[w + 1]);
w += 2;
p++;
break;
- case HAL_S32: // wrap the result into the (s32) offset too
+ case HAL_SINT: // wrap the result into the (s32) offset too
tmp = hal_get_si32(hal->pins[p].s);
hal_set_si32(hal->pins[p].s, bytes[w] * 256 + bytes[w + 1]);
w += 2;
@@ -809,7 +809,7 @@ static int parse_data_frame(hm2_modbus_inst_t *inst){
hal_set_real(hal->pin2[p].r, hal->buff[p] * hal_get_real(hal->scale[p]));
p++;
break;
- case HAL_FLOAT:
+ case HAL_REAL:
hal_set_real(hal->pins[p].r, (256 * bytes[w] + bytes[w + 1])
* hal_get_real(hal->scale[p]) + hal_get_real(hal->pin2[p].r));
w += 2;
diff --git a/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.mod.sample b/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.mod.sample
index 5530b6e2b79..bb8ee75120a 100644
--- a/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.mod.sample
+++ b/src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.mod.sample
@@ -3,7 +3,7 @@ The format of the channel descriptors is:
{TYPE, FUNC, ADDR, COUNT, pin_name}
-TYPE is one of HAL_BIT, HAL_FLOAT, HAL_S32, HAL_U32
+TYPE is one of HAL_BOOL, HAL_REAL, HAL_SINT, HAL_UINT
FUNC = 1, 2, 3, 4, 5, 6, 15, 16 - Modbus commands
COUNT = number of coils/registers to read
*/
@@ -13,21 +13,21 @@ COUNT = number of coils/registers to read
static const hm2_modbus_chan_descriptor_t channels[] = {
/* {TYPE, FUNC, ADDR, COUNT, pin_name} */
// Create 8 HAL bit pins coil-00 .. -07 supplying the values of coils at 0x0000
- {HAL_BIT, 1, 0x0000, 8, "coil"},
+ {HAL_BOOL, 1, 0x0000, 8, "coil"},
// Create 8 HAL bit pins input-00 .. -07 supplying the values of inputs at 0x0000
- {HAL_BIT, 2, 0x0000, 8, "input"},
+ {HAL_BOOL, 2, 0x0000, 8, "input"},
// Create a HAL pin to set the coil at address 0x0010
- {HAL_BIT, 5, 0x0010, 1, "coil-0"},
+ {HAL_BOOL, 5, 0x0010, 1, "coil-0"},
// Create 8 HAL pins to set the coils at 0x0020
- {HAL_BIT, 15, 0x0020, 8, "more_coils"},
+ {HAL_BOOL, 15, 0x0020, 8, "more_coils"},
// Create a scaled floating point pin calculated from input register 0x0100
- {HAL_FLOAT, 4, 0x0100, 1, "float"},
+ {HAL_REAL, 4, 0x0100, 1, "float"},
// Create 4 unsigned integer HAL pins from the holding registers at 0x0200-0x203
- {HAL_S32, 3, 0x0003, 4, "holding"},
+ {HAL_SINT, 3, 0x0003, 4, "holding"},
// Create a single signed int HAL pin to control the register at 0x0300
- {HAL_S32, 6, 0x0300, 1, "relay-3"},
+ {HAL_SINT, 6, 0x0300, 1, "relay-3"},
// Create 7 scaled FP HAL pins to control holfing registers at 0x400-0x406
- {HAL_FLOAT, 16, 0x0300, 1, "more_floats"},
+ {HAL_REAL, 16, 0x0300, 1, "more_floats"},
};
// vim: syn=c
diff --git a/src/hal/drivers/mesa-hostmot2/modbus/relayboard.mod b/src/hal/drivers/mesa-hostmot2/modbus/relayboard.mod
index 83d913dce94..7b4259ef1a9 100644
--- a/src/hal/drivers/mesa-hostmot2/modbus/relayboard.mod
+++ b/src/hal/drivers/mesa-hostmot2/modbus/relayboard.mod
@@ -5,7 +5,7 @@ The format of the channel descriptors is:
{TYPE, FUNC, ADDR, COUNT, pin_name}
-TYPE is one of HAL_BIT, HAL_FLOAT, HAL_S32, HAL_U32
+TYPE is one of HAL_BOOL, HAL_REAL, HAL_SINT, HAL_UINT
FUNC = 1, 2, 3, 4, 5, 6, 15, 16 - Modbus commands
COUNT = number of coils/registers to read
*/
@@ -14,12 +14,12 @@ COUNT = number of coils/registers to read
static const hm2_modbus_chan_descriptor_t channels[] = {
/* {TYPE, FUNC, ADDR, COUNT, pin_name} */
- {HAL_BIT, 1, 0x0000, 8, "state"},
- {HAL_BIT, 2, 0x0000, 8, "input"},
- {HAL_BIT, 5, 0x0000, 1, "relay-0"},
- {HAL_BIT, 5, 0x0001, 1, "relay-1"},
- {HAL_BIT, 5, 0x0002, 1, "relay-2"},
- {HAL_BIT, 5, 0x0003, 1, "relay-3"},
+ {HAL_BOOL, 1, 0x0000, 8, "state"},
+ {HAL_BOOL, 2, 0x0000, 8, "input"},
+ {HAL_BOOL, 5, 0x0000, 1, "relay-0"},
+ {HAL_BOOL, 5, 0x0001, 1, "relay-1"},
+ {HAL_BOOL, 5, 0x0002, 1, "relay-2"},
+ {HAL_BOOL, 5, 0x0003, 1, "relay-3"},
};
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/opto_ac5.c b/src/hal/drivers/opto_ac5.c
index cb90507bf1b..4b1fd72b6a8 100644
--- a/src/hal/drivers/opto_ac5.c
+++ b/src/hal/drivers/opto_ac5.c
@@ -263,7 +263,7 @@ static int Device_ExportDigitalInPinsParametersFunctions(board_data_t *this, int
// Export functions.
if(!halError){
- halError = hal_export_functf(Device_DigitalInRead, this, 0, 0, comp_id, "opto-ac5.%d.digital-read", boardId);
+ halError = hal_export_functf(Device_DigitalInRead, this, 0, comp_id, "opto-ac5.%d.digital-read", boardId);
}
if(halError){
@@ -323,7 +323,7 @@ static int Device_ExportDigitalOutPinsParametersFunctions(board_data_t *this, in
}
// Export functions.
if(!halError){
- halError = hal_export_functf(Device_DigitalOutWrite, this, 0, 0, comp_id, "opto-ac5.%d.digital-write", boardId);
+ halError = hal_export_functf(Device_DigitalOutWrite, this, 0, comp_id, "opto-ac5.%d.digital-write", boardId);
}
if(halError){
diff --git a/src/hal/drivers/pci_8255.c b/src/hal/drivers/pci_8255.c
index 682a9e09cf9..55ad9c9a947 100644
--- a/src/hal/drivers/pci_8255.c
+++ b/src/hal/drivers/pci_8255.c
@@ -74,7 +74,7 @@ static inline int pci_8255_inb(rtapi_u32 base, int offset) {
static int export(char *prefix, struct port *inst, int ioaddr, int dir) {
int r = 0;
int i;
- hal_pin_dir_t direction;
+ hal_pdir_t direction;
int sz = sizeof(struct port);
memset(inst, 0, sz);
if(0 != (r = hal_param_new_fake(comp_id, (hal_refs_u *)&inst->ioaddr)))
@@ -132,9 +132,9 @@ static int export(char *prefix, struct port *inst, int ioaddr, int dir) {
r = hal_param_new_ui32(comp_id, HAL_RO, &(inst->dir_), dir,
"%s.dir", prefix);
if(r != 0) return r;
- r = hal_export_functf((void(*)(void *inst, long))read, inst, 0, 0, comp_id, "%s.read", prefix);
+ r = hal_export_functf((void(*)(void *inst, long))read, inst, 0, comp_id, "%s.read", prefix);
if(r != 0) return r;
- r = hal_export_functf((void(*)(void *inst, long))write, inst, 0, 0, comp_id, "%s.write", prefix);
+ r = hal_export_functf((void(*)(void *inst, long))write, inst, 0, comp_id, "%s.write", prefix);
if(r != 0) return r;
rtapi_print_msg(RTAPI_MSG_DBG, "registering %s ... %x %x\n", prefix,
@@ -208,11 +208,11 @@ int rtapi_app_main(void) {
hal_pin_new_bool(comp_id, HAL_IN, &(inst[i].relay), 0, "pci8255.%d.relay", i);
hal_param_new_bool(comp_id, HAL_RW, &(inst[i].relay_invert), 0,
"pci8255.%d.relay-invert", i);
- r = hal_export_functf((void(*)(void *inst, long))write_relay, &inst[i], 0, 0, comp_id, "pci8255.%d.write-relay", i);
+ r = hal_export_functf((void(*)(void *inst, long))write_relay, &inst[i], 0, comp_id, "pci8255.%d.write-relay", i);
if(r != 0) return r;
}
- r = hal_export_funct("pci8255.read-all", (void(*)(void *inst, long))read_all, inst, 0, 0, comp_id);
- r = hal_export_funct("pci8255.write-all", (void(*)(void *inst, long))write_all, inst, 0, 0, comp_id);
+ r = hal_export_funct("pci8255.read-all", (void(*)(void *inst, long))read_all, inst, 0, comp_id);
+ r = hal_export_funct("pci8255.write-all", (void(*)(void *inst, long))write_all, inst, 0, comp_id);
out_error:
if(r) {
extra_cleanup();
diff --git a/src/hal/drivers/pcl720.comp b/src/hal/drivers/pcl720.comp
index 1c455490200..c225ed259f6 100644
--- a/src/hal/drivers/pcl720.comp
+++ b/src/hal/drivers/pcl720.comp
@@ -7,23 +7,23 @@ not support the the counters/timers.""";
pin in bool pin-##-out[32] "Output pins";
pin out bool pin-##-in[32] "Input pins";
pin out bool pin-##-in-not[32] "Inverted version of each input pin";
-param rw ui32 reset-time = 5000 """The time in nanoseconds after the write function
+param rw uint reset-time = 5000 """The time in nanoseconds after the write function
has run to reset the pins for which the "reset" parameter is set.""";
param rw bool pin-##-reset[32] """specifies if the pin should be reset by the "reset"
function""";
param rw bool pin-##-out-invert[32] "Set to true to invert the sense of the output pin";
-pin out ui32 wait_clocks;
+pin out uint wait_clocks;
function read "Reads each of the digital inputs and updates the HAL pins";
function write "Writes the values of the output HAL pins to the digital IO";
function reset """Waits for the length of time specified by the
-\\fBreset-time\\fP parameter and resets any pins for which the \\fBreset\\fP
+*reset-time* parameter and resets any pins for which the *reset*
parameter has been set. This can be used to allow step generators to make a step
every thread rather than every other thread. This function must be added to the
thread after the "write" function.
Do not use this function if you do not wish to reset any pins.
- the stepgen \\fBstep-space\\fP parameter should be set to 0 to make use of this
+ the stepgen *step-space* parameter should be set to 0 to make use of this
function.""";
variable unsigned base_addr;
diff --git a/src/hal/drivers/pluto_servo.comp b/src/hal/drivers/pluto_servo.comp
index 000d5580776..586b0557282 100644
--- a/src/hal/drivers/pluto_servo.comp
+++ b/src/hal/drivers/pluto_servo.comp
@@ -47,18 +47,18 @@ described in the HAL manual.
The digital input pins conform to the `canonical digital input' interface
described in the HAL manual.
""";
-pin out si32 encoder.#.count[4];
+pin out sint encoder.#.count[4];
pin out real encoder.#.position[4];
pin out real encoder.#.velocity[4];
pin in bool encoder.#.reset[4];
-pin io bool encoder.#.index-enable[4] """encoder.\\fIM\\fR corresponds to the
-pins labeled QA\\fIM\\fR, QB\\fIM\\fR, and QZ\\fIM\\fR on the pinout diagram""";
+pin io bool encoder.#.index-enable[4] """encoder.__M__ corresponds to the
+pins labeled QA__M__, QB__M__, and QZ__M__ on the pinout diagram""";
param rw real encoder.#.scale[4] =1;
param rw bool encoder.z-polarity "Set to TRUE if the index pulse is active low, FALSE if it is active high. Affects all encoders.";
pin in real pwm.#.value[4];
-pin in bool pwm.#.enable[4] "pwm.\\fIM\\fR corresponds to the pins labeled UP\\fIM\\fR and DN\\fIM\\fR on the pinout diagram";
+pin in bool pwm.#.enable[4] "pwm.__M__ corresponds to the pins labeled UP__M__ and DN__M__ on the pinout diagram";
param rw real pwm.#.offset[4];
param rw real pwm.#.scale[4]=1;
param rw real pwm.#.max-dc[4]=1;
@@ -70,79 +70,48 @@ param rw bool pwm.is-pdm "Set to TRUE to use PDM (also called interleaved PWM) m
pin in bool dout.##[20]
-"""dout.\\fI0M\\fR corresponds to the pin labeled
-OUT\\fIM\\fR on the pinout diagram. Other pins are shared with the PWM
+"""dout.__0M__ corresponds to the pin labeled
+OUT__M__ on the pinout diagram. Other pins are shared with the PWM
function, as follows:
-.RS 6
-.ta T 10 6
-.PP
-\\fBPin\tShared\\fR
-.PP
-\\fBLabel\twith\\fR
-.PP
-dout.10\tUP0
-.PP
-dout.10\tUP0
-.PP
-dout.12\tUP1
-.PP
-dout.14\tUP2
-.PP
-dout.18\tUP3
-.PP
-dout.11\tDOWN0
-.PP
-dout.13\tDOWN1
-.PP
-dout.15\tDOWN2
-.PP
-dout.19\tDOWN3
-.PP
-.RE
-.DT""";
+|===
+|Pin Label | Shared width
+|dout.10 | UP0
+|dout.10 | UP0
+|dout.12 | UP1
+|dout.14 | UP2
+|dout.18 | UP3
+|dout.11 | DOWN0
+|dout.13 | DOWN1
+|dout.15 | DOWN2
+|dout.19 | DOWN3
+|===
+""";
param rw bool dout.##-invert[20]
-"If TRUE, the output on the corresponding \\fBdout.\\fIMM\\fR is inverted.";
+"If TRUE, the output on the corresponding \\fBdout.__MM__ is inverted.";
pin out bool din.##[20];
pin out bool din.##_not[20]
-"""For M=0 through 7, din.\\fI0M\\fR corresponds to the pin labeled
-IN\\fIM\\fR on the pinout diagram. Other pins are shared with the encoder
+"""For M=0 through 7, din.__0M__ corresponds to the pin labeled
+IN__M__ on the pinout diagram. Other pins are shared with the encoder
function, as follows:
-.RS 6
-.ta T 10 6
-.PP
-\\fBPin\tShared\\fR
-.PP
-\\fBLabel\twith\\fR
-.PP
-din.8\tQZ0
-.PP
-din.9\tQZ1
-.PP
-din.10\tQZ2
-.PP
-din.11\tQZ3
-.PP
-din.12\tQB0
-.PP
-din.13\tQB1
-.PP
-din.14\tQB2
-.PP
-din.15\tQB3
-.PP
-din.16\tQA0
-.PP
-din.17\tQA1
-.PP
-din.18\tQA2
-.PP
-din.19\tQA3
-.PP
-.RE
-.DT""";
-
-param rw ui32 communication_error """Incremented each time
+|===
+|Pin Label | Shared with
+|din.8 | QZ0
+|din.9 | QZ1
+|din.10 | QZ2
+|din.11 | QZ3
+|din.12 | QB0
+|din.13 | QB1
+|din.14 | QB2
+|din.15 | QB3
+|din.16 | QA0
+|din.17 | QA1
+|din.18 | QA2
+|din.19 | QA3
+|===
+""";
+
+param rw uint communication_error """Incremented each time
pluto-servo.read detects an error code in the EPP status register. While
this register is nonzero, new values are not being written to the Pluto-P
board, and the status of digital outputs and the PWM duty cycle of the PWM
@@ -150,8 +119,8 @@ outputs will remain unchanged. If the watchdog is enabled, it will activate
soon after the communication error is detected. To continue after a
communication error, set this parameter back to zero.""";
-param rw si32 debug_0;
-param rw si32 debug_1 """These parameters can display values which are useful to developers or for debugging the driver and firmware. They are not useful for integrators or users.""";
+param rw sint debug_0;
+param rw sint debug_1 """These parameters can display values which are useful to developers or for debugging the driver and firmware. They are not useful for integrators or users.""";
option singleton;
option extra_setup;
@@ -162,7 +131,7 @@ option data internal;
function read "Read all the inputs from the pluto-servo board";
function write "Write all the outputs on the pluto-servo board";
-see_also """The \\fIpluto_servo\\fR section in the HAL User Manual, which shows the location of each physical pin on the pluto board.""";
+see_also """The __pluto_servo__ section in the HAL User Manual, which shows the location of each physical pin on the pluto board.""";
modparam dummy ioaddr = 0x378 "The base address of the parallel port.";
modparam dummy ioaddr_hi = 0
@@ -179,7 +148,7 @@ functions. However, this may not work on all EPP parallel ports.""";
modparam dummy watchdog = 1
"""Set to zero to disable the "hardware watchdog". "Watchdog" will
tristate all outputs approximately 6ms after the last execution of
-\\fBpluto-servo.write\\fR, which adds some protection in the case of LinuxCNC
+**pluto-servo.write**, which adds some protection in the case of LinuxCNC
crashes.""";
modparam int test_encoder = 0
diff --git a/src/hal/drivers/pluto_step.comp b/src/hal/drivers/pluto_step.comp
index eba52022e01..423b976b948 100644
--- a/src/hal/drivers/pluto_step.comp
+++ b/src/hal/drivers/pluto_step.comp
@@ -16,50 +16,37 @@
component pluto_step """Hardware driver and firmware for the Pluto-P parallel-port FPGA, for use with stepper machines.
-.B loadrt pluto_step ioaddr=\\fIaddr\\fB ioaddr_hi=\\fIaddr\\fB epp_wide=\\fI[0|1]\\fB
+loadrt *pluto_step* ioaddr=__Iaddr__ ioaddr_hi=__addr__ epp_wide=__[0|1]__
-.RS 4
-.TP
-\\fBioaddr\\fR [default: 0x378]
+ioaddr [default: 0x378]::
The base address of the parallel port.
-.TP
-\\fBioaddr_hi\\fR [default: 0]
+ioaddr_hi [default: 0]::
The secondary address of the parallel port, used to set EPP
mode. 0 means to use ioaddr + 0x400. -1 means there is no
secondary address.
-.TP
-\\fBepp_wide\\fR [default: 1]
+epp_wide [default: 1]::
Set to zero to disable "wide EPP mode". "Wide" mode allows 16- and 32-bit EPP
transfers, which can reduce the time spent in the read and write functions.
However, this mode may not work on all EPP parallel ports.
-.TP
-\\fBwatchdog\\fR [default: 1]
+watchdog [default: 1]::
Set to zero to disable the "hardware watchdog". "Watchdog" will tristate all
-outputs approximately 6ms after the last execution of
-\\fBpluto-step.write\\fR, which adds some protection in the case of LinuxCNC
-crashes.
+outputs approximately 6ms after the last execution of **pluto-step.write**,
+which adds some protection in the case of LinuxCNC crashes.
-.TP
-\\fBspeedrange\\fR [default: 0]
+speedrange [default: 0]::
Selects one of four speed ranges:
-.RS
-.RS 4
-.TQ
-0: Top speed 312.5kHz; minimum speed 610Hz
-.TQ
-1: Top speed 156.25kHz; minimum speed 305Hz
-.TQ
-2: Top speed 78.125kHz; minimum speed 153Hz
-.TQ
-3: Top speed 39.06kHz; minimum speed 76Hz
-.RE
+
+* 0: Top speed 312.5kHz; minimum speed 610Hz
+* 1: Top speed 156.25kHz; minimum speed 305Hz
+* 2: Top speed 78.125kHz; minimum speed 153Hz
+* 3: Top speed 39.06kHz; minimum speed 76Hz
+
Choosing the smallest maximum speed that is above the maximum for any one axis
may give improved step regularity at low step speeds.
-.RE
-.RE""";
+""";
description """
Pluto_step is a LinuxCNC software driver and associated firmware that allow the Pluto-P board to be used to control a stepper-based CNC machine.
@@ -67,15 +54,15 @@ Pluto_step is a LinuxCNC software driver and associated firmware that allow the
The driver has 4 step+direction channels, 14 dedicated digital outputs, and 16
dedicated digital inputs.
-.SS Step generators
+=== Step generators
The step generator takes a position input and output.
The step waveform includes step length/space and direction hold/setup time.
Step length and direction setup/hold time is enforced in the FPGA. Step space
is enforced by a velocity cap in the driver.
-\\fI(all the following numbers are subject to change)\\fR
-In \\fIspeedrange=0\\fR, the maximum step rate is 312.5kHz. For position
+ __(all the following numbers are subject to change)__
+In __speedrange=0__, the maximum step rate is 312.5kHz. For position
feedback to be accurate, the maximum step rate is 512 pulses per servo cycle
(so a 1kHz servo cycle does not impose any additional limitation). The maximum
step rate may be lowered by the step length and space parameters, which are
@@ -84,7 +71,7 @@ rounded up to the nearest multiple of 1600ns.
In successive speedranges the maximum step rate is divided in half, as is the
maximum steps per servo cycle, and the minimum nonzero step rate.
-.SS Digital I/O
+=== Digital I/O
The digital output pins conform to the `canonical digital output' interface
described in the HAL manual.
@@ -94,29 +81,29 @@ described in the HAL manual.
pin in real stepgen.#.position-cmd[4];
pin out real stepgen.#.velocity-fb[4];
pin out real stepgen.#.position-fb[4];
-pin out si32 stepgen.#.counts[4];
+pin out sint stepgen.#.counts[4];
pin in bool stepgen.#.enable[4];
pin in bool stepgen.#.reset[4] "When TRUE, reset position-fb to 0";
param rw real stepgen.#.scale[4] = 1.0;
param rw real stepgen.#.maxvel[4] = 0;
param rw bool stepgen.step_polarity;
-param rw ui32 stepgen.steplen "Step length in ns.";
-param rw ui32 stepgen.stepspace "Step space in ns";
-param rw ui32 stepgen.dirtime "Dir hold/setup in ns. Refer to the pdf documentation for a diagram of what these timings mean.";
+param rw uint stepgen.steplen "Step length in ns.";
+param rw uint stepgen.stepspace "Step space in ns";
+param rw uint stepgen.dirtime "Dir hold/setup in ns. Refer to the pdf documentation for a diagram of what these timings mean.";
pin in bool dout.##[14]
-"""dout.\\fIMM\\fR corresponds to the pin labeled
-OUT\\fIM\\fR on the pinout diagram.""";
+"""dout.__MM__ corresponds to the pin labeled
+OUT__M__ on the pinout diagram.""";
param rw bool dout.##-invert[14]
-"If TRUE, the output on the corresponding \\fBdout.\\fIMM\\fR is inverted.";
+"If TRUE, the output on the corresponding \\fBdout.__MM__ is inverted.";
pin out bool din.##[16];
pin out bool din.##_not[16]
-"""din.\\fIMM\\fR corresponds to the pin labeled
-IN\\fIM\\fR on the pinout diagram.""";
+"""din.__MM__ corresponds to the pin labeled
+IN__M__ on the pinout diagram.""";
-param rw ui32 communication_error """Incremented each time
+param rw uint communication_error """Incremented each time
pluto-step.read detects an error code in the EPP status register. While
this register is nonzero, new values are not being written to the Pluto-P
board, and the status of digital outputs and the PWM duty cycle of the PWM
@@ -124,8 +111,8 @@ outputs will remain unchanged. If the hardware watchdog is enabled, it will
activate shortly after the communication error is detected by LinuxCNC. To continue
after a communication error, set this parameter back to zero.""";
-param rw si32 debug_0;
-param rw si32 debug_1;
+param rw sint debug_0;
+param rw sint debug_1;
param rw real debug_2=.5;
param rw real debug_3=2.0
"""Registers that hold debugging information of interest to developers""";
@@ -139,7 +126,7 @@ option data internal;
function read "Read all the inputs from the pluto-step board";
function write "Write all the outputs on the pluto-step board";
-see_also """The \\fIpluto_step\\fR section in the HAL User Manual, which shows the location of each physical pin on the pluto board.""";
+see_also """The __pluto_step__ section in the HAL User Manual, which shows the location of each physical pin on the pluto board.""";
license "GPL";
include ;
@@ -172,9 +159,9 @@ typedef struct {
FUNCTION(write) {
int r = 0;
int i;
- int stepspace_ticks = stepgen_stepspace/PLUTO_SPEED_NS;
- int steplen_ticks = stepgen_steplen/PLUTO_SPEED_NS;
- int dirtime_ticks = stepgen_dirtime/PLUTO_SPEED_NS;
+ rtapi_sint stepspace_ticks = stepgen_stepspace/PLUTO_SPEED_NS;
+ rtapi_sint steplen_ticks = stepgen_steplen/PLUTO_SPEED_NS;
+ rtapi_sint dirtime_ticks = stepgen_dirtime/PLUTO_SPEED_NS;
int rate, maxrate = MAX_STEP_RATE;
double fmax;
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 1833ab7e7af..fe9201f371b 100644
--- a/src/hal/user_comps/hal_bridge.py
+++ b/src/hal/user_comps/hal_bridge.py
@@ -66,50 +66,50 @@ def init_hal(self):
self.comp = h = hal.component("bridge")
QHAL = Qhal(comp=self.comp, hal=hal)
- self.jogRate = QHAL.newpin("jog-rate", hal.HAL_FLOAT, hal.HAL_OUT)
- self.jogRateIn = QHAL.newpin("jog-rate-in", hal.HAL_FLOAT, hal.HAL_IN)
+ self.jogRate = QHAL.newpin("jog-rate", hal.Type.REAL, hal.Dir.OUT)
+ self.jogRateIn = QHAL.newpin("jog-rate-in", hal.Type.REAL, hal.Dir.IN)
self.jogRateIn.pinValueChanged.connect(self.pinChanged)
- self.jogRateAngular = QHAL.newpin("jog-rate-angular", hal.HAL_FLOAT, hal.HAL_OUT)
- self.jogRateAngularIn = QHAL.newpin("jog-rate-angular-in", hal.HAL_FLOAT, hal.HAL_OUT)
+ self.jogRateAngular = QHAL.newpin("jog-rate-angular", hal.Type.REAL, hal.Dir.OUT)
+ self.jogRateAngularIn = QHAL.newpin("jog-rate-angular-in", hal.Type.REAL, hal.Dir.OUT)
self.jogRateAngularIn.pinValueChanged.connect(self.pinChanged)
- self.jogIncrement = QHAL.newpin("jog-increment", hal.HAL_FLOAT, hal.HAL_OUT)
- self.jogIncrementAngular = QHAL.newpin("jog-increment-angular", hal.HAL_FLOAT, hal.HAL_OUT)
- self.activeJoint = QHAL.newpin('joint-selected', hal.HAL_S32, hal.HAL_OUT)
+ 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.Type.SINT, hal.Dir.OUT)
for i in (self.INFO.AVAILABLE_AXES):
let = i.lower()
# input
- self['axis{}Select'.format(let)] = QHAL.newpin('axis-%s-select'%let, hal.HAL_BIT, hal.HAL_IN)
+ self['axis{}Select'.format(let)] = QHAL.newpin('axis-%s-select'%let, hal.Type.BOOL, hal.Dir.IN)
self['axis{}Select'.format(let)].pinValueChanged.connect(self.pinChanged)
# output
- self['Axis{}IsSelected'.format(let)] = QHAL.newpin('axis-%s-is-selected'%let, hal.HAL_BIT, hal.HAL_OUT)
+ self['Axis{}IsSelected'.format(let)] = QHAL.newpin('axis-%s-is-selected'%let, hal.Type.BOOL, hal.Dir.OUT)
- self.cycle_start = QHAL.newpin('cycle-start-in',QHAL.HAL_BIT, QHAL.HAL_IN)
+ self.cycle_start = QHAL.newpin('cycle-start-in',QHAL.HAL_BOOL, QHAL.HAL_IN)
self.cycle_start.pinValueChanged.connect(self.pinChanged)
- self.cycle_pause = QHAL.newpin('cycle-pause-in',QHAL.HAL_BIT, QHAL.HAL_IN)
+ self.cycle_pause = QHAL.newpin('cycle-pause-in',QHAL.HAL_BOOL, QHAL.HAL_IN)
self.cycle_pause.pinValueChanged.connect(self.pinChanged)
- self.reload_display = QHAL.newpin('reload-display-in',QHAL.HAL_BIT, QHAL.HAL_IN)
+ self.reload_display = QHAL.newpin('reload-display-in',QHAL.HAL_BOOL, QHAL.HAL_IN)
self.reload_display.pinValueChanged.connect(self.pinChanged)
- self.shutdown = QHAL.newpin('shutdown-in',QHAL.HAL_BIT, QHAL.HAL_IN)
+ self.shutdown = QHAL.newpin('shutdown-in',QHAL.HAL_BOOL, QHAL.HAL_IN)
self.shutdown.pinValueChanged.connect(self.pinChanged)
- self.ok = QHAL.newpin('ok-in',QHAL.HAL_BIT, QHAL.HAL_IN)
+ self.ok = QHAL.newpin('ok-in',QHAL.HAL_BOOL, QHAL.HAL_IN)
self.ok.pinValueChanged.connect(self.pinChanged)
- self.cancel = QHAL.newpin('cancel-in',QHAL.HAL_BIT, QHAL.HAL_IN)
+ self.cancel = QHAL.newpin('cancel-in',QHAL.HAL_BOOL, QHAL.HAL_IN)
self.cancel.pinValueChanged.connect(self.pinChanged)
if not self.INFO.MDI_COMMAND_DICT is None:
for i in self.INFO.MDI_COMMAND_DICT:
LOG.debug('{} {}'.format(i,self.INFO.MDI_COMMAND_DICT.get(i)))
- self[i] = QHAL.newpin('ini-mdi-cmd-{}'.format(i),QHAL.HAL_BIT, QHAL.HAL_IN)
+ self[i] = QHAL.newpin('ini-mdi-cmd-{}'.format(i),QHAL.HAL_BOOL, QHAL.HAL_IN)
self[i].pinValueChanged.connect(self.runMacroChanged)
if not self.INFO.MACRO_COMMAND_DICT is None:
for name in self.INFO.MACRO_COMMAND_DICT:
LOG.debug('{} {}'.format(name,self.INFO.MDI_COMMAND_DICT.get(name)))
name = str(name)
- self[name] = QHAL.newpin('ini-macro-cmd-{}'.format(name),QHAL.HAL_BIT, QHAL.HAL_IN)
+ self[name] = QHAL.newpin('ini-macro-cmd-{}'.format(name),QHAL.HAL_BOOL, QHAL.HAL_IN)
self[name].pinValueChanged.connect(self.runMacroChanged)
QHAL.setUpdateRate(100)
diff --git a/src/hal/user_comps/hal_input.py b/src/hal/user_comps/hal_input.py
index 87c90e716db..f786e2c3a23 100644
--- a/src/hal/user_comps/hal_input.py
+++ b/src/hal/user_comps/hal_input.py
@@ -82,18 +82,18 @@ def __init__(self, comp, idx, name, parts='KRAL'):
for key in self.device.get_bits('EV_KEY'):
key = tohalname(key)
self.codes.add(key)
- comp.newpin("%s.%s" % (idx, key), HAL_BIT, HAL_OUT)
- comp.newpin("%s.%s-not" % (idx, key), HAL_BIT, HAL_OUT)
+ comp.newpin("%s.%s" % (idx, key), hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("%s.%s-not" % (idx, key), hal.Type.BOOL, hal.Dir.OUT)
self.set(key + "-not", 1)
if 'R' in parts:
for axis in self.device.get_bits('EV_REL'):
name = tohalname(axis)
self.codes.add(name)
- comp.newpin("%s.%s-position" % (idx, name), HAL_FLOAT, HAL_OUT)
- comp.newpin("%s.%s-counts" % (idx, name), HAL_S32, HAL_OUT)
- comp.newpin("%s.%s-reset" % (idx, name), HAL_BIT, HAL_IN)
- comp.newpin("%s.%s-scale" % (idx, name), HAL_FLOAT, HAL_IN)
+ comp.newpin("%s.%s-position" % (idx, name), hal.Type.REAL, hal.Dir.OUT)
+ comp.newpin("%s.%s-counts" % (idx, name), hal.Type.SINT, hal.Dir.OUT)
+ comp.newpin("%s.%s-reset" % (idx, name), hal.Type.BOOL, hal.Dir.IN)
+ comp.newpin("%s.%s-scale" % (idx, name), hal.Type.REAL, hal.Dir.IN)
self.set(name + '-scale', 1.)
self.rel_items.append(name)
@@ -102,16 +102,16 @@ def __init__(self, comp, idx, name, parts='KRAL'):
name = tohalname(axis)
self.codes.add(name)
absinfo = self.device.get_absinfo(axis)
- comp.newpin("%s.%s-position" % (idx, name), HAL_FLOAT, HAL_OUT)
- comp.newpin("%s.%s-counts" % (idx, name), HAL_S32, HAL_OUT)
- comp.newpin("%s.%s-is-pos" % (idx, name), HAL_BIT, HAL_OUT)
- comp.newpin("%s.%s-is-neg" % (idx, name), HAL_BIT, HAL_OUT)
- comp.newpin("%s.%s-scale" % (idx, name), HAL_FLOAT, HAL_IN)
- comp.newpin("%s.%s-offset" % (idx, name), HAL_FLOAT, HAL_IN)
- comp.newpin("%s.%s-fuzz" % (idx, name), HAL_S32, HAL_IN)
- comp.newpin("%s.%s-flat" % (idx, name), HAL_S32, HAL_IN)
- comp.newparam("%s.%s-min" % (idx, name), HAL_S32, HAL_RO)
- comp.newparam("%s.%s-max" % (idx, name), HAL_S32, HAL_RO)
+ comp.newpin("%s.%s-position" % (idx, name), hal.Type.REAL, hal.Dir.OUT)
+ comp.newpin("%s.%s-counts" % (idx, name), hal.Type.SINT, hal.Dir.OUT)
+ comp.newpin("%s.%s-is-pos" % (idx, name), hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("%s.%s-is-neg" % (idx, name), hal.Type.BOOL, hal.Dir.OUT)
+ comp.newpin("%s.%s-scale" % (idx, name), hal.Type.REAL, hal.Dir.IN)
+ comp.newpin("%s.%s-offset" % (idx, name), hal.Type.REAL, hal.Dir.IN)
+ comp.newpin("%s.%s-fuzz" % (idx, name), hal.Type.SINT, hal.Dir.IN)
+ comp.newpin("%s.%s-flat" % (idx, name), hal.Type.SINT, hal.Dir.IN)
+ comp.newparam("%s.%s-min" % (idx, name), hal.Type.SINT, hal.Dir.RO)
+ comp.newparam("%s.%s-max" % (idx, name), hal.Type.SINT, hal.Dir.RO)
center = (absinfo.minimum + absinfo.maximum)/2.
halfrange = (absinfo.maximum - absinfo.minimum)/2. or 1
self.set(name + "-counts", absinfo.value)
@@ -130,8 +130,8 @@ def __init__(self, comp, idx, name, parts='KRAL'):
for led in self.device.get_bits('EV_LED'):
name = tohalname(led)
self.ledmap[name] = led
- comp.newpin("%s.%s" % (idx, name), HAL_BIT, HAL_IN)
- comp.newpin("%s.%s-invert" % (idx, name), HAL_BIT, HAL_IN)
+ comp.newpin("%s.%s" % (idx, name), hal.Type.BOOL, hal.Dir.IN)
+ comp.newpin("%s.%s-invert" % (idx, name), hal.Type.BOOL, hal.Dir.IN)
self.last[name] = 0
self.device.write_event('EV_LED', led, 0)
@@ -203,7 +203,7 @@ def update(self):
self.set(r + "-position", self.get(r + "-counts") / scale)
for k, v in list(self.last.items()):
- # Note: this is OK because the hal module always returns True or False for HAL_BIT values
+ # Note: this is OK because the hal module always returns True or False for hal.Type.BOOL values
u = self.comp["%s.%s" % (
self.idx, k)] != self.comp["%s.%s-invert" % (self.idx, k)]
if u != self.last[k]:
diff --git a/src/hal/user_comps/mitsub_vfd.py b/src/hal/user_comps/mitsub_vfd.py
index 8d0d6914686..dff04f6718d 100644
--- a/src/hal/user_comps/mitsub_vfd.py
+++ b/src/hal/user_comps/mitsub_vfd.py
@@ -69,34 +69,34 @@ def __init__(self,vfd_names=[['mitsub_vfd','00']],baudrate=9600,port='/dev/ttyUS
for index,name in enumerate(self.comp_names):
#print index,' NAME:',name[0],' SLAVE:',name[1]
c = hal.component(name[0])
- c.newpin("fwd", hal.HAL_BIT, hal.HAL_IN)
- c.newpin("run", hal.HAL_BIT, hal.HAL_IN)
- c.newpin("up-to-speed", hal.HAL_BIT, hal.HAL_OUT)
- c.newpin("alarm", hal.HAL_BIT, hal.HAL_OUT)
- c.newpin("debug", hal.HAL_BIT, hal.HAL_IN)
- c.newpin("monitor", hal.HAL_BIT, hal.HAL_IN)
- c.newpin("motor-cmd", hal.HAL_FLOAT, hal.HAL_IN)
- c.newpin("motor-fb", hal.HAL_FLOAT, hal.HAL_OUT)
- c.newpin("motor-amps", hal.HAL_FLOAT, hal.HAL_OUT)
- c.newpin("motor-volts", hal.HAL_FLOAT, hal.HAL_OUT)
- c.newpin("motor-power", hal.HAL_FLOAT, hal.HAL_OUT)
- c.newpin("motor-user", hal.HAL_FLOAT, hal.HAL_OUT)
- c.newpin("scale-cmd", hal.HAL_FLOAT, hal.HAL_IN)
- c.newpin("scale-fb", hal.HAL_FLOAT, hal.HAL_IN)
- c.newpin("scale-amps", hal.HAL_FLOAT, hal.HAL_IN)
- c.newpin("scale-volts", hal.HAL_FLOAT, hal.HAL_IN)
- c.newpin("scale-power", hal.HAL_FLOAT, hal.HAL_IN)
- c.newpin("scale-user", hal.HAL_FLOAT, hal.HAL_IN)
- c.newpin("estop", hal.HAL_BIT, hal.HAL_IN)
- c.newpin("reset-on-estop", hal.HAL_BIT, hal.HAL_IN)
- c.newpin("stat-bit-0", hal.HAL_BIT, hal.HAL_OUT)
- c.newpin("stat-bit-1", hal.HAL_BIT, hal.HAL_OUT)
- c.newpin("stat-bit-2", hal.HAL_BIT, hal.HAL_OUT)
- c.newpin("stat-bit-3", hal.HAL_BIT, hal.HAL_OUT)
- c.newpin("stat-bit-4", hal.HAL_BIT, hal.HAL_OUT)
- c.newpin("stat-bit-5", hal.HAL_BIT, hal.HAL_OUT)
- c.newpin("stat-bit-6", hal.HAL_BIT, hal.HAL_OUT)
- c.newpin("stat-bit-7", hal.HAL_BIT, hal.HAL_OUT)
+ c.newpin("fwd", hal.Type.BOOL, hal.Dir.IN)
+ c.newpin("run", hal.Type.BOOL, hal.Dir.IN)
+ c.newpin("up-to-speed", hal.Type.BOOL, hal.Dir.OUT)
+ c.newpin("alarm", hal.Type.BOOL, hal.Dir.OUT)
+ c.newpin("debug", hal.Type.BOOL, hal.Dir.IN)
+ c.newpin("monitor", hal.Type.BOOL, hal.Dir.IN)
+ c.newpin("motor-cmd", hal.Type.REAL, hal.Dir.IN)
+ c.newpin("motor-fb", hal.Type.REAL, hal.Dir.OUT)
+ c.newpin("motor-amps", hal.Type.REAL, hal.Dir.OUT)
+ c.newpin("motor-volts", hal.Type.REAL, hal.Dir.OUT)
+ c.newpin("motor-power", hal.Type.REAL, hal.Dir.OUT)
+ c.newpin("motor-user", hal.Type.REAL, hal.Dir.OUT)
+ c.newpin("scale-cmd", hal.Type.REAL, hal.Dir.IN)
+ c.newpin("scale-fb", hal.Type.REAL, hal.Dir.IN)
+ c.newpin("scale-amps", hal.Type.REAL, hal.Dir.IN)
+ c.newpin("scale-volts", hal.Type.REAL, hal.Dir.IN)
+ c.newpin("scale-power", hal.Type.REAL, hal.Dir.IN)
+ c.newpin("scale-user", hal.Type.REAL, hal.Dir.IN)
+ c.newpin("estop", hal.Type.BOOL, hal.Dir.IN)
+ c.newpin("reset-on-estop", hal.Type.BOOL, hal.Dir.IN)
+ c.newpin("stat-bit-0", hal.Type.BOOL, hal.Dir.OUT)
+ c.newpin("stat-bit-1", hal.Type.BOOL, hal.Dir.OUT)
+ c.newpin("stat-bit-2", hal.Type.BOOL, hal.Dir.OUT)
+ c.newpin("stat-bit-3", hal.Type.BOOL, hal.Dir.OUT)
+ c.newpin("stat-bit-4", hal.Type.BOOL, hal.Dir.OUT)
+ c.newpin("stat-bit-5", hal.Type.BOOL, hal.Dir.OUT)
+ c.newpin("stat-bit-6", hal.Type.BOOL, hal.Dir.OUT)
+ c.newpin("stat-bit-7", hal.Type.BOOL, hal.Dir.OUT)
# set reasonable defaults
c['scale-cmd'] = 1
c['scale-fb'] = 1
diff --git a/src/hal/user_comps/mqtt-publisher.py b/src/hal/user_comps/mqtt-publisher.py
index 847137dc30b..0a7c1ce60af 100755
--- a/src/hal/user_comps/mqtt-publisher.py
+++ b/src/hal/user_comps/mqtt-publisher.py
@@ -73,11 +73,11 @@ def create_pins(self, keys):
self.lcncstat.poll()
self.hal = hal.component('mqtt-publisher')
- self.hal.newpin('enable', hal.HAL_BIT, hal.HAL_IN)
+ self.hal.newpin('enable', hal.Type.BOOL, hal.Dir.IN)
self.hal['enable'] = True
- self.hal.newpin('period', hal.HAL_U32, hal.HAL_IN)
+ self.hal.newpin('period', hal.Type.UINT, hal.Dir.IN)
self.hal['period'] = 10
- self.hal.newpin('lastpublish', hal.HAL_U32, hal.HAL_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/pmx485.py b/src/hal/user_comps/pmx485.py
index 6c7796f0be7..15e1d2a512d 100644
--- a/src/hal/user_comps/pmx485.py
+++ b/src/hal/user_comps/pmx485.py
@@ -46,20 +46,20 @@
# create pmx485 component
try:
pmx485 = hal.component('pmx485')
- pmx485.newpin('mode_set', hal.HAL_FLOAT, hal.HAL_IN) #set cutting mode
- pmx485.newpin('current_set', hal.HAL_FLOAT, hal.HAL_IN) #set cutting current
- pmx485.newpin('pressure_set', hal.HAL_FLOAT, hal.HAL_IN) #set gas pressure
- pmx485.newpin('enable', hal.HAL_BIT, hal.HAL_IN) #enabler
- pmx485.newpin('mode', hal.HAL_FLOAT, hal.HAL_OUT) #cut mode feedback
- pmx485.newpin('current', hal.HAL_FLOAT, hal.HAL_OUT) #cutting current feedback
- pmx485.newpin('pressure', hal.HAL_FLOAT, hal.HAL_OUT) #gas pressure feedback
- pmx485.newpin('fault', hal.HAL_FLOAT, hal.HAL_OUT) #fault code
- pmx485.newpin('status', hal.HAL_BIT, hal.HAL_OUT) #connection status out
- pmx485.newpin('current_min', hal.HAL_FLOAT, hal.HAL_OUT) #minimum allowed current
- pmx485.newpin('current_max', hal.HAL_FLOAT, hal.HAL_OUT) #maximum allowed current
- pmx485.newpin('pressure_min', hal.HAL_FLOAT, hal.HAL_OUT) #minimum allowed gas pressure
- pmx485.newpin('pressure_max', hal.HAL_FLOAT, hal.HAL_OUT) #maximum allowed gas pressure
- pmx485.newpin('arcTime', hal.HAL_FLOAT, hal.HAL_OUT) #arc on time feedback
+ pmx485.newpin('mode_set', hal.Type.REAL, hal.Dir.IN) #set cutting mode
+ pmx485.newpin('current_set', hal.Type.REAL, hal.Dir.IN) #set cutting current
+ pmx485.newpin('pressure_set', hal.Type.REAL, hal.Dir.IN) #set gas pressure
+ pmx485.newpin('enable', hal.Type.BOOL, hal.Dir.IN) #enabler
+ pmx485.newpin('mode', hal.Type.REAL, hal.Dir.OUT) #cut mode feedback
+ pmx485.newpin('current', hal.Type.REAL, hal.Dir.OUT) #cutting current feedback
+ pmx485.newpin('pressure', hal.Type.REAL, hal.Dir.OUT) #gas pressure feedback
+ pmx485.newpin('fault', hal.Type.REAL, hal.Dir.OUT) #fault code
+ pmx485.newpin('status', hal.Type.BOOL, hal.Dir.OUT) #connection status out
+ pmx485.newpin('current_min', hal.Type.REAL, hal.Dir.OUT) #minimum allowed current
+ pmx485.newpin('current_max', hal.Type.REAL, hal.Dir.OUT) #maximum allowed current
+ pmx485.newpin('pressure_min', hal.Type.REAL, hal.Dir.OUT) #minimum allowed gas pressure
+ pmx485.newpin('pressure_max', hal.Type.REAL, hal.Dir.OUT) #maximum allowed gas pressure
+ pmx485.newpin('arcTime', hal.Type.REAL, hal.Dir.OUT) #arc on time feedback
pmx485.ready()
except:
print('\nERROR: pmx485 component could not be initialized\n')
diff --git a/src/hal/user_comps/scorbot-er-3.py b/src/hal/user_comps/scorbot-er-3.py
index 77c420d916d..2206223f798 100755
--- a/src/hal/user_comps/scorbot-er-3.py
+++ b/src/hal/user_comps/scorbot-er-3.py
@@ -76,10 +76,10 @@ def serial_read(num_bytes):
old_counts = [None] * 8
old_motor_max_vel = [None] * 8
for joint in range(0, 8):
- h.newpin('joint%d.limit-sw' % joint, hal.HAL_BIT, hal.HAL_OUT)
- h.newpin('joint%d.motor-pos-cmd' % joint, hal.HAL_FLOAT, hal.HAL_IN)
- h.newpin('joint%d.scale' % joint, hal.HAL_FLOAT, hal.HAL_IN)
- h.newpin('joint%d.motor-max-vel' % joint, hal.HAL_S32, hal.HAL_IN)
+ 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.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 9b45326917e..de150d33c71 100644
--- a/src/hal/user_comps/sim-torch.py
+++ b/src/hal/user_comps/sim-torch.py
@@ -29,19 +29,19 @@
h = hal.component('sim-torch')
# create the hal pins
h.setprefix('sim-torch')
-h.newpin('cut-noise-in', hal.HAL_FLOAT, hal.HAL_IN)
-h.newpin('cycles-in', hal.HAL_S32, hal.HAL_IN)
-h.newpin('on-delay-in', hal.HAL_S32, hal.HAL_IN)
-h.newpin('offset-in', hal.HAL_FLOAT, hal.HAL_IN)
-h.newpin('overshoot-in', hal.HAL_S32, hal.HAL_IN)
-h.newpin('ramp-noise-in', hal.HAL_FLOAT, hal.HAL_IN)
-h.newpin('ramp-up-in', hal.HAL_S32, hal.HAL_IN)
-h.newpin('start', hal.HAL_BIT, hal.HAL_IN)
-h.newpin('voltage-in', hal.HAL_FLOAT, hal.HAL_IN)
-h.newpin('close', hal.HAL_BIT, hal.HAL_IN)
-h.newpin('voltage-out', hal.HAL_FLOAT, hal.HAL_OUT)
-h.newpin('void', hal.HAL_BIT, hal.HAL_IN)
-h.newpin('void_ramp', hal.HAL_S32, hal.HAL_IN)
+h.newpin('cut-noise-in', hal.Type.REAL, 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.Type.SINT, hal.Dir.IN)
+h.newpin('ramp-noise-in', hal.Type.REAL, 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.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/vismach/5axisgui.py b/src/hal/user_comps/vismach/5axisgui.py
index 0366112c4f7..d5fe64fef4e 100755
--- a/src/hal/user_comps/vismach/5axisgui.py
+++ b/src/hal/user_comps/vismach/5axisgui.py
@@ -79,14 +79,14 @@ def coords(self):
return -self.comp.tool_length, r, 0, r
c = hal.component("5axisgui")
-c.newpin("jx", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("jy", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("jz", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("jb", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("jc", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tool_length", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tool_diam", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("pivot_len", hal.HAL_FLOAT, hal.HAL_OUT)
+c.newpin("jx", hal.Type.REAL, hal.Dir.IN)
+c.newpin("jy", hal.Type.REAL, hal.Dir.IN)
+c.newpin("jz", hal.Type.REAL, hal.Dir.IN)
+c.newpin("jb", hal.Type.REAL, hal.Dir.IN)
+c.newpin("jc", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tool_length", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tool_diam", hal.Type.REAL, hal.Dir.IN)
+c.newpin("pivot_len", hal.Type.REAL, hal.Dir.OUT)
c["pivot_len"] = pivot_len
c.ready()
diff --git a/src/hal/user_comps/vismach/hbmgui.py b/src/hal/user_comps/vismach/hbmgui.py
index 55f423c1136..0a3dcaf580f 100755
--- a/src/hal/user_comps/vismach/hbmgui.py
+++ b/src/hal/user_comps/vismach/hbmgui.py
@@ -74,13 +74,13 @@ def coords(self):
c = hal.component("hbmgui")
# HAL pins
-c.newpin("table", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("saddle", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("head", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("quill", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("table", hal.Type.REAL, hal.Dir.IN)
+c.newpin("saddle", hal.Type.REAL, hal.Dir.IN)
+c.newpin("head", hal.Type.REAL, hal.Dir.IN)
+c.newpin("quill", hal.Type.REAL, hal.Dir.IN)
-c.newpin("tool-length", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tool-radius", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("tool-length", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tool-radius", hal.Type.REAL, hal.Dir.IN)
c.ready()
tool_radius=0.5
diff --git a/src/hal/user_comps/vismach/hexagui.py b/src/hal/user_comps/vismach/hexagui.py
index 36429fa899a..cba5d8b015a 100755
--- a/src/hal/user_comps/vismach/hexagui.py
+++ b/src/hal/user_comps/vismach/hexagui.py
@@ -52,20 +52,20 @@ def popupmsg():
#if(randomize): compname += str(random.randrange(0,10000))
c = hal.component(compname)
#declare hal pins here
-c.newpin("joint.0", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint.1", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint.2", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint.3", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint.4", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint.5", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("joint.0", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint.1", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint.2", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint.3", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint.4", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint.5", hal.Type.REAL, hal.Dir.IN)
#get the tool tip position in cartesian coordinates from emc
#so we dont have to do kinematics
-c.newpin("axis.x", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("axis.y", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("axis.z", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("axis.a", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("axis.b", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("axis.c", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("axis.x", hal.Type.REAL, hal.Dir.IN)
+c.newpin("axis.y", hal.Type.REAL, hal.Dir.IN)
+c.newpin("axis.z", hal.Type.REAL, hal.Dir.IN)
+c.newpin("axis.a", hal.Type.REAL, hal.Dir.IN)
+c.newpin("axis.b", hal.Type.REAL, hal.Dir.IN)
+c.newpin("axis.c", hal.Type.REAL, hal.Dir.IN)
c.ready()
diff --git a/src/hal/user_comps/vismach/lineardelta.py b/src/hal/user_comps/vismach/lineardelta.py
index b1b7377903c..2b0638258f0 100644
--- a/src/hal/user_comps/vismach/lineardelta.py
+++ b/src/hal/user_comps/vismach/lineardelta.py
@@ -59,12 +59,12 @@ def popupmsg():
for setting in sys.argv[1:]: exec(setting)
c = hal.component("lineardelta")
-c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("R", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("L", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("joint0", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint1", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint2", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint3", hal.Type.REAL, hal.Dir.IN)
+c.newpin("R", hal.Type.REAL, hal.Dir.IN)
+c.newpin("L", hal.Type.REAL, hal.Dir.IN)
c['R'], c['L'] = lineardeltakins.get_geometry()
c.ready()
diff --git a/src/hal/user_comps/vismach/maho600gui.py b/src/hal/user_comps/vismach/maho600gui.py
index 14bc2ab1842..62835735e7a 100755
--- a/src/hal/user_comps/vismach/maho600gui.py
+++ b/src/hal/user_comps/vismach/maho600gui.py
@@ -69,19 +69,19 @@ def coords(self):
c = hal.component("maho600gui")
# table
-c.newpin("table", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("table", hal.Type.REAL, hal.Dir.IN)
# full width ways that table rides one
# this assembly moves up and down for Y
-c.newpin("tableway", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("tableway", hal.Type.REAL, hal.Dir.IN)
# head vertical slide
-c.newpin("head", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("head", hal.Type.REAL, hal.Dir.IN)
# head tilt
-c.newpin("arotate", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("arotate", hal.Type.REAL, hal.Dir.IN)
# rotary table
-c.newpin("brotate", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("brotate", hal.Type.REAL, hal.Dir.IN)
-c.newpin("tool-length", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tool-radius", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("tool-length", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tool-radius", hal.Type.REAL, hal.Dir.IN)
c.ready()
pivot_len=100
diff --git a/src/hal/user_comps/vismach/max5gui.py b/src/hal/user_comps/vismach/max5gui.py
index f020299cc66..46e6d4c7a35 100755
--- a/src/hal/user_comps/vismach/max5gui.py
+++ b/src/hal/user_comps/vismach/max5gui.py
@@ -69,18 +69,18 @@ def coords(self):
c = hal.component("max5gui")
# table
-c.newpin("table", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("table", hal.Type.REAL, hal.Dir.IN)
# saddle
-c.newpin("saddle", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("saddle", hal.Type.REAL, hal.Dir.IN)
# head vertical slide
-c.newpin("head", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("head", hal.Type.REAL, hal.Dir.IN)
# head tilt
-c.newpin("tilt", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("tilt", hal.Type.REAL, hal.Dir.IN)
# rotary table
-c.newpin("rotate", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("rotate", hal.Type.REAL, hal.Dir.IN)
-c.newpin("tool-length", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tool-radius", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("tool-length", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tool-radius", hal.Type.REAL, hal.Dir.IN)
c.ready()
pivot_len=100
diff --git a/src/hal/user_comps/vismach/melfagui.py b/src/hal/user_comps/vismach/melfagui.py
index 479f1c6cdc2..058bd545fa0 100755
--- a/src/hal/user_comps/vismach/melfagui.py
+++ b/src/hal/user_comps/vismach/melfagui.py
@@ -41,15 +41,15 @@ def popupmsg():
import hal
c = hal.component("melfagui")
-c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint6", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("lnkdx", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("lnkdz", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("grip", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("joint1", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint2", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint3", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint4", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint5", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint6", hal.Type.REAL, hal.Dir.IN)
+c.newpin("lnkdx", hal.Type.REAL, hal.Dir.IN)
+c.newpin("lnkdz", hal.Type.REAL, hal.Dir.IN)
+c.newpin("grip", hal.Type.REAL, hal.Dir.IN)
c.ready()
diff --git a/src/hal/user_comps/vismach/millturngui.py b/src/hal/user_comps/vismach/millturngui.py
index fa822699cde..a376035a1f6 100755
--- a/src/hal/user_comps/vismach/millturngui.py
+++ b/src/hal/user_comps/vismach/millturngui.py
@@ -57,18 +57,18 @@ def popupmsg():
# in this file, and uncomment last line in HAL file.
# add joints. Mill has 3.
c = hal.component("millturngui")
-c.newpin("jointX", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("jointY", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("jointZ", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("jointA", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("jointX", hal.Type.REAL, hal.Dir.IN)
+c.newpin("jointY", hal.Type.REAL, hal.Dir.IN)
+c.newpin("jointZ", hal.Type.REAL, hal.Dir.IN)
+c.newpin("jointA", hal.Type.REAL, hal.Dir.IN)
# kinematics pins
-c.newpin("millkins", hal.HAL_BIT, hal.HAL_IN)
+c.newpin("millkins", hal.Type.BOOL, hal.Dir.IN)
# tool length and diameter pins?
-c.newpin("toollength", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tooldiameter", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tool-x-offset", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("toollength", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tooldiameter", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tool-x-offset", hal.Type.REAL, hal.Dir.IN)
# tells loadusr pins is ready
c.ready()
diff --git a/src/hal/user_comps/vismach/puma560gui.py b/src/hal/user_comps/vismach/puma560gui.py
index bdd9affb243..87b265bf2fa 100755
--- a/src/hal/user_comps/vismach/puma560gui.py
+++ b/src/hal/user_comps/vismach/puma560gui.py
@@ -57,13 +57,13 @@ def popupmsg():
import hal
c = hal.component("puma560gui")
-c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint6", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("grip", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("joint1", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint2", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint3", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint4", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint5", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint6", hal.Type.REAL, hal.Dir.IN)
+c.newpin("grip", hal.Type.REAL, hal.Dir.IN)
c.ready()
diff --git a/src/hal/user_comps/vismach/pumagui.py b/src/hal/user_comps/vismach/pumagui.py
index 05399be4fac..40cf0b15273 100755
--- a/src/hal/user_comps/vismach/pumagui.py
+++ b/src/hal/user_comps/vismach/pumagui.py
@@ -79,12 +79,12 @@ def popupmsg():
import hal
c = hal.component("pumagui")
-c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint6", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("joint1", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint2", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint3", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint4", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint5", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint6", hal.Type.REAL, hal.Dir.IN)
c.ready()
###################
diff --git a/src/hal/user_comps/vismach/rotarydelta.py b/src/hal/user_comps/vismach/rotarydelta.py
index da1beee2f31..d27e5d9c14a 100755
--- a/src/hal/user_comps/vismach/rotarydelta.py
+++ b/src/hal/user_comps/vismach/rotarydelta.py
@@ -59,13 +59,13 @@ def popupmsg():
for setting in sys.argv[1:]: exec(setting)
c = hal.component("rotarydelta")
-c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("pfr", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tl", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("sl", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("fr", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("joint0", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint1", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint2", hal.Type.REAL, hal.Dir.IN)
+c.newpin("pfr", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tl", hal.Type.REAL, hal.Dir.IN)
+c.newpin("sl", hal.Type.REAL, hal.Dir.IN)
+c.newpin("fr", hal.Type.REAL, hal.Dir.IN)
c['pfr'], c['tl'], c['sl'], c['fr'] = rotarydeltakins.get_geometry()
c.ready()
diff --git a/src/hal/user_comps/vismach/scaragui.py b/src/hal/user_comps/vismach/scaragui.py
index 5a0082ea5c4..4a38f2c8cb2 100755
--- a/src/hal/user_comps/vismach/scaragui.py
+++ b/src/hal/user_comps/vismach/scaragui.py
@@ -56,12 +56,12 @@ def popupmsg():
import sys
c = hal.component("scaragui")
-c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("joint5", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("joint0", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint1", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint2", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint3", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint4", hal.Type.REAL, hal.Dir.IN)
+c.newpin("joint5", hal.Type.REAL, hal.Dir.IN)
c.ready()
# parameters that define the geometry see scarakins.c for definitions these
diff --git a/src/hal/user_comps/vismach/xyzab-tdr-gui.py b/src/hal/user_comps/vismach/xyzab-tdr-gui.py
index c70ca7c477b..1f62874dd9f 100644
--- a/src/hal/user_comps/vismach/xyzab-tdr-gui.py
+++ b/src/hal/user_comps/vismach/xyzab-tdr-gui.py
@@ -66,26 +66,26 @@ def popupmsg():
c = hal.component("xyzab-tdr-gui")
# axis-x
-c.newpin("axis-x", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("axis-x", hal.Type.REAL, hal.Dir.IN)
# axis-y
-c.newpin("axis-y", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("axis-y", hal.Type.REAL, hal.Dir.IN)
# axis-z
-c.newpin("axis-z", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("axis-z", hal.Type.REAL, hal.Dir.IN)
# rotary_a
-c.newpin("rotary-a", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("rotary-a", hal.Type.REAL, hal.Dir.IN)
# rotary_b
-c.newpin("rotary-b", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("rotary-b", hal.Type.REAL, hal.Dir.IN)
# geometric offsets between A and B axes
-c.newpin("x_offset", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("z_offset", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("x_offset", hal.Type.REAL, hal.Dir.IN)
+c.newpin("z_offset", hal.Type.REAL, hal.Dir.IN)
# rot-point offsets
-c.newpin("x-rot-point", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("y-rot-point", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("z-rot-point", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("x-rot-point", hal.Type.REAL, hal.Dir.IN)
+c.newpin("y-rot-point", hal.Type.REAL, hal.Dir.IN)
+c.newpin("z-rot-point", hal.Type.REAL, hal.Dir.IN)
# tool-length offset
# tool offsets
-c.newpin("tool_length", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tool_diameter", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("tool_length", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tool_diameter", hal.Type.REAL, hal.Dir.IN)
c.ready()
# These values are arbitrary and are meant to simulate an absolute
diff --git a/src/hal/user_comps/vismach/xyzac-trt-gui.py b/src/hal/user_comps/vismach/xyzac-trt-gui.py
index 3e7c5fcb879..021dd2e2a1c 100755
--- a/src/hal/user_comps/vismach/xyzac-trt-gui.py
+++ b/src/hal/user_comps/vismach/xyzac-trt-gui.py
@@ -63,19 +63,19 @@ def popupmsg():
c = hal.component("xyzac-trt-gui")
# table-x
-c.newpin("table-x", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("table-x", hal.Type.REAL, hal.Dir.IN)
# saddle-y
-c.newpin("saddle-y", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("saddle-y", hal.Type.REAL, hal.Dir.IN)
# head vertical slide
-c.newpin("spindle-z", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("spindle-z", hal.Type.REAL, hal.Dir.IN)
# table-x tilt-b
-c.newpin("tilt-a", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("tilt-a", hal.Type.REAL, hal.Dir.IN)
# rotary table-x
-c.newpin("rotate-c", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("rotate-c", hal.Type.REAL, hal.Dir.IN)
# offsets
-c.newpin("y-offset", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("z-offset", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tool-offset", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("y-offset", hal.Type.REAL, hal.Dir.IN)
+c.newpin("z-offset", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tool-offset", hal.Type.REAL, hal.Dir.IN)
c.ready()
for setting in sys.argv[1:]: exec(setting)
diff --git a/src/hal/user_comps/vismach/xyzbc-trt-gui.py b/src/hal/user_comps/vismach/xyzbc-trt-gui.py
index 0804a29ed2b..a6185242331 100755
--- a/src/hal/user_comps/vismach/xyzbc-trt-gui.py
+++ b/src/hal/user_comps/vismach/xyzbc-trt-gui.py
@@ -62,18 +62,18 @@ def popupmsg():
c = hal.component("xyzbc-trt-gui")
# table-x
-c.newpin("table-x", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("table-x", hal.Type.REAL, hal.Dir.IN)
# saddle-y
-c.newpin("saddle-y", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("saddle-y", hal.Type.REAL, hal.Dir.IN)
# head vertical slide
-c.newpin("spindle-z", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("spindle-z", hal.Type.REAL, hal.Dir.IN)
# table-x tilt-b
-c.newpin("tilt-b", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("tilt-b", hal.Type.REAL, hal.Dir.IN)
# rotary table-x
-c.newpin("rotate-c", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("z-offset", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("x-offset", hal.HAL_FLOAT, hal.HAL_IN)
-c.newpin("tool-offset", hal.HAL_FLOAT, hal.HAL_IN)
+c.newpin("rotate-c", hal.Type.REAL, hal.Dir.IN)
+c.newpin("z-offset", hal.Type.REAL, hal.Dir.IN)
+c.newpin("x-offset", hal.Type.REAL, hal.Dir.IN)
+c.newpin("tool-offset", hal.Type.REAL, hal.Dir.IN)
c.ready()
for setting in sys.argv[1:]: exec(setting)
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 366c2889587..07c1c94bd96 100644
--- a/src/hal/user_comps/z_level_compensation.py
+++ b/src/hal/user_comps/z_level_compensation.py
@@ -110,15 +110,15 @@ def compensate(self):
def run(self):
self.h = hal.component("z_level_compensation")
- self.h.newpin("enable-in", hal.HAL_BIT, hal.HAL_IN)
- self.h.newpin("scale", hal.HAL_FLOAT, hal.HAL_OUT)
- self.h.newpin("counts", hal.HAL_S32, hal.HAL_OUT)
- self.h.newpin("clear", hal.HAL_BIT, hal.HAL_IN)
- self.h.newpin("x-pos", hal.HAL_FLOAT, hal.HAL_IN)
- self.h.newpin("y-pos", hal.HAL_FLOAT, hal.HAL_IN)
- self.h.newpin("z-pos", hal.HAL_FLOAT, hal.HAL_IN)
- self.h.newpin("fade-height", hal.HAL_FLOAT, hal.HAL_IN)
- self.h.newpin("method", hal.HAL_S32, hal.HAL_IN)
+ 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.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.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..29931678b54 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,27 @@ 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']
+# 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" }
newtypes = ['bool', 'sint', 'uint', 'si32', 'ui32', 'real']
+
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 +180,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 +223,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 +247,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 +289,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,7 +385,7 @@ static int comp_id;
print(" int _personality;", file=f)
for name, type_, array, dir_, value, personality in pins:
- star = '' if type_ in newtypes else '*'
+ star = '' if type_ in newtypes or 'port' == type_ 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)
@@ -457,6 +492,9 @@ static int comp_id;
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)
+ elif 'port' == type_:
+ print(" r = hal_pin_new_%s(comp_id, %s, &(inst->%s_p[j])," % (
+ type_, dirmap[dir_], to_c(name)), file=f)
else:
print(" r = hal_pin_%s_newf(%s, &(inst->%s_p[j]), comp_id," % (
type_, dirmap[dir_], to_c(name)), file=f)
@@ -470,6 +508,10 @@ static int comp_id;
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)
+ elif '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:
print(" r = hal_pin_%s_newf(%s, &(inst->%s_p), comp_id," % (
type_, dirmap[dir_], to_c(name)), file=f)
@@ -522,6 +564,35 @@ static int comp_id;
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 +605,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)
@@ -1333,6 +1404,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 +1414,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 +1466,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/abort/on_abort_command-crazy-move/test-ui.py b/tests/abort/on_abort_command-crazy-move/test-ui.py
index 85a5e32255d..0fd8c1dc559 100755
--- a/tests/abort/on_abort_command-crazy-move/test-ui.py
+++ b/tests/abort/on_abort_command-crazy-move/test-ui.py
@@ -27,8 +27,8 @@
# Create and connect test feedback comp
#
h = hal.component("test-ui")
-h.newpin("Xpos", hal.HAL_FLOAT, hal.HAL_IN)
-h.newpin("Ypos", hal.HAL_FLOAT, hal.HAL_IN)
+h.newpin("Xpos", hal.Type.REAL, hal.Dir.IN)
+h.newpin("Ypos", hal.Type.REAL, hal.Dir.IN)
h.ready()
os.system("halcmd source ./postgui.hal")
diff --git a/tests/abort/stop-button-crazy-move/test-ui.py b/tests/abort/stop-button-crazy-move/test-ui.py
index 897c56e4926..839940e1e26 100755
--- a/tests/abort/stop-button-crazy-move/test-ui.py
+++ b/tests/abort/stop-button-crazy-move/test-ui.py
@@ -26,8 +26,8 @@
# Create and connect test feedback comp
#
h = hal.component("test-ui")
-h.newpin("Xpos", hal.HAL_FLOAT, hal.HAL_IN)
-h.newpin("Ypos", hal.HAL_FLOAT, hal.HAL_IN)
+h.newpin("Xpos", hal.Type.REAL, hal.Dir.IN)
+h.newpin("Ypos", hal.Type.REAL, hal.Dir.IN)
h.ready()
os.system("halcmd source ./postgui.hal")
diff --git a/tests/classicladder/estop/classicladder-estop-ui.py b/tests/classicladder/estop/classicladder-estop-ui.py
index 3f0f0ee859e..a579bb3b5d0 100755
--- a/tests/classicladder/estop/classicladder-estop-ui.py
+++ b/tests/classicladder/estop/classicladder-estop-ui.py
@@ -23,7 +23,7 @@ def wait_for_hal_pin(name, value, timeout=10):
retval = 0
h = hal.component("python-ui")
-h.newpin("ext-estop-button", hal.HAL_BIT, hal.HAL_OUT)
+h.newpin("ext-estop-button", hal.Type.BOOL, hal.Dir.OUT)
h.ready() # mark the component as 'ready'
hal.connect('python-ui.ext-estop-button', 'ext-estop')
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 3ce6e9eee37..a63c5a7a31b 100755
--- a/tests/hal-link-unlink/hallink.py
+++ b/tests/hal-link-unlink/hallink.py
@@ -7,8 +7,8 @@ def cmd(arg):
subprocess.call(arg, shell=True)
h = hal.component("linktest")
-h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN)
-h.newpin("inout", hal.HAL_FLOAT, hal.HAL_IO)
+h.newpin("in", hal.Type.REAL, hal.Dir.IN)
+h.newpin("inout", hal.Type.REAL, hal.Dir.IO)
h.ready()
# set pin values before linking
@@ -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.3/expected b/tests/halmodule.3/expected
deleted file mode 100644
index 140572ef7d0..00000000000
--- a/tests/halmodule.3/expected
+++ /dev/null
@@ -1,60 +0,0 @@
-# Pins
-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'}
-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'}
-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'}
-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'}
-# Params
-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-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'}
-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}
-net-input-b {'haltype': 'signal', 'name': 'net-input-b', 'type': , 'value': False, 'writers': 0, 'readers': 2, 'bidirs': 0, 'driver': None}
-net-output {'haltype': 'signal', 'name': 'net-output', 'type': , 'value': False, 'writers': 1, 'readers': 0, 'bidirs': 0, 'driver': 'xor2.0.out'}
-net-xor-a {'haltype': 'signal', 'name': 'net-xor-a', 'type': , 'value': False, 'writers': 1, 'readers': 1, 'bidirs': 0, 'driver': 'and2.0.out'}
-net-xor-b {'haltype': 'signal', 'name': 'net-xor-b', 'type': , 'value': False, 'writers': 1, 'readers': 1, 'bidirs': 0, 'driver': 'or2.0.out'}
-# Components
-xor2 {'haltype': 'component', 'name': 'xor2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'}
-or2 {'haltype': 'component', 'name': 'or2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'}
-and2 {'haltype': 'component', 'name': 'and2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'}
-__testthread {'haltype': 'component', 'name': '__testthread', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': None}
-threads {'haltype': 'component', 'name': 'threads', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'name1=testthread period1=1000000'}
-# Functions
-and2.0 {'haltype': 'function', 'name': 'and2.0', 'comp': 'and2', 'comp_id': 'ID', 'users': 1, 'reentrant': False}
-or2.0 {'haltype': 'function', 'name': 'or2.0', 'comp': 'or2', 'comp_id': 'ID', 'users': 1, 'reentrant': False}
-xor2.0 {'haltype': 'function', 'name': 'xor2.0', 'comp': 'xor2', 'comp_id': 'ID', 'users': 1, 'reentrant': False}
-# Threads
-testthread {'haltype': 'thread', 'name': 'testthread', 'comp': '__testthread', 'comp_id': 'ID', 'priority': 0, 'period': 1000000, 'functions': [{'haltype': 'threadfunction', 'name': 'and2.0', 'index': 0, 'is_init': False}, {'haltype': 'threadfunction', 'name': 'or2.0', 'index': 1, 'is_init': False}, {'haltype': 'threadfunction', 'name': 'xor2.0', 'index': 2, 'is_init': False}]}
-# Signal pins
-and2.0.out {'haltype': 'pin', 'name': 'and2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'and2', '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'}
-# Intended failures
-pin('does-not-exist') fails correctly
-param('does-not-exist') fails correctly
-signal('does-not-exist') fails correctly
-comp('does-not-exist') fails correctly
-comp(65534) fails correctly
-funct('does-not-exist') fails correctly
-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'}
-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}
-Thread: {'haltype': 'thread', 'name': 'testthread', 'comp': '__testthread', 'comp_id': 'ID', 'priority': 0, 'period': 1000000, 'functions': [{'haltype': 'threadfunction', 'name': 'and2.0', 'index': 0, 'is_init': False}, {'haltype': 'threadfunction', 'name': 'or2.0', 'index': 1, 'is_init': False}, {'haltype': 'threadfunction', 'name': 'xor2.0', 'index': 2, 'is_init': False}]}
diff --git a/tests/halmodule.0/README b/tests/halmodule/comp-set-get/README
similarity index 100%
rename from tests/halmodule.0/README
rename to tests/halmodule/comp-set-get/README
diff --git a/tests/halmodule.0/expected b/tests/halmodule/comp-set-get/expected
similarity index 94%
rename from tests/halmodule.0/expected
rename to tests/halmodule/comp-set-get/expected
index 37c7b48be8d..1d5f8e6169a 100644
--- a/tests/halmodule.0/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.0/test.py b/tests/halmodule/comp-set-get/test.py
similarity index 75%
rename from tests/halmodule.0/test.py
rename to tests/halmodule/comp-set-get/test.py
index 59e0e83d457..5a4db102b8f 100755
--- a/tests/halmodule.0/test.py
+++ b/tests/halmodule/comp-set-get/test.py
@@ -4,10 +4,10 @@
h = hal.component("x")
try:
- ps = h.newpin("s", hal.HAL_S32, hal.HAL_OUT)
- pu = h.newpin("u", hal.HAL_U32, hal.HAL_OUT)
- pf = h.newpin("f", hal.HAL_FLOAT, hal.HAL_OUT)
- param = h.newparam("param", hal.HAL_BIT, hal.HAL_RW)
+ 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()
def try_set(p, v):
@@ -64,27 +64,27 @@ 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.HAL_OUT)
- pin_validate(pu, hal.HAL_U32, hal.HAL_OUT)
- pin_validate(pf, hal.HAL_FLOAT, hal.HAL_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.HAL_OUT)
+ pin_validate(pin, hal.Type.SINT, hal.Dir.OUT)
try:
pin = h.getitem("not-found")
print("{} {} {}".format("getitem", "not-found", "ok"))
except:
print("{} {} {}".format("getitem", "not-found", "fail"))
- pin_validate(param, hal.HAL_BIT, hal.HAL_RW)
+ pin_validate(param, hal.Type.BOOL, hal.Dir.RW)
param = h.getitem("param")
- pin_validate(param, hal.HAL_BIT, hal.HAL_RW)
+ pin_validate(param, hal.Type.BOOL, hal.Dir.RW)
pin = h.getpin("s")
- pin_validate(pin, hal.HAL_S32, hal.HAL_OUT)
+ pin_validate(pin, hal.Type.SINT, hal.Dir.OUT)
param = h.getparam("param")
- pin_validate(param, hal.HAL_BIT, hal.HAL_RW)
+ pin_validate(param, hal.Type.BOOL, hal.Dir.RW)
try_set_pin(pu, 0)
try_set_pin(pu, -1)
diff --git a/tests/halmodule.0/test.sh b/tests/halmodule/comp-set-get/test.sh
similarity index 100%
rename from tests/halmodule.0/test.sh
rename to tests/halmodule/comp-set-get/test.sh
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
new file mode 100644
index 00000000000..84bb9e1ef74
--- /dev/null
+++ b/tests/halmodule/halquery/expected
@@ -0,0 +1,60 @@
+# Pins
+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'}
+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'}
+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'}
+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'}
+# Params
+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-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'}
+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}
+net-input-b {'haltype': 'signal', 'name': 'net-input-b', 'type': , 'value': False, 'writers': 0, 'readers': 2, 'bidirs': 0, 'driver': None}
+net-output {'haltype': 'signal', 'name': 'net-output', 'type': , 'value': False, 'writers': 1, 'readers': 0, 'bidirs': 0, 'driver': 'xor2.0.out'}
+net-xor-a {'haltype': 'signal', 'name': 'net-xor-a', 'type': , 'value': False, 'writers': 1, 'readers': 1, 'bidirs': 0, 'driver': 'and2.0.out'}
+net-xor-b {'haltype': 'signal', 'name': 'net-xor-b', 'type': , 'value': False, 'writers': 1, 'readers': 1, 'bidirs': 0, 'driver': 'or2.0.out'}
+# Components
+xor2 {'haltype': 'component', 'name': 'xor2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'}
+or2 {'haltype': 'component', 'name': 'or2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'}
+and2 {'haltype': 'component', 'name': 'and2', 'type':