![Tews Technologies TIP810-SW-42 User Manual Download Page 15](http://html1.mh-extra.com/html/tews-technologies/tip810-sw-42/tip810-sw-42_user-manual_1093635015.webp)
TIP810-SW-42 - VxWorks Device Driver
Page 15 of 36
4.2 read()
NAME
read() - read a message from specified TIP810 device
SYNOPSIS
int read (
int
fd,
/* device descriptor from opened TIP810 device
*/
char
*buffer,
/* pointer to a message buffer (typecast T810_MSG_BUF)
*/
size_t
maxbytes
/* always sizeof(T810_MSG_BUF)
*/
)
DESCRIPTION
The read function reads a CAN message from the driver receive queue. A pointer to the callers
message buffer (
T810_MSG_BUF
) and the size of this structure are passed by the parameters
buffer
and
maxbytes
to the device driver.
The
T810_MSG_BUF
structure has the following layout:
typedef struct
{
unsigned long
identifier;
unsigned char
io_flags;
unsigned char
msg_len;
unsigned char
data[8];
unsigned char
status;
int
timeout;
} T810_MSG_BUF, *PT810_MSG_BUF;
identifier
Receives the message identifier of the read CAN message.
io_flags
Receives CAN message attributes as a set of bit flags. The following attribute flags are
possible:
Value
Description
T810_EXTENDED
Set if the received message is an extended
message frame. Reset for standard message
frames.
T810_REMOTE_FRAME
Set
if
the
received
message
is
a
remote
transmission request (RTR) frame.