hm2_uart_read.3hm2
1 \# Author Andy Pugh 2 \# Issued under the terms of the GPL v2 License or any later version 3 .TH hm2_uart_read "3hm2" "2012-05-23" "LinuxCNC Documentation" "Hostmot2" 4 .SH NAME 5 6 hm2_uart_read \- read data from a Hostmot2 UART buffer 7 8 .SH SYNTAX 9 .nf 10 .B #include <hostmot2-serial.h> 11 .HP 12 int hm2_uart_read(char *name, unsigned char *data) 13 14 .SH DESCRIPTION 15 \fBhm2_uart_read\fR read data from the UART "name". 16 "name" is a unique string given to each UART during hostmot2 setup. The names of 17 the available channels are printed to standard output during the driver loading 18 process and take the form: 19 hm2_<board name>.<board index>.uart.<index> For example hm2_5i23.0.uart.0 20 21 This function reads a variable number of bytes from the the specified 22 channel.It should be used inside a realtime HAL component registered with the 23 main hostmot2 driver using the function hm2_uart_set_read_function in the setup 24 code. 25 26 Note that the UART Receieve FIFO is only 16 bytes deep,(the transmit FIFO is 64 27 bytes) and "data" needs to be at least that large or undefined mayhem will ensue. 28 29 .SH RETURN VALUE 30 Returns the number of bytes read on success and \-1 on failure. 31 32 .SH SEE ALSO 33 man hm2_uart_setup, man hm2_uart_send 34 See src/hal/drivers mesa_uart.comp for an example usage.