hm2_bspi_set_write_function

NAME
SYNTAX
DESCRIPTION
REALTIME CONSIDERATIONS
RETURN VALUE
SEE ALSO

NAME

hm2_bspi_set_write_function - Register a function to handle the tram write phase of a hostmot2 buffered SPI driver.

SYNTAX

#include <hostmot2-serial.h>

int hm2_bspi_set_write_function(char *name, void *func, void *subdata)

DESCRIPTION

hm2_bspi_set_write_function registers a function in an external driver to be called every time that the main Hostmot2 driver calls the generic "prepare_tram_write" functions. The names of the available channels are printed with rtapi_print_msg during the driver loading process and take the form:

hm2_<board name>.<board index>.bspi.<index>

For example hm2_5i23.0.bspi.0.

"func" should be a pointer to a function in the sub driver which is to be called to process the pins into BSPI write registers prior to the regular TRAM write phase. The function must take a single argument, a pointer to an individual instance of the internal driver. If defined in comp then the function must not use the FUNCTION() convenience macro, and the argument to the function in the definition must always be (struct state *inst).

"subdata" is a pointer to the driver instance internal data. In the case of a driver written in comp this will always be "inst" in the function call.

If using comp then the call to this function should be anywhere in the EXTRA_SETUP code.

REALTIME CONSIDERATIONS

Call only from realtime init code, not from other realtime code or non-realtime components.

RETURN VALUE

Returns 0 on success and -1 on failure.

SEE ALSO

hm2_allocate_bspi_tram(3hm2), hm2_bspi_set_read_function(3hm2), hm2_bspi_setup_chan(3hm2), hm2_bspi_write_chan(3hm2), hm2_tram_add_bspi_frame(3hm2), src/hal/drivers mesa_7i65.comp in the LinuxCNC source distribution.