background image

TIP810-SW-42 - VxWorks Device Driver

Page 16 of 36

msg_len

Receives the number of message data bytes (0...8).

data

This buffer receives up to 8 data bytes. Data[0] receives message Data 0, Data[1] receives
message Data 1 and so on.

timeout

Specifies the amount of time (in ticks) the caller is willing to wait for execution of read. A timeout
value of WAIT_FOREVER means wait indefinitely; a value of NO_WAIT means do not wait at
all.

status

This parameter receives status information about overrun conditions either in the CAN controller
or intermediate software FIFO.

Value

Description

T810_SUCCESS

No messages lost

T810_FIFO_OVERRUN

One or more messages was overwritten in the
receive queue FIFO. This problem occurs if the
FIFO is too small for the application read interval.

T810_MSGOBJ_OVERRUN

One or more messages were overwritten in the
CAN

controller

message

object

because

the

interrupt latency is too large. Reduce the CAN bit
rate or upgrade the system speed.

EXAMPLE

#include

“tip810.h”

int

fd;

int

num_bytes;

T810_MSG_BUF msg_buf;

msg_buf.timeout = 200; /* wait max. 200 ticks */

num_bytes = read(fd, &msg_buf, sizeof(msg_buf));

if (num_bytes != ERROR)

{

/* process received CAN message */

}

Содержание TIP810-SW-42

Страница 1: ...November 2008 TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC Am Bahnhof 7 25469 Halstenbek Germany www tews com Phone 49 0 4101 4058 0 Fax 49 0 4101 4058 19 e mail info tews com 9190 Double Diamond Park...

Страница 2: ...ccurate and complete However TEWS TECHNOLOGIES GmbH reserves the right to change the product described in this document at any time without notice TEWS TECHNOLOGIES GmbH is not liable for any damage a...

Страница 3: ...2 t810DevCreate 9 4 I O INTERFACE FUNCTIONS 13 4 1 open 13 4 2 read 15 4 3 write 18 4 4 ioctl 21 4 4 1 FIO_T810_SET_BUSTIMING 23 4 4 2 FIO_T810_SET_FILTER 25 4 4 3 FIO_T810_SET_BUSON 27 4 4 4 FIO_T810...

Страница 4: ...clusion and queuing mechanism to prevent simultaneous requests by multiple users from interfering with each other The TIP810 SW 42 device driver supports the following features Transmission and receiv...

Страница 5: ...AC Carrier Driver CARRIER SW 42 is part of this TIP810 SW 42 distribution It is located in directory CARRIER SW 42 on the corresponding distribution media This IPAC Device Driver requires a properly i...

Страница 6: ...n VxWorks project For including the TIP810 SW 42 device driver into a VxWorks project e g Tornado IDE or Workbench follow the steps below Copy the files from the distribution media into a subdirectory...

Страница 7: ...devices 3 1 t810Drv NAME t810Drv installs the TIP810 driver in the I O system SYNOPSIS include tip810 h STATUS tip810Drv void DESCRIPTION This function installs the TIP810 driver in the I O system A c...

Страница 8: ...OK or ERROR If the function fails an error code will be stored in errno ERROR CODES Error codes are only set by system functions The error codes are stored in errno and can be read with the function...

Страница 9: ...setup and prepared for use This function must be called before performing any I O request to this device PARAMETER name This string specifies the name of the device that will be used to identify the d...

Страница 10: ...TIMING timing TIP810_DEVCONFIG ipac Pointer to TIP810 module resource descriptor retrieved by CARRIER Driver ipFindDevice function nMsg This argument defines the size of the device read FIFO for buffe...

Страница 11: ..._TEWS MODEL_TIP810 0 IPAC_INT0_EN IPAC_LEVEL_SENS IPAC_CLK_8MHZ IPAC_MEM_16BIT IPAC_IACK_CYC ipac if result OK Create the device t810A for the first CAN device Device specific parameters must be set u...

Страница 12: ...error occurred during device initialization ERROR CODES The error codes are stored in errno and can be read with the function errnoGet Error code Description S_ioLib_NO_DRIVER The TIP810 driver has n...

Страница 13: ...N bus 4 1 open NAME open open a device or file SYNOPSIS int open const char name int flags int mode DESCRIPTION Before I O can be performed to the TIP810 device a file descriptor must be opened by inv...

Страница 14: ...d ERROR error handling RETURNS A device descriptor number or ERROR If the function fails an error code will be stored in errno ERROR CODES The error code can be read with the function errnoGet The err...

Страница 15: ...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 unsi...

Страница 16: ...t overrun conditions either in the CAN controller or intermediate software FIFO Value Description T810_SUCCESS No messages lost T810_FIFO_OVERRUN One or more messages was overwritten in the receive qu...

Страница 17: ...TIP810 SW 42 VxWorks Device Driver Page 17 of 36 RETURNS ERROR or number of data bytes read 0 8 In the case of ERROR see tip810 h for device specific error codes SEE ALSO ioLib basic I O routine read...

Страница 18: ...e 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_MS...

Страница 19: ...Data 1 and so on timeout Specifies the amount of time in ticks the caller is willing to wait for execution of write A timeout value of WAIT_FOREVER means wait indefinitely a value of NO_WAIT means do...

Страница 20: ...VxWorks Device Driver Page 20 of 36 RETURNS ERROR or number of data bytes written 0 8 In the case of ERROR see tip810 h for device specific error codes retrieved by errnoGet SEE ALSO ioLib basic I O r...

Страница 21: ...request Aborted requests return an ERROR with errno set to S_t810Drv_ABORT No argument is required for this call FIOFLUSH This I O control function flushes the read ring buffer No argument is require...

Страница 22: ...the header file tip810 h must be included in the application RETURNS On success OK is returned In the case of an error a value of ERROR is returned The global variable errno contains the detailed err...

Страница 23: ...s T810_TIMING PT810_TIMING timing_value This parameter holds the new value for the bit timing register 0 Bit 15 8 and for the bit timing register 1 Bit 7 0 Possible transfer rates are between 20 Kbit...

Страница 24: ...result T810_TIMING timing timing timing_value T810_100KBIT timing three_samples 0 result ioctl fd FIO_T810_SET_BUSTIMING int timing if result ERROR handle ioctl error SEE ALSO tip810 h for predefined...

Страница 25: ...e mask registers allow defining certain bit positions to be don t care a 1 at a bit position means don t care A pointer to the caller s parameter buffer T810_FILTER is passed by the parameter pointer...

Страница 26: ...se all bits are don t care filter acceptance_code 0x0 Mark all bit position don t care filter acceptance_mask 0xffffffff Single Filter Mode filter single_filter 1 TRUE result ioctl fd FIO_T810_SET_FIL...

Страница 27: ...begins the busoff recovery sequence and resets the transmit and receive error counters If the CAN controller counts 128 packets of 11 consecutive recessive bits on the CAN bus the Bus Off state is ex...

Страница 28: ...ction the CAN controller is completely removed from the CAN bus and cannot communicate until the control function T810_IOCBUSON is executed The optional argument pointer is not used by this ioctl func...

Страница 29: ...r_max T810_STATUS PT810_STATUS arbitration_lost_capture This parameter receives content of the arbitration lost capture register This register contains information about the bit position of losing arb...

Страница 30: ...age_counter_max Contains the peak value of messages in the RXFIFO This internal counter value will be reset to 0 after reading EXAMPLE include tip810 h int fd int result T810_STATUS can_status result...

Страница 31: ...al functionality is given that means the CAN controller is able to receive messages from other nodes and can transmit message to other nodes if any connected The optional argument pointer can be omitt...

Страница 32: ...optional argument pointer can be omitted for this function This ioctl command will be accepted only in reset mode BUSOFF Enter FIO_T810_SET_BUSOFF first otherwise you will get an error S_t810Drv_NOBUS...

Страница 33: ...d like in normal mode This mode can be used for software driver bit rate detection and hot plugging The optional argument pointer can be omitted for this ioctl function This ioctl command will be acce...

Страница 34: ...he optional argument pointer can be omitted in this ioctl function This ioctl command will be accepted only in reset mode BUSOFF Enter FIO_T810_SET_BUSOFF first otherwise you will get an error S_t810D...

Страница 35: ...A pointer to this variable is passed by the argument arg to the driver This ioctl command will be accepted only in reset mode BUSOFF Enter FIO_T810_SET_BUSOFF first otherwise you will get an error S_t...

Страница 36: ...nvalid message identifier S_t810Dev_ILLLEN 0x08100002 Invalid message length S_t810Dev_BUSOFF 0x08100003 The CAN bus controller has entered the BUS OFF state S_t810Dev_ERROR 0x08100004 At least one of...

Отзывы: