---
name: "hal_type_t"
section: "3hal"
platform: "linux"
package: "linuxcnc-uspace-dev"
version: "1:2.9.4-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/hal_type_t"
---

# hal\_type\_t(3hal)

typedefs for HAL datatypes

## NAME

hal\_type\_t - typedefs for HAL datatypes

## DESCRIPTION

- typedef ... **hal\_bool;**

  **A type which may have a value of 0 or nonzero.**

- **typedef ... hal\_bit\_t;**

  **A volatile type which may have a value of 0 or nonzero.**

- **typedef ... hal\_s32\_t**;

  A volatile type which may have a value from -2147483648 to 2147483647.

- typedef ... **hal\_u32\_t**;

  A volatile type which may have a value from 0 to 4294967295.

- typedef ... **hal\_port\_t**;

  A volatile handle to a port object. Used with hal\_port\* functions.

- typedef ... **hal\_float\_t**;

  A volatile floating-point type, which typically has the same precision and range as the C type **double**.

- typedef ... **real\_t**;

  A nonvolatile floating-point type with at least as much precision as **hal\_float\_t**.

- typedef ... **ireal\_t**;

  A nonvolatile unsigned integral type the same size as **hal\_float\_t**.

- typedef enum **hal\_type\_t**;

  - **HAL\_BIT**

    Corresponds to the type **hal\_bit\_t**.

  - **HAL\_FLOAT**

    Corresponds to the type **hal\_float\_t**.

  - **HAL\_S32**

    Corresponds to the type **hal\_s32\_t**.

  - **HAL\_U32**

    Corresponds to the type **hal\_u32\_t**.

## NOTES

**hal\_bit\_t** is typically a typedef to an integer type whose range is larger than just 0 and 1.  When testing the value of a **hal\_bit\_t**, never compare it to 1.  Prefer one of the following:

- •

  if(b)

- •

  if(b != 0)

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:

- hal\_bit\_t

  int

- hal\_s32\_t

  \_\_s32

- hal\_u32\_t

  \_\_u32

- hal\_float\_t

  hal\_real\_t

- hal\_port\_t

  int

Take care not to use the types **s32** and **u32**.  These will compile in kernel modules but not in userspace, and not for realtime components when using uspace realtime.

## SEE ALSO

**[hal\_pin\_new(3hal)](/hal_pin_new/3hal.md)**, **[hal\_param\_new(3hal)](/hal_param_new/3hal.md)**
