hm2_pktuart_send

NAME
SYNTAX
DESCRIPTION
RETURN VALUE
SEE ALSO

NAME

hm2_pktuart_send - write data to a Hostmot2 PktUART

SYNTAX

#include <hostmot2-serial.h>

int hm2_uart_send(char *name, unsigned char data[], rtapi_u8 *num_frames, rtapi_u16 frame_sizes[])

DESCRIPTION

hm2_pktuart_send writes "num_frames" of data to the PktUART "name" from the buffer "data" with frame sizes preset in "frame_sizes[]" array. "frame_sizes[]" array should not have more than 16 elements as this is the highest number of frames that can be sent out in the so called "burst mode".

Note that the PktUART MaxFrameSize is 1024 bytes as hard-coded in hostmot2.vhd .

"name" is a unique string given to each PktUART during hostmot2 setup. 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>.pktuart.<index> For example hm2_5i25.0.pktuart.0 .

This function sends a variable number of PktUART packets (less or equal 16) from the the specified channel. It should be used inside a realtime HAL component registered with the main hostmot2 driver using the function hm2_pktuart_setup in the setup code.

RETURN VALUE

Returns the number of bytes sent on success and negative error codes on failure.

"num_frames" which pointer is passed by value is set to the number of successfully datagrams sent out.

Negative error codes are:
-1 - low level read/write error
-EINVAL - any PktUART configuration error per instance
-HM2_PKTUART_TxSCFIFOError - Tx Send Count FIFO Error

Numeric values of HM2_PKTUART_ error codes are defined in
src/hal/drivers/mesa-hostmot2/pktuart_errno.h .

SEE ALSO

man hm2_pktuart_setup, man hm2_pktuart_read
See src/hal/drivers/mesa_pktgyro_test.comp for an example usage.