LinuxCNC Documentation

СИНТАКСИС

#include <hal.h>

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, ...);

АРГУМЕНТИ

ім’я

Назва функції.

funct

Вказівник на функцію.

arg

Аргумент, який слід передати як перший параметр функції 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

Якщо значення reentrant не дорівнює нулю, функцію можна випередити та викликати знову до завершення першого виклику. В іншому випадку її можна додати лише до одного потоку.

comp_id

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

fmt, …​

A printf-style format string and arguments

ОПИС

The hal_export_funct() function makes a realtime function provided by a component available to the system. A subsequent call to hal_add_funct_to_thread(3) 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(),

long period

is the interval between calls in nanoseconds.

Кожен виклик функції повинен виконувати невеликий обсяг роботи та повертати результат.

ПОВЕРНЕНЕ ЗНАЧЕННЯ

Повертає код стану HAL.

ДИВІТЬСЯ ТАКОЖ