summaryrefslogtreecommitdiff
path: root/docs/man/man3/hal_type_t.3hal
blob: 1bb2e0eeba04493c247b3caf341e4522632cb07a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
.TH hal_type_t "3hal" "2006-10-12" "LinuxCNC Documentation" "HAL"
.SH NAME
hal_type_t \- typedefs for HAL datatypes
.SH DESRCIPTION
.TP
typedef ... \fBhal_bool;
A type which may have a value of 0 or nonzero.
.TP
typedef ... \fBhal_bit_t;
A volatile type which may have a value of 0 or nonzero.
.TP
typedef ... \fBhal_s32_t\fR;
A volatile type which may have a value from -2147483648 to 2147483647.
.TP
typedef ... \fBhal_u32_t\fR;
A volatile type which may have a value from 0 to 4294967295.
.TP
typedef ... \fBhal_float_t\fR;
A volatile floating-point type, which typically has the same precision and range
as the C type \fBdouble\fR.
.TP
typedef ... \fBreal_t\fR;
A nonvolatile floating-point type with at least as much precision as
\fBhal_float_t\fR.
.TP
typedef ... \fBireal_t\fR;
A nonvolatile unsigned integral type the same size as \fBhal_float_t\fR.
.TP
typedef enum \fBhal_type_t\fR;
.RS
.TP
\fBHAL_BIT\fR
Corresponds to the type \fBhal_bit_t\fR.
.TP
\fBHAL_FLOAT\fR
Corresponds to the type \fBhal_float_t\fR.
.TP
\fBHAL_S32\fR
Corresponds to the type \fBhal_s32_t\fR.
.TP
\fBHAL_U32\fR
Corresponds to the type \fBhal_u32_t\fR.
.RE
.SH NOTES
\fBhal_bit_t\fR is typically a typedef to an integer type whose range is larger
than just 0 and 1.  When testing the value of a \fBhal_bit_t\fR, never compare
it to 1.  Prefer one of the following:
.RS
.IP \(bu 4
if(b)
.IP \(bu 4
if(b != 0)
.RE

It is often useful to refer to a type that can represent all the values as a
hal type, but without the volatile qualifier.  The following types correspond
with the hal types:
.RS
.IP hal_bit_t 16
int

.IP hal_s32_t 16
__s32

.IP hal_u32_t 16
__u32

.IP hal_float_t 16
hal_real_t
.RE

Take care not to use the types \fBs32\fR and \fBu32\fR.  These will compile in
kernel modules but not in userspace, and not for "realtime components" when
using simulated (userspace) realtime.

.SH SEE ALSO
\fBhal_pin_new(3hal)\fR, \fBhal_param_new(3hal)\fR