Home
        User Manual - TEWS TECHNOLOGIES
         Contents
1.     NAME    TDRV011 IOCTRELEASEBUF   Release an allocated message buffer object    DESCRIPTION    This control function releases a previously defined CAN message object  Any CAN bus transactions of  the specified message object will be disabled  After releasing the message object can be defined  again with TDRVO11 IOCSDEFRXBUF and TDRVO11 IOCSDEFRMTBUF control functions     A pointer to the callers message description   TDRVO11 BUF DESC  is passed by the argument argp  to the driver     typedef struct      unsigned long identifier   unsigned char msg_obj_num   unsigned char rx queue num   unsigned char extended   unsigned char msg len     unsigned char data 8      TDRVO11 BUF DESC   PTDRVO11 BUF DESC     msg obj num    Specifies the number of the message object to be released  Valid object numbers are in range  between 1 and 15     All other parameters are not used and should be set to 0     TDRVO1 1 SW 82   Linux Device Driver Page 35 of 39    TEWS E    TECHNOLOGIES       EXAMPLE     include  tdrvOl1l h        int fd    int result   TDRVO11 BUF DESC BufDesc   BufDesc msg obj num   14     result   ioctl fd     if  result  lt  0          handle ioctl error                TDRVO11 IOCTRELEASEBUF         amp BufDesc                     ERRORS   EFAULT Invalid pointer to the parameter buffer  Please  check the argument argp    EINVAL Invalid argument  This error code is returned if the  message object number is out of range    EBADMSG The requested message object is not defined   
2.     unsigned long identifier   unsigned char msg_obj_num   unsigned char rx_queue_num   unsigned char extended   unsigned char msg_len     unsigned char data 8      TDRVO11 BUF DESC   PTDRVO11 BUF DESC     identifier  Specifies the message identifier for the message object to be defined     msg obj num    Specifies the number of the message object to be defined  Valid object numbers are in range  between 1 and 15     rx queue num    Specifies the associated receive queue for this message object  All CAN messages received by  this object are directed to this receive queue  The receive queue numbers are in range between  1 and n  in which n depends on the definition of NUM RX QUEUES  see also 2 6      extended  Set to TRUE for extended CAN messages     msg len  Unused for this control function  Set to O     TDRVO1 1 SW 82   Linux Device Driver Page 29 of 39    TEWS    TECHNOLOGIES  data  Unused for this control function     It is possible to assign more than one receive message object to one receive queue     EXAMPLE          include    tdrv011 h             int fd   int result   TDRVO011 BUF DESC BufDesc                          BufDesc msg_obj_num   15    BufDesc rx_queue_num   1    BufDesc identifier   1234    BufDesc extended   TRUE       Define message object 15 to receive th xtended        message identifier 1234 and store received messages k      in receive queue 1 x    result   ioctl fd  TDRVO11 IOCSDEFRXBUF   amp BufDesc         if  result  lt  0          handle ioctl 
3.    TEWS    The Embedded I O Company TECHNOLOGIES    TDRV011 SW 82    Linux Device Driver    Extended CAN Bus  Version 1 0 x    User Manual    Issue 1 0 5  November 201 1       TEWS TECHNOLOGIES GmbH  Am Bahnhof 7 25469 Halstenbek  Germany  Phone   49  0  4101 40580 Fax   49  0  4101 4058 19  e mail  info tews com www tews com    TDRV011 SW 82  Linux Device Driver  Extended CAN Bus  Supported Modules     TENSE    TECHNOLOGIES    This document contains information  which is  proprietary to TEWS TECHNOLOGIES GmbH  Any  reproduction without written permission is forbidden     TEWS TECHNOLOGIES GmbH has made any  effort to ensure that this manual is accurate and    T complete  However TEWS TECHNOLOGIES GmbH  TPMC901 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 arising out of the application or use of the  device described herein     2007 2011 by TEWS TECHNOLOGIES GmbH  Issue Description Date  1 0 0 First Issue May 3  2007  1 0 1 File list and installation section modified March 4  2008  1 0 2 General revision January 22  2009  1 0 3 Address TEWS LLC removed November 26  2009  1 0 4 General revision September 17  2010  1 0 5 Minor layout corrections November 8  2011    TDRV011 SW 82   Linux Device Driver    Page 2 of 39    Table of Contents    TEWS    TECHNOLOGIES    1 INTRODUGCTION           annua nin trunca n acu ur rk a e ik t clan a cc 4  2  INSTALLATION    inii nba ciini C
4.    extended  Set to TRUE for extended CAN messages     msg len    Contains the number of message data bytes  0   8   This parameter is used only for remote  transmission object updates     TDRVO1 1 SW 82   Linux Device Driver Page 33 of 39    TEWS    TECHNOLOGIES  data    This buffer contains up to 8 data bytes  data 0  contains message data 0  data 1  contains  message data 1 and so on     This parameter is used only for remote transmission object updates     EXAMPLE       include    tdrv011 h                int fd   int result   TDRVO11 BUF DESC BufDesc              Update a receive message object     BufDesc msg_obj_num   14        result   ioctl fd  TDRVO11 IOCSUPDATEBUF   amp BufDesc       if  result  lt  0      handle ioctl error            Update a remote message object          BufDesc msg_obj_num   10   BufDesc msg_len   1   BufDesc data 0    124     result   ioctl fd  TDRVO11 IOCSUPDATEBUF   amp BufDesc         if  result  lt  0          handle ioctl error       ERRORS  EFAULT Invalid pointer to the parameter buffer  Please  check the argument argp   EINVAL Invalid argument  This error code is returned if    either the message object number is out of range or  the requested message object is not defined     EMSGSIZE Invalid message size  msg len must be in range  between 0 and 8     SEE ALSO    Intel 82527 Architectural Overview   4 18 82527 Message Objects    TDRVO1 1 SW 82   Linux Device Driver Page 34 of 39    TEWS    TECHNOLOGIES    3 3 13 TDRV011 IOCTRELEASEBUF
5.   Received CAN messages will be stored in receive queues  Each receive queue contains a FIFO and a  separate task wait queue  The number of receive queues and the depth of the FIFO can be adapted  by changing the following symbols in tdrv011def h     NUM RX QUEUES Defines the number of receive queues for each device  default   3   Valid  numbers are in range between 1 and 15     RX FIFO SIZE Defines the depth of the message FIFO inside each receive queue   default 2 100   Valid numbers are in range between 1 and MAXINT     TDRVO1 1 SW 82   Linux Device Driver Page 7 of 39    TEWS    TECHNOLOGIES    3 Device Input Output Functions    This chapter describes the interface to the device driver I O system used for communication over the  CAN Bus     3 1 open    NAME    open   open a file descriptor    SYNOPSIS     include  lt fcntl h gt     int open  const char  filename  int flags     DESCRIPTION   The open function creates and returns a new file descriptor for the file named by filename  The flags  argument controls how the file is to be opened  This is a bit mask  you create the value by the bitwise  OR of the appropriate parameters  using the   operator in C   See also the GNU C Library  documentation for more information about the open function and open flags     EXAMPLE    int fd   fd   open   dev tdrv011 0   O_RDWR    if  fd     1             handle error condition       RETURNS    The normal return value from open is a non negative integer file descriptor  In the case of a
6.   dev tdrv011_7  Car  TPMC316  0  stat  0x07 ctrl  0x49  RxQ1 0 0      RxQ2 0 0   RxQ3 0 0     dev tdrv011_8  Car  TPMC316  1  stat  0x07 ctrl  0x49  RxQ1 0 0      RxQ2 0 0   RxQ3 0 0                                                                         cat  proc devices  Character devices   1 mem  4  dev vc 0  4 tty  180 usb  226 drm  254 tdrvOlldrv       TDRVO1 1 SW 82   Linux Device Driver Page 38 of 39    TEWS E    TECHNOLOGIES         cat  proc interrupts                                                 CPUO CPUI  0  5860733 5901379  IO APIC edg timer  1  2099 1872 IO APIC edge 18042  2  0 0 XT PIC cascade  8  0 1 IO APIC edge rtc  9s 2 0 IO APIC level acpi  12  50793 50084 IO APIC edge i8042  14  155677 148926  IO APIC edg ided  169 712307 709746 IO APIC level radeon PCI 1 0 0  TDRVO11  177 0 2 IO APIC level uhci_hcd  AMD AMD8111  TDRVO11  185 29775 31 IO APIC level uhci_hcd  ethO0  193 0 1 IO APIC level libata  ehci_hcd       TDRVO11  NMI 0 0  LOC 11763048 11763049  ERR 0  IS  0  f lspci  v     TPMC816 XX     02 07 0 Network controller  PLX Technology  Inc  PCI       IOBus Bridge  rev  0a   Subsystem  TEWS Datentechnik GmBH  Unknown device 0330  Flags  medium devsel  IRQ 193  Memory at ff5fe000  32 bit  non prefetchable   I O ports at a400  size 128   Memory at ff5fd400  32 bit  non prefetchable   size 256      TPMC901 XX     02 08 0 Network controller  PLX Technology  Inc  PCI       IOBus Bridge  rev  01   Subsystem  TEWS Datentechnik GmBH  Unknown device 0385  Flags
7.   medium devsel  IRQ 177  Memory at ff5fe400  32 bit  non prefetchable   I O ports at a800  size 128   Memory at ff5fd800  32 bit  non prefetchable   size 2K   I O ports at a480  size 4      TPMC316 XX     02 09 0 Network controller  TEWS Datentechnik GmBH  Unknown device 013c   rev 0a   Subsystem  TEWS Datentechnik GmBH  Unknown device 000a  Flags  medium devsel  IRQ 169  Memory at ff5fec00  32 bit  non prefetchable   I O ports at a880  size 128   Memory at ff5fe800  32 bit  non prefetchable   size 512           TDRV011 SW 82   Linux Device Driver    Page 39 of 39    
8.  3 ioctl    NAME    ioctl     device control functions    SYNOPSIS     include  lt sys ioctl h gt     int ioctl int filedes  int request    void  argp      DESCRIPTION    The ioctl function sends a control code directly to a device  specified by filedes  causing the  corresponding device to perform the requested operation     The argument request specifies the control code for the operation  The optional argument argp  depends on the selected request and is described for each request in detail later in this chapter     The following ioctl codes are defined in tarvO1 1 h     Function Description   TDRV011 IOCXREAD Receive a CAN message   TDRV011 IOCSWRITE Send a CAN message  TDRV011_IOCSBITTIMING Setup new bit timing   TDRV011_IOCSSETFILTER Setup acceptance filter masks  TDRV011_IOCGGETFILTER Get the current acceptance filter masks  TDRV011_IOCBUSON Enter the bus on state   TDRV011_lIOCBUSOFF Enter the bus off state   TDRV011_IOCFLUSH Flush one or all receive queues  TDRV011_IOCGCANSTATUS Returns the contents of the CAN controller status register  TDRV011 IOCSDEFRXBUF Define a receive buffer message object   TDRV011 IOCSDEFRMTBUF Define a remote transmit buffer message object  TDRV011 IOCSUPDATEBUF Update a remote or receive buffer message object  TDRV011 IOCTRELEASEBUF Release an allocated message buffer object    See behind for more detailed information on each control code     To use these TDRV011 specific control codes the header file tdrv011 h must be included in the    a
9.  EBUSY The message object is currently busy transmitting  data                 TDRV011 SW 82   Linux Device Driver    Page 36 of 39       TEWS    TECHNOLOGIES    4 Diagnostic    If the TDRVO11 driver does not work properly it is helpful to get some status information from the  driver respective kernel     To get debug output from the driver enable the following symbols in  tdrvO11 c  by replacing     undef     with     define    and reinstall the driver           define DEBUG TDRVO11  define DEBUG TDRVO11 INTR                            The Linux  proc file system provides additional information about kernel  resources  drivers  devices  and so on  The following screen dumps display information of a correct running TDRVO11 driver  see  also the proc man pages                  tail  f  var log messages    before modprobing the TDRV011 driver                                                          ay 3 11 10 06 linuxsmp2 kernel  TEWS TECHNOLOGIES   TDRV011 6 4 2 and 1  Channel Extended CAN Bus   version 1 0 x  yyyy mm dd    ay 3 11 10 06 linuxsmp2 kernel  TDRVO11  Probe new device   vendor 0x10B5  device 0x9050  type 816    ay 3 11 10 06 linuxsmp2 kernel  TDRVO11  1x 182527 CAN controller   ay 3 11 10 06 linuxsmp2 kernel    ay 3 11 10 06 linuxsmp2 kernel  TDRVO11  Add tdrv011 node into the list  of kown major devices   ay 3 11 10 06 linuxsmp2 kernel  TDRVO11  Probe new device   vendor 0x10B5  device 0x9050  type 901    ay 3 11 10 06 linuxsmp2 kernel  TDRVO11  6x 182527 CAN con
10.  EXAMPLE     include    tdrv011 h     int fd     ssize t NumBytes   TDRV0O11 MSG BUF MsgBuf                       sgBuf identifier   1234   sgBuf timeout   200   sgBuf extended   TRUE   sgBuf msg_len   2   sgBuf data 0    0xaa   sgBuf data 1    0x55   NumBytes   ioctl fd  TDRV011 IOCSWRITE   amp MsgBuf       if  NumBytes  gt  0          CAN message successfully transmitted          TDRV011 SW 82   Linux Device Driver Page 17 of 39    RETURNS    TEWS    TECHNOLOGIES    On success this function returns the size of structure TDRVO11 MSG BUF  In case of an error  a  value of    1 is returned by ioctl    The global variable errno contains the detailed error code     ERRORS  EINVAL    EFAULT  ECONNREFUSED    EAGAIN    ETIME    EINTR    TDRV011 SW 82   Linux Device Driver    Invalid argument  This error code is returned if the  size of the message buffer is too small     Invalid pointer to the message buffer     The controller is in bus off state and unable to  transmit messages     Resource temporarily unavailable  the call might  work if you try again later  This error occurs only if  the device is opened with the flag O NONBLOCK  set     The allowed time to finish the write request has  elapsed  This occurs if currently no message object  is available or if the CAN bus is overloaded and the  priority of the message identifier is too low     Interrupted function call  an asynchronous signal  occurred and prevented completion of the call   When this happens  you should try the call
11.  Extended CAN Messages   Up to 15 receive message queues with user defined size   Variable allocation of receive message objects to receive queues   Separate task queues for each receive queue and transmission buffer message object  Standard bit rates from 20 kbit up to 1 0 Mbit and user defined bit rates   Message acceptance filtering   Definition of receive and remote buffer message objects   Designed as Linux kernel module with dynamically loading   Creates devices with dynamically allocated or fixed major device numbers   DEVFS and SYSFS  UDEV  support for automatic device node creation    VVVVVVVVVV    The TDRV011 SW 82 device driver supports the modules listed below     TPMC316 CAN Bus PMC Conduction Cooled  TPMC816 Two Independent Channels Extended CAN Bus PMC  TPMC901 6 4 2 Channels Extended CAN Bus PMC    In this document all supported modules and devices will be called TDRV011  Specials for a    certain device will be advised        To get more information about the features and use of the supported devices it is recommended to  read the manuals listed below     TPMC316  TPMC816 and TPMC901 Hardware User manual  TPMC316  TPMC816 and TPMC901 Engineering Manual    TDRV011 SW 82   Linux Device Driver Page 4 of 39    TEWS    TECHNOLOGIES    2 Installation    The directory TDRV011 SW 82 on the distribution media contains the following files     TDRVO1 1 SW 82 1 0 5 pdf This manual in PDF format  TDRVO11 SW 82 SRC tar gz GZIP compressed archive with driver source code  Re
12.  again     Page 18 of 39    TEWS    TECHNOLOGIES    3 3 8  TDRV011 IOCSBITTIMING    NAME    TDRV011_IOCSBITTIMING   Setup new bit timing    DESCRIPTION    This ioctl function modifies the bit timing register of the CAN controller to setup a new CAN bus  transfer speed  A pointer to the callers parameter buffer  TDRVO11 BITTIMING  is passed by the  argument argp to the driver     Keep in mind to setup a valid bit timing value before changing into the Bus On state     typedef struct       unsigned short timing_value   unsigned short three_samples     TDRV011_BITTIMING   PTDRV011_BITTIMING     timing_value    This parameter holds the new values for the Bit Timing Register 0  bit 0   7  and for the Bit  Timing Register 1  bit 8   15   Possible transfer rates are between 20 kBit per second and  1 0 MBit per second  The include file tdrv011 h contains predefined transfer rate symbols   TDRVO11 20KBIT     TDRVO11 1 OMBIT      For other transfer rates please follow the instructions of the Intel 82527 Architectural Overview   which is also part of the engineering documentation     three samples  If this parameter is TRUE  1  the CAN bus is sampled three times per bit time instead of one     Use one sample point for faster bit rates and three sample points for slower bit rates to make    the CAN bus more resistant against noise spikes        TDRVO1 1 SW 82   Linux Device Driver Page 19 of 39    TEWS E    TECHNOLOGIES       EXAMPLE     include    tdrv011 h     int fd     int result   TD
13.  number from which the data will be read  Valid receive queue  numbers are in range between 1 and n  in which n depends on the definition of  NUM RX QUEUES  see also 2 6      extended  Receives TRUE for extended CAN messages     TDRVO1 1 SW 82   Linux Device Driver Page 13 of 39    TEWS    TECHNOLOGIES    status    Receives status information about overrun conditions either in the CAN controller or  intermediate software FIFO s     Value Description  TDRV011 SUCCESS No messages lost  TDRVO011 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     TDRV0O11 MSGOBJ OVERRUN One or more messages were overwritten in the  CAN controller message object because the  interrupt latency is too large  Keep in mind Linux  isn   t a real time operating system  Use message  object 15  buffered  to receive this time critical CAN  messages  reduce the CAN bit rate or upgrade the  System speed     TDRVO11 RAW FIFO OVERRUN One or more messages was overwritten in the FIFO  between the interrupt service routine and post   processing in the driver  bottom half      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     EXAMPLE       include    tdrv011 h                int Eas  ssize t NumBytes   TDRV0O11 MSG BUF MsgBuf     MsgBuf rx queue num   1     MsgBuf
14.  result     result   ioctl fd  TDRVO11  IOCBUSOFF      if  result    0        handle ioctl error       ERRORS  EBUSY Device busy  Another concurrent process is writing  to the device at the moment  Try it again later   SEE ALSO    Intel 82527 Architectural Overview   3 2 Software Initialization    TDRVO1 1 SW 82   Linux Device Driver Page 26 of 39    TEWS    TECHNOLOGIES    3 3 8 TDRVO011 IOCFLUSH    NAME    TDRVO011 IOCFLUSH   Flush one or all receive queues    DESCRIPTION    This ioctl function flushes the message FIFO of the specified receive queue s      The optional argument argp passes the receive queue number to the device driver on which the FIFO  is to be flushed  If this parameter is 0 the FIFOs of all receive queues of the device will be flushed   otherwise only the FIFO of the specified receive queue will be flushed     EXAMPLE       include    tdrv011 h                int fd     int result        flush all receive queues             result   ioctl fd  TDRVO11  IOCFLUSH   int 0      if  result  lt  0          handle ioctl error       ERRORS    EINVAL Invalid argument  This error code is returned if the  specified receive queue is out of range     TDRVO1 1 SW 82   Linux Device Driver Page 27 of 39    TEWS    TECHNOLOGIES    3 3 9 TDRV011 IOCGCANSTATUS    NAME    TDRV011 IOCGCANSTATUS   Returns the contents of the CAN status register    DESCRIPTION    This ioctl function returns the current content of the CAN controller status register for diagnostic  purposes     T
15.  timeout   200     NumBytes   ioctl fd  TDRV011 IOCXREAD   amp MsgBuf         if  NumBytes    0        process received CAN message       TDRVO1 1 SW 82   Linux Device Driver Page 14 of 39    RETURNS    TEWS    TECHNOLOGIES    On success this function returns the size of structure TDRVO11 MSG BUF  In case of an error  a  value of    1 is returned  The global variable errno contains the detailed error code     ERRORS  EINVAL  ECHRNG    EFAULT  ECONNREFUSED    EAGAIN    ETIME    EINTR    TDRV011 SW 82   Linux Device Driver    Invalid argument  This error code is returned if the  size of the message buffer is too small     The specified receive queue number is out of  range     Invalid pointer to the message buffer     The controller is in bus off state and no message is  available in the specified receive queue   Note  as long as CAN messages are available in  the receive queue FIFO  bus off conditions were not  reported by a read function  This means you can  read all CAN messages out of the receive queue  FIFO during bus off state without an error result     Resource temporarily unavailable  the call might  work if you try again later  This error occurs only if  the device is opened with the flag O NONBLOCK  set    The allowed time to finish the read request has  elapsed    Interrupted function call  an asynchronous signal  occurred and prevented completion of the call   When this happens  you should try the call again     Page 15 of 39    TEWS    TECHNOLOGIES    3 3 2  TDRVO
16. 011 IOCSWRITE    NAME    TDRV011 IOCSWRITE   Send a CAN message    DESCRIPTION    This ioctl function writes a CAN message to the specified CAN device  A pointer to the caller s  message buffer   TDRVO11 MSG BUF  is passed by the parameter argp to the driver     This ioctl function dynamically allocates a free message object for this transmit operation  The search  begins at message object 1 and ends at message object 14  The first free message object found is  used  If currently no message object is available the write operation is blocked until any message  object becomes free or a timeout occurs     typedef struct      unsigned long identifier   long timeout   unsigned char rx queue num     unsigned char extended   unsigned char status   unsigned char msg len   unsigned char data 8      TDRVO11 MSG BUF   PTDRVO11 MSG BUF     identifier    Contains the message identifier of the CAN message to write     timeout    Specifies the amount of time  in system ticks  the caller is willing to wait for execution of write  A  value of 0 means wait indefinitely     rx queue num  Unused for this control function     extended  Contains TRUE  1  for extended CAN messages     status  Unused for this control function     msg len  Contains the number of message data bytes  0   8      TDRVO1 1 SW 82   Linux Device Driver Page 16 of 39    TEWS E    TECHNOLOGIES       data    This buffer contains up to 8 data bytes  data 0  contains message data 0  data 1  contains  message data 1 and so on    
17. AcceptMasksParam global mask extended   Oxffffff80              Message object 15 identifier bits 0  7 don t care          AcceptMasksParam message 15 mask   Oxfffff800        result   ioctl fd  TDRV011 IOCSSETFILTER   amp AcceptMasksParam               if  result  lt  0          handle ioctl error                   ERRORS  EFAULT Invalid pointer to the parameter buffer  Please  check the argument argp   SEE ALSO    Intel 82527 Architectural Overview   4 9 Acceptance Filtering       TDRVO1 1 SW 82   Linux Device Driver Page 22 of 39    TEWS    TECHNOLOGIES    3 3 5 TDRV011 IOCGGETFILTER    NAME    TDRV011 IOCGGETFILTER   Get the current acceptance filter masks    DESCRIPTION    This ioctl function returns the current acceptance filter masks of the specified CAN Controller     A pointer to the caller s parameter buffer   TDRVO11 ACCEPT MASKS  is passed by the parameter  argp to the driver     typedef struct      unsigned long message_15_mask   unsigned long global_mask_extended     unsigned short global_mask_standard     TDRVO11 ACCEPT MASKS   PTDRV011_ACCEPT_MASKS     message 15 mask    This parameter receives the value for the Message 15 Mask Register  The Message 15 Mask  Register is a local mask for message object 15  This 29 bit identifier mask appears in bit 3   31  of this parameter     global mask extended    This parameter receives the value for the Global Mask Extended Register  The Global Mask   Extended Register applies only to messages using the extended CAN ident
18. R CE n HEX CH pa EUR IE In UE VE CH2Y FL dE Qu GE E CE LEN I CHINE US cS IU FII EQH o LY RUE Ca UE 5  2 1 Build and install the Device Driver                             eeeeeeeeeeeeeeeenne enne nnne nnn nnne nnn nnne 5   2 2 Uninstall the Device Driver                        1 eeeeeeeeeeeeeee esee eeee enne nennen nennen nnn nnmnnn nnmnnn nnmnnn annaa 6   2 3 Install the Device Driver in the running Kernel                                eere nnn 6   2 4 Remove Device Driver from the running Kernel                                    eere 6   2 5 Change Major Device Number                          sssseeseiseeeeeseeeees seen nnne nn nean nhan inna nn nnn sn tR asas ta sess natn Rusa 7   2 6 Receive Queue Configuration                             sseeseieeeeieeeeies esses nennen nn nn ansa nnne nnn nn anat nasi sn mann nn nn nna 7   3    DEVICE INPUT OUTPUT FUNCTIONS iinissna ui gG Rd Ud EE ABE KEI MID EE aEE Cbr RON SA 8  KE Ee AE 8   32 Clit nannan                    10  xad E                                              M 11   3 9 1   TDRVOT1  IOGXREAD 2  sstccccie tote ceedecdects ettet Etat mei Erates etes cea aae aa AE 13   3 9 2  TDRVOT1  IOGSMWHRITE    ii tento eren tenete Ea ena onec ct cera ev zv aai d Pad 16   3 8 8 TDRVO011 IOCSBITTIMING                  sss nnne nene nns nn an sereni 19   3 834  TDRVO011 IOCSSETFILTER             sse entere nsns sn netr en res nnn niea 21   3 85  TDRV011 IOCGGETFILTER             sssssesesesseeeeeee ener nneren nennen sn nrnr inner
19. RVO11 BITTIMING BitTimingParam     BitTimingParam timing value   TDRVO11  100KBIT        E    BitTimingParam three samples   FALSE   result   ioctl fd  TDRVO011 IOCSBITTIMING   amp BitTimingParam          if  result  lt  0        handle ioctl error                   ERRORS  EFAULT Invalid pointer to the parameter buffer  Please  check the argument argp   SEE ALSO    tdrv011 h for predefined bus timing constants    Intel 82527 Architectural Overview   4 13 Bit Timing Overview       TDRVO1 1 SW 82   Linux Device Driver Page 20 of 39    TEWS    TECHNOLOGIES    3 3 4  TDRVO011 IOCSSETFILTER    NAME    TDRVO011 IOCSSETFILTER   Setup acceptance filter masks    DESCRIPTION    This ioctl function modifies the acceptance filter masks of the specified CAN controller device     The acceptance masks allow message objects to receive messages with a larger range of message  identifiers instead of just a single message identifier  A  0  value means  don t care   or accept a  0  or   1  for that bit position  A  1  value means that the incoming bit value  must match  identically to the  corresponding bit in the message identifier     A pointer to the caller s parameter buffer   TDRVO011 ACCEPT MASKS  is passed by the parameter  argp to the driver     typedef struct      unsigned long message_15_mask   unsigned long global_mask_extended     unsigned short global_mask_standard     TDRVO11 ACCEPT MASKS   PTDRV011_ACCEPT_MASKS     message 15 mask    This parameter specifies the value for the Mes
20. ect is already occupied   EMSGSIZE Invalid message size  msg len must be in range  between 0 and 8   SEE ALSO    Intel 82527 Architectural Overview   4 18 82527 Message Objects    TDRVO1 1 SW 82   Linux Device Driver Page 32 of 39    TEWS    TECHNOLOGIES    3 3 12  TDRV011 IOCSUPDATEBUF    NAME    TDRV011 IOCSUPDATEBUF   Update a remote or receive buffer message object    DESCRIPTION    This ioctl function updates a previously defined receive or remote transmission message buffer object     To update a receive message object a remote frame is transmitted over the CAN bus to request new  data from a corresponding remote transmission message object on other nodes     To update a remote transmission object only the message data and message length of the specified  message object is changed  No transmission is initiated by this control function     A pointer to the callers message description   TDRVO11 BUF  DESC  is passed by the argument argp  to the driver     typedef struct      unsigned long identifier   unsigned char msg_obj_num   unsigned char rx queue num   unsigned char extended   unsigned char msg len     unsigned char data 8      TDRVO11 BUF DESC   PTDRVO11 BUF DESC   identifier   Unused for this control function  Set to O     msg obj num    Specifies the number of the message object to be updated  Valid object numbers are in range  between 1 and 14     Keep in mind that message object 15 is available only for receive message objects     rx queue num  Unused  Set to 0  
21. en rns n nnns enne 23   3 8 6  TDRVO011 IOCBUSON                   sessi todas airasia intent etri nnns intres rents 25   3 82 7  TDRVO011 IOCBUSOFF                   essseeeseseseeesesesenne en tnna neient intet estin ss sans aan niae 26   39 9 9  TDRVO11 IOGFLUSE I aiite erorani code ta eite adt eod Rn red an beu c RE nerd aca gen 27   3 8 9 TDRV011 IOCGCANSTATUS               sese ener snnt in terrens nnns nnrnr enne 28   3 3 10 TDRV011 IOCSDEFRXBUF                  esses nennen ener inrer enr sni nennen ns 29   3 3 11 TDRVO011 IOCSDEFRMTBUF                 sse enne nnn et ren nennt nnns tenens 31   3 3 12 TDRV011_IOCSUPDATEBUF                sese nrnr inrer tensis in nnne ns 33   3 3 13 TDRVO011 IOCTRELEASEBUF                  sse nre arnie trenes 35   4  DIAGNODBSTC   eennn neni rh kan iaa uua n uui airo e uic i c n re ki a 37    TDRV011 SW 82   Linux Device Driver    Page 3 of 39    TEWS    TECHNOLOGIES    1 Introduction    The TDRV011 SW 82 Linux device driver allows the operation of the TDRVO11 Extended CAN PMC  devices conforming to the Linux I O system specification  This includes a device independent basic  I O interface with open    close   and ioctl   functions     Special I O operation that do not fit to the standard I O calls will be performed by calling the ioctl    function with a specific function code and an optional function dependent argument     The TDRV011 SW 82 device driver supports the following features     Transmission and reception of Standard and
22. error       ERRORS   EFAULT Invalid pointer to the parameter buffer  Please  check the argument argp    EINVAL Invalid argument  This error code is returned if  either the message object number  or the specified  receive queue is out of range    EADDRINUSE The requested message object is already occupied    SEE ALSO    Intel 82527 Architectural Overview   4 18 82527 Message Objects    TDRVO1 1 SW 82   Linux Device Driver Page 30 of 39    TEWS    TECHNOLOGIES    3 3 11 TDRV011 IOCSDEFRMTBUF    NAME    TDRV011 IOCSDEFRMTBUF   Define a remote transmit buffer message object    DESCRIPTION    This ioctl function defines a remote transmission CAN message buffer object  A remote transmission  object is similar to normal transmission objects with exception that the CAN message is transmitted  only after receiving a remote frame with the same identifier     This type of message object can be used to make process data available for other nodes which can  be polled around the CAN bus without any action of the provider node     The message data remains available for other CAN nodes until this message object is updated with  the control function TDRVO11 IOCSUPDATEBUF or cancelled with TDRVO11 IOCTRELEASEBUF     A pointer to the callers message description  TDRVO11 BUF  DESC  is passed by the argument argp  to the driver     typedef struct      unsigned long identifier   unsigned char msg_obj_num   unsigned char rx queue num   unsigned char extended   unsigned char msg len     unsigned cha
23. he content of the controller status register is received in an unsigned char variable  A pointer to this  variable is passed by the argument argp to the driver     EXAMPLE          include    tdrv011 h             int Edi  int result     unsigned char CanStatus     result   ioctl fd  TDRVO11  IOCGCANSTATUS   amp CanStatus      if  result    0        handle ioctl error       ERRORS  EFAULT Invalid pointer to the unsigned char variable which  receives the contents of the CAN status register   Please check the argument argp   SEE ALSO    Intel 82527 Architectural Overview   4 3 status Register  01H     TDRVO1 1 SW 82   Linux Device Driver Page 28 of 39    TEWS    TECHNOLOGIES    3 3 10 TDRV011 IOCSDEFRXBUF    NAME    TDRV011 IOCSDEFRXBUF   Define a receive buffer message object    DESCRIPTION    This ioctl function defines a CAN message object to receive a single message identifier or a range of  message identifiers  see also Acceptance Mask   All CAN messages received by this message object  are directed to the associated receive queue and can be read with the standard read function  see  also 3 3 1      Before the driver can receive CAN messages it is necessary to define at least one receive message  object  If only one receive message object is defined at all preferably message object 15 should be  used because this message object is buffered     A pointer to the callers message description   TDRVO11 BUF DESC  is passed by the argument argp  to the driver     typedef struct  
24. ifier  This 29 bit  identifier mask appears in bit 3   31 of this parameter     global mask standard    This parameter receives the value for the Global Mask Standard Register  The Global Mask   Standard Register applies only to messages using the standard CAN identifier  The 11 bit  identifier mask appears in bit 5   15 of this parameter     The TDRV011 device driver copies the masks directly from the corresponding registers of the  CAN controller into the parameter buffer  without shifting any bit positions  For more    information see the Intel 82527 Architectural Overview   4 7   4 10       TDRVO1 1 SW 82   Linux Device Driver Page 23 of 39    TEWS E    TECHNOLOGIES       EXAMPLE     include    tdrv011 h       int fd   int result   TDRVO011 ACCEPT MASKS AcceptMasksParam        result   ioctl fd  TDRV011 IOCGGETFILTER   amp AcceptMasksParam               if  result  lt  0          handle ioctl error                   ERRORS  EFAULT Invalid pointer to the parameter buffer  Please  check the argument argp   SEE ALSO    Intel 82527 Architectural Overview   4 9 Acceptance Filtering       TDRVO1 1 SW 82   Linux Device Driver Page 24 of 39    TEWS    TECHNOLOGIES    3 3 6  TDRV011 IOCBUSON    NAME    TDRV011_IOCBUSON   Enter the bus on state    DESCRIPTION    This ioctl function sets the specified CAN controller into the Bus On state     After an abnormal rate of occurrences of errors on the CAN bus or after driver startup  the CAN  controller enters the Bus Off state  This cont
25. lease txt Release information   ChangeLog txt Release history    The GZIP compressed archive TDRV011 SW 82 SRC tar gz contains the following files and  directories     Directory path    tdrvO11      tdrvO11 c Driver source code   tdrvO11def h Driver include file   tdrvO11 h Driver include file for application program  182527 h Driver include file  CAN Controller Spec    Makefile Device driver make file   makenode Script to create device nodes in the file system  include config h Driver independent library header file  include tpxxxhwdep c Hardware dependent library  include tpxxxhwdep h Hardware dependent library header file  include tpmodule c Driver independent library  include tpmodule h Driver independent library header file  example tdrv011exa c Example application   example Makefile Example application make file    In order to perform an installation  extract all files of the archive TDRVO011 SW 82 SRC tar gz to the  desired target directory  The command    tar  xzvf TDRV011 SW 82 SRC tar gz    will extract the files into  the local directory     e Login as root and change to the target directory    e Copy tdrv011 h to  usr include    2 1 Build and install the Device Driver    e Login as root   e Change to the target directory   e To create and install the driver in the module directory  lib modules  lt version gt  enter     make install    e Only after the first build we have to execute depmod to create a new dependency description  for loadable kernel modules  This de
26. n error  a  value of    1 is returned  The global variable errno contains the detailed error code     TDRVO1 1 SW 82   Linux Device Driver Page 8 of 39    TEWS    TECHNOLOGIES    ERRORS    ENODEV The requested minor device does not exist    This is the only error code returned by the driver  other codes may be returned by the I O system  during open  For more information about open error codes  see the GNU C Library description     Low   Level Input Output     SEE ALSO    GNU C Library description     Low Level Input Output    TDRVO1 1 SW 82   Linux Device Driver Page 9 of 39    TEWS    TECHNOLOGIES    3 2 close    NAME    close     close a file descriptor    SYNOPSIS     include  lt unistd h gt     int close  int filedes     DESCRIPTION    The close function closes the file descriptor filedes     EXAMPLE    int fd     if  close fd     0          handle close error conditions       RETURNS    The normal return value from close is 0  In the case of an error  a value of    1 is returned  The global  variable errno contains the detailed error code     ERRORS    ENODEV The requested minor device does not exist    This is the only error code returned by the driver  other codes may be returned by the I O system  during close  For more information about close error codes  see the GNU C Library description     Low   Level Input Output     SEE ALSO    GNU C Library description     Low Level Input Output    TDRVO1 1 SW 82   Linux Device Driver Page 10 of 39    TEWS    TECHNOLOGIES    3
27. on channel assignment see   cat  proc tews tdrvO1 1     2 4 Remove Device Driver from the running Kernel    e Toremove the device driver from the running kernel login as root and execute the following  command       modprobe tdrv011drv  r  If your kernel has enabled a dynamic file system  all  dev tdrv011_x nodes will be automatically  removed from your file system after this     Be sure that the driver isn   t opened by any application program  If opened you will get the  response    tdrv011drv  Device or resource busy  and the driver will still remain in the system    until you close all opened files and execute modprobe  r again        TDRVO1 1 SW 82   Linux Device Driver Page 6 of 39    TEWS 4    TECHNOLOGIES    2 5 Change Major Device Number    The TDRVO11 driver uses dynamic allocation of major device numbers by default  If this isn t suitable  for the application it is possible to define a major number for the driver  If the kernel has enabled devfs  the driver will not use the symbol TDRV011  MAJOR     To change the major number edit the file tdrvO11def h  change the following symbol to appropriate  value and enter make install to create a new driver     TDRV011 MAJOR Valid numbers are in range between 0 and 255  A value of 0 means  dynamic number allocation     Example      define TDRVO11  MAJOR 122    Be sure that the desired major number isn t used by other drivers  Please check  proc devices    to see which numbers are free        2 6 Receive Queue Configuration  
28. pendency file is later used by modprobe to automatically  load dependent kernel modules       depmod  aq    TDRVO1 1 SW 82   Linux Device Driver Page 5 of 39    TEWS    TECHNOLOGIES    2 2 Uninstall the Device Driver    e Login as root  e Change to the target directory    e Toremove the driver from the module directory  lib modules   version   misc enter       make uninstall    e Update kernel module dependency description file      depmod  aq    2 3 Install the Device Driver in the running Kernel    e To load the device driver into the running kernel  login as root and execute the following  commands       modprobe tdrv011drv    e After the first build or if you are using dynamic major device allocation it is necessary to create  new device nodes on the file system  Please execute the script file makenode to do this  If your  kernel has enabled a dynamic device file system  devfs or sysfs with udev  then you have to  skip running the makenode script  Instead of creating device nodes from the script the driver  itself takes creating and destroying of device nodes in its responsibility       sh makenode    On success the device driver will create a minor device for each TDRVO11 CAN Channel found  The  first TDRVO11 CAN Channel can be accessed with device node  dev tdrv011 0  the second with   dev tdrv011_1  the third with  dev tdrv011 2 and so on     The assignment of device nodes to physical TDRVO11 modules depends on the search order of the  PCI bus driver  For more details 
29. pplication        TDRVO1 1 SW 82   Linux Device Driver Page 11 of 39    TEWS    TECHNOLOGIES    RETURNS    On success  zero is returned  In the case of an error  a value of    1 is returned  The global variable  errno contains the detailed error code     ERRORS    EINVAL Invalid argument  This error code is returned if the  requested ioctl function is unknown  Please check  the argument request     Other function dependant error codes will be described for each ioctl code separately  Note  the  TDRVO11 driver always returns standard Linux error codes     SEE ALSO    GNU C Library description     Low Level Input Output  ioctl man pages    TDRVO1 1 SW 82   Linux Device Driver Page 12 of 39    TEWS    TECHNOLOGIES    3 3 1 TDRV011 IOCXREAD    NAME    TDRV011_IOCXREAD   Receive a CAN message    DESCRIPTION    This ioctl function reads a CAN message from the specified receive queue  A pointer to the caller s  message buffer   TDRVO11 MSG BUF  is passed by the parameter argp to the driver     typedef struct      unsigned long identifier   long timeout   unsigned char rx queue num     unsigned char extended   unsigned char status   unsigned char msg len   unsigned char data 8      TDRVO11 MSG BUF   PTDRVO11 MSG BUF     identifier  Receives the message identifier of the read CAN message     timeout    Specifies the amount of time  in system ticks  the caller is willing to wait for execution of read  A  value of 0 means wait indefinitely     rx queue num    Specifies the receive queue
30. r data 8      TDRVO11 BUF DESC   PTDRVO11 BUF DESC     identifier  Specifies the message identifier for the message object to be defined     msg obj num    Specifies the number of the message object to be defined  Valid object numbers are in range  between 1 and 14     Keep in mind that message object 15 is only available for receive message objects     rx queue num  Unused for remote transmission message objects  Set to 0     extended  Set to TRUE for extended CAN messages     msg len  Contains the number of message data bytes  0   8      TDRVO1 1 SW 82   Linux Device Driver Page 31 of 39    TEWS    TECHNOLOGIES  data    This buffer contains up to 8 data bytes  data 0  contains message data 0  data 1  contains  message data 1 and so on     EXAMPLE          include    tdrv011 h             int fd   int result   TDRVO011  BUF DESC BufDesc              BufDesc msg_obj_num   10   BufDesc identifier   777   BufDesc extended   TRUE   BufDesc msg_len   1   BufDesc data 0    123        Define message object 10 to transmit the extended              message identifier 777 after receiving of a remote        frame with the same identifier             result   ioctl fd  TDRVO11 IOCSDEFRMTBUF   amp BufDesc         if  result  lt  0          handle ioctl error       ERRORS  EFAULT Invalid pointer to the parameter buffer  Please  check the argument argp   EINVAL Invalid argument  This error code is returned if the  message object number is out of range   EADDRINUSE The requested message obj
31. rol function resets the init bit in the control register  The  CAN controller 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 exited     The optional argument can be omitted for this ioctl function     Before the driver is able to communicate over the CAN bus after driver startup  this control    function must be executed        EXAMPLE          include    tdrv011 h             int fd     int result   result   ioctl fd  TDRVO11  IOCBUSON      if  result  lt  0          handle ioctl error       SEE ALSO    Intel 82527 Architectural Overview   3 2 Software Initialization    TDRVO1 1 SW 82   Linux Device Driver Page 25 of 39    TEWS    TECHNOLOGIES    3 3 7 TDRV011 IOCBUSOFF    NAME    TDRVO011 IOCBUSOFF   Enter the bus off state    DESCRIPTION    This ioctl function sets the specified CAN controller into the Bus Off state  After a successful execution  of this control function the CAN controller is completely removed from the CAN bus and cannot  communicate until the control function TDRV011_IOCBUSON is executed  It is not possible to set the  device bus off during a write operation of another concurrent process     The optional argument can be omitted for this ioctl function     Execute this control function before the last close to the CAN controller channel     EXAMPLE       include    tdrv011 h                int fd     int
32. sage 15 Mask Register  The Message 15 Mask  Register is a local mask for message object 15  This 29 bit identifier mask appears in bit 3   31  of this parameter  The Message 15 Mask is  ANDed  with the Global Mask  This means that any  bit defined as  don t care  in the Global Mask will automatically be a  don t care  bit for message  15   See also Intel 82527 Architectural Overview      global mask extended    This parameter specifies the value for the Global Mask Extended Register  The Global Mask   Extended Register applies only to messages using the extended CAN identifier  This 29 bit  identifier mask appears in bit 3   31 of this parameter     global mask standard    This parameter specifies the value for the Global Mask Standard Register  The Global Mask   Standard Register applies only to messages using the standard CAN identifier  The 11 bit  identifier mask appears in bit 5   15 of this parameter     The TDRVO011 device driver copies the parameter directly into the corresponding registers of    the CAN controller  without shifting any bit positions  For more information see the Intel 82527  Architectural Overview   4 7   4 10       TDRVO1 1 SW 82   Linux Device Driver Page 21 of 39    TEWS E    TECHNOLOGIES       EXAMPLE     include    tdrv011 h       int fd   int result   TDRVO011 ACCEPT MASKS AcceptMasksParam           Standard identifier bits 0  3 don t care     AcceptMasksParam global mask standard   0xfe00           extended identifier bits 0  3 don t care     
33. troller   ay 3 11 10 06 linuxsmp2 kernel    ay 3 11 10 06 linuxsmp2 kernel  TDRVO11  Add tdrv011 node into the list  of kown major devices   ay 3 11 10 06 linuxsmp2 kernel  TDRVO11  Probe new device   vendor 0x1498  device 0x013C  type 316    ay 3 11 10 06 linuxsmp2 kernel  TDRVO11  2x 182527 CAN controller   ay 3 11 10 06 linuxsmp2 kernel    ay 3 11 10 06 linuxsmp2 kernel  TDRVO11  Add tdrv011 node into the list    of kown major devices       after modprobing the driver       TDRVO1 1 SW 82   Linux Device Driver Page 37 of 39    TEWS E    TECHNOLOGIES         cat  proc tews tdrv011      after driver start  reset condition      EWS TECHNOLOGIES   TDRV011 6 4 2 and 1 Channel Extended CAN Bus   version  1 0 x  yyyy mm dd    Supported modules  TPMC316  TPMC816  TPMC901                         Registered Intel 82527 CAN controller channels    dev tdrv011_0  Car  TPMC816  0  stat  0x07 ctrl  0x49  RxQ1 0 0      RxQ2 0 0   RxQ3 0 0     dev tdrv011 1  Car  TPMC901  0  stat  0x07 ctrl  0x49  RxQ1 0 0      RxQ2 0 0   RxQ3 0 0     dev tdrv011_2  Car  TPMC901  1  stat  0x07 ctrl  0x49  RxQ1 0 0      RxQ2 0 0   RxQ3 0 0     dev tdrv011_3  Car  TPMC901  2  stat  0x07 ctrl  0x49  RxQ1 0 0      RxQ2 0 0   RxQ3 0 0     dev tdrv011 4  Car  TPMC901  3  stat  0x07 ctrl  0x49  RxQ1 0 0      RxQ2 0 0   RxQ3 0 0     dev tdrv011 5  Car  TPMC901  4  stat  0x07 ctrl  0x49  RxQ1 0 0      RxQ2 0 0   RxQ3 0 0     dev tdrv011 6  Car  TPMC901  5  stat  0x07 ctrl  0x49  RxQ1 0 0      RxQ2 0 0   RxQ3 0 0   
    
Download Pdf Manuals
 
 
    
Related Search
    
Related Contents
MANUAL DE UTILIZAÇÃO DO LOGOTIPO  Installation and Operating Instructions  Mathias Malzieu sur les traces d`Orphée : Maintenant qu`il fait tout le  Important Message to Consumers NOTE! iPod nano    Manual de instrucciones  #05135 RP-SR634 USER`S MANUAL  Kingston Brass HDR314328 Installation Guide  Magnadyne VCS-6 User's Manual    Copyright © All rights reserved. 
   Failed to retrieve file