[][src]Function linuxcnc_hal_sys::hal_param_bit_new

pub unsafe extern "C" fn hal_param_bit_new(
    name: *const c_char,
    dir: hal_param_dir_t,
    data_addr: *mut hal_bit_t,
    comp_id: c_int
) -> c_int

The 'hal_param_xxx_new()' functions create a new 'parameter' object. A parameter is a value that is only used inside a component, but may need to be initialized or adjusted from outside the component to set up the system properly. Once a parameter has been created, it's value can be changed using the 'hal_param_xxx_set()' functions. There are eight functions, one for each of the data types that the HAL supports. Pins may only be linked to signals of the same type. 'name' is the name of the new parameter. It must be no longer than .HAL_NAME_LEN. If there is already a parameter with the same name the call will fail. 'dir' is the parameter direction. HAL_RO parameters are read only from outside, and are written to by the component itself, typically to provide a view "into" the component for testing or troubleshooting. HAL_RW parameters are writable from outside and also sometimes modified by the component itself as well. 'data_addr' is the address where the value of the parameter is to be stored. 'data_addr' must point to memory allocated by hal_malloc(). Typically the component allocates space for a data structure with hal_malloc(), and 'data_addr' is the address of a member of that structure. Creating the paremeter does not initialize or modify the value at *data_addr - the component should load a reasonable default value. 'comp_id' is the ID of the component that will 'own' the parameter. Normally it should be the ID of the caller, but in some cases, a user mode component may be doing setup for a realtime component, so the ID should be that of the realtime component that will actually be using the parameter. If successful, the hal_param_xxx_new() functions return 0. On failure they return a negative error code.