/ docs / man / man3 / hal_type_t.3hal
hal_type_t.3hal
 1  .TH hal_type_t "3hal" "2006-10-12" "LinuxCNC Documentation" "HAL"
 2  .SH NAME
 3  hal_type_t \- typedefs for HAL datatypes
 4  .SH DESRCIPTION
 5  .TP
 6  typedef ... \fBhal_bool;
 7  A type which may have a value of 0 or nonzero.
 8  .TP
 9  typedef ... \fBhal_bit_t;
10  A volatile type which may have a value of 0 or nonzero.
11  .TP
12  typedef ... \fBhal_s32_t\fR;
13  A volatile type which may have a value from \-2147483648 to 2147483647.
14  .TP
15  typedef ... \fBhal_u32_t\fR;
16  A volatile type which may have a value from 0 to 4294967295.
17  .TP
18  typedef ... \fBhal_port_t\fR;
19  A volatile handle to a port object. Used with hal_port* functions.
20  .TP
21  typedef ... \fBhal_float_t\fR;
22  A volatile floating-point type, which typically has the same precision and range
23  as the C type \fBdouble\fR.
24  .TP
25  typedef ... \fBreal_t\fR;
26  A nonvolatile floating-point type with at least as much precision as
27  \fBhal_float_t\fR.
28  .TP
29  typedef ... \fBireal_t\fR;
30  A nonvolatile unsigned integral type the same size as \fBhal_float_t\fR.
31  .TP
32  typedef enum \fBhal_type_t\fR;
33  .RS
34  .TP
35  \fBHAL_BIT\fR
36  Corresponds to the type \fBhal_bit_t\fR.
37  .TP
38  \fBHAL_FLOAT\fR
39  Corresponds to the type \fBhal_float_t\fR.
40  .TP
41  \fBHAL_S32\fR
42  Corresponds to the type \fBhal_s32_t\fR.
43  .TP
44  \fBHAL_U32\fR
45  Corresponds to the type \fBhal_u32_t\fR.
46  .RE
47  .SH NOTES
48  \fBhal_bit_t\fR is typically a typedef to an integer type whose range is larger
49  than just 0 and 1.  When testing the value of a \fBhal_bit_t\fR, never compare
50  it to 1.  Prefer one of the following:
51  .RS
52  .IP \(bu 4
53  if(b)
54  .IP \(bu 4
55  if(b != 0)
56  .RE
57  
58  It is often useful to refer to a type that can represent all the values as a
59  hal type, but without the volatile qualifier.  The following types correspond
60  with the hal types:
61  .RS
62  .IP hal_bit_t 16
63  int
64  
65  .IP hal_s32_t 16
66  __s32
67  
68  .IP hal_u32_t 16
69  __u32
70  
71  .IP hal_float_t 16
72  hal_real_t
73  
74  .IP hal_port_t 16
75  int
76  .RE 
77  
78  Take care not to use the types \fBs32\fR and \fBu32\fR.  These will compile in
79  kernel modules but not in userspace, and not for "realtime components" when
80  using simulated (userspace) realtime.
81  
82  .SH SEE ALSO
83  \fBhal_pin_new(3hal)\fR, \fBhal_param_new(3hal)\fR