hm2_bspi_set_write_function.3hm2
1 \# Author Andy Pugh 2 \# Issued under the terms of the GPL v2 License or any later version 3 4 .TH hm2_bspi_set_write_function "3hm2" "2011-05-31" "LinuxCNC Documentation" "Hostmot2" 5 .SH NAME 6 7 hm2_bspi_set_write_function \- Register a function to handle the tram write phase 8 of a hostmot2 buffered SPI driver. 9 .SH SYNTAX 10 .nf 11 .B #include <hostmot2-serial.h> 12 .HP 13 int hm2_bspi_set_write_function(char *name, void *func, void *subdata) 14 15 .SH DESCRIPTION 16 \fBhm2_bspi_set_write_function\fR registers a function in an external driver 17 to be called every time that the main Hostmot2 18 driver calls the generic "prepare_tram_write" functions. 19 The names of the available channels are printed with rtapi_print_msg during the 20 driver loading process and take the form: 21 .RS 22 hm2_<board name>.<board index>.bspi.<index> 23 .RE 24 For example hm2_5i23.0.bspi.0. 25 26 "func" should be a pointer to a function in the sub driver which is to be 27 called to process the pins into BSPI write registers prior to the regular TRAM 28 write phase. The function must take a single argument, a pointer to an 29 individual instance of the internal driver. If defined in comp then the 30 function must \fBnot\fP use the FUNCTION() convenience macro, and the argument 31 to the function in the definition must \fBalways\fP be (struct state *inst). 32 33 "subdata" is a pointer to the driver instance internal data. In the case of a 34 driver written in comp this will always be "inst" in the function call. 35 36 If using comp then the call to this function should be anywhere in the 37 EXTRA_SETUP code. 38 39 .SH REALTIME CONSIDERATIONS 40 Call only from realtime init code, not from user space or realtime code. 41 42 .SH RETURN VALUE 43 Returns 0 on success and \-1 on failure. 44 45 .SH SEE ALSO 46 \fBhm2_allocate_bspi_tram(3hm2)\fR, 47 \fBhm2_bspi_set_read_function(3hm2)\fR, 48 \fBhm2_bspi_setup_chan(3hm2)\fR, 49 \fBhm2_bspi_write_chan(3hm2)\fR, 50 \fBhm2_tram_add_bspi_frame(3hm2)\fR, 51 src/hal/drivers mesa_7i65.comp in the LinuxCNC source distribution.