summaryrefslogtreecommitdiff
path: root/docs/man/man3/hm2_bspi_set_write_function.3hm2
blob: 12b890fa446d27bd7d099c74637ab1786ca788ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
\# Author Andy Pugh
\# Issued under the terms of the GPL v2 License or any later version

.TH hm2_bspi_set_write_function "3hm2" "2011-05-31" "LinuxCNC Documentation" "Hostmot2"
.SH NAME

hm2_bspi_set_write_function \- Register a function to handle the tram write phase
of a hostmot2 buffered SPI driver. 
.SH SYNTAX
.HP
int hm2_bspi_set_write_function(char *name, void *func, void *subdata)

.SH DESCRIPTION
\fBhm2_bspi_set_write_function\fR Registers a function in an external driver 
(typically written in "comp") 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 to standard output 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 /fBnot/fP use the FUNCTION() convenience macro, and the argument
to the function in the definition  must /fBallways/fP 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 anywhare in the 
EXTRA_SETUP code. 

.SH RETURN VALUE
Returns 0 on success and -1 on failure.

.SH SEE ALSO
man hm2_bspi_setup_chan, man hm2_bspi_write_chan, man hm2_tram_add_bspi_frame
man hm2_allocate_bspi_tram.
See src/hal/drivers mesa_7i65.comp for an example usage.