hm2_pktuart_send.3hm2
1 \# Author Boris Skegin 2 \# Issued under the terms of the GPL v2 License or any later version 3 .TH hm2_pktuart_send "3hm2" "2016-02-29" "LinuxCNC Documentation" "Hostmot2" 4 .SH NAME 5 6 hm2_pktuart_send \- write data to a Hostmot2 PktUART 7 8 .SH SYNTAX 9 .nf 10 .B #include <hostmot2-serial.h> 11 .HP 12 int hm2_uart_send(char *name, unsigned char data[], rtapi_u8 *num_frames, rtapi_u16 frame_sizes[]) 13 14 .SH DESCRIPTION 15 \fBhm2_pktuart_send\fR writes "num_frames" of data to the PktUART "name" from the 16 buffer "data" with frame sizes preset in "frame_sizes[]" array. 17 "frame_sizes[]" array should not have more than 16 elements as this is the highest 18 number of frames that can be sent out in the so called "burst mode". 19 20 Note that the PktUART MaxFrameSize is 1024 bytes as hard-coded in hostmot2.vhd . 21 22 "name" is a unique string given to each PktUART during hostmot2 setup. The names of 23 the available channels are printed to standard output during the driver loading 24 process and take the form: 25 hm2_<board name>.<board index>.pktuart.<index> For example hm2_5i25.0.pktuart.0 . 26 27 This function sends a variable number of PktUART packets (less or equal 16) from 28 the the specified channel. It should be used inside a realtime HAL component 29 registered with the main hostmot2 driver using the function hm2_pktuart_setup 30 in the setup code. 31 32 .SH RETURN VALUE 33 Returns the number of bytes sent on success and negative error codes on failure. 34 35 "num_frames" which pointer is passed by value is set to the number of successfully 36 datagrams sent out. 37 38 Negative error codes are: 39 .TP 40 .B -1 - low level read/write error 41 .TP 42 .B -EINVAL - any PktUART configuration error per instance 43 .TP 44 .B -HM2_PKTUART_TxSCFIFOError - Tx Send Count FIFO Error 45 .TP 46 Numeric values of HM2_PKTUART_ error codes are defined in src/hal/drivers/mesa-hostmot2/pktuart_errno.h . 47 48 49 .SH SEE ALSO 50 .B man hm2_pktuart_setup, man hm2_pktuart_read 51 .TP 52 See src/hal/drivers/mesa_pktgyro_test.comp for an example usage.