hal_export_funct(3hal)

hal_export_funct3hal

Create a realtime function callable from a thread

Usage

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)

Arguments

name

The name of the function.

funct

The pointer to the function

arg

The argument to be passed as the first parameter of funct

uses_fp

Nonzero if the function uses floating-point operations, including assignment of floating point values with "=".

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.

comp_id

A HAL component identifier returned by an earlier call to hal_init.

Overview

hal_export_funct makes a realtime function provided by a component available to the system. A subsequent call to hal_add_funct_to_thread can be used to schedule the execution of the function as needed by the system.

When this function is placed on a HAL thread, and HAL threads are started, funct is called repeatedly with two arguments: void *arg is the same value that was given to hal_export_funct, and long period is the interval between calls in nanoseconds.

Each call to the function should do a small amount of work and return.

Return value

Returns a HAL status code.

Releases

Unchanged in 2 releases since Debian 12 (Bookworm).

  1. 12–13

From linuxcnc-uspace-dev 1:2.9.4-2+deb13u1 in Debian 13 (Trixie). Parsed by carta from the page's man source.