- Company:  Hilscher GmbH 
- Author:   David Tsaava
- Contact:  DTsaava@Hilscher.com
- Release:  V1.011
- Date:     July 2008


TCP-IP server for the Linux CIF Device Driver, 32- & 64-bit compatible

TABLE OF CONTENTS

1. Introduction
2. requirements
3. Getting started with tcp-ip server
4. The Communication Process
   4.1 Communication details
   4.2 ODM Message Definition
5. Changes
6. Architecture dependance

1. Introduction

As our fieldbus system configurator SyCon/SyCon.net is available only for the WINDOWS OS,
besides the direct message download there're two different ways to get the fieldbus 
configuration or the firmware downloaded to the card on a Linux machine. 

In driver setup & test program drvSU, located in ../test subfolder, we provide 'Download' 
function which can be used for a file download of a corresponding firmware image or a 
configuration .dbm file created with SyCon. The another approach allows SyCon running on
a WINDOWS machine to be connected to the hardware on a Linux machine over tcp/ip, so that
remote per message download of a firmware or configuration database can be performed.    
This is where this server is put into action.  All the online functions of the SyCon - 
firmware and configuration download, diagnoses messages - can be performed over tcp/ip 
connection to a remote Hilscher hardware.

For the purpose of debugging of the server, you can set DEBUG to 'y' in the Makefile and 
recompile it.


2. requirements

In order to be able to communicate with CIF Device Driver over tcp/ip connection you need 
SyCon V2.600 or higher and tcp/ip client running on your Windows machine. The previous
server version V1.000 has been tested with CIF Device Driver for Linux V1.003 and V2.000.

This current V1.001 server version has been tested with the CIF Device Driver for Linux
V2.601 and ODM TCP/IP client V2.021, V2.034.

Please, consult the driver manual in ..\man subfolder for CIF Device Driver details.
 

3. Getting started with tcp/ip server

First you must load CIF Device Driver. After that srvTCPIP can be started in background: 
with './srvTCPIP &' command.


4. The Communication Process

   Messages sent from SyCon over tcp-ip connection are transferred transparent to the CIF 
   Board. In order to initiate communication between SyCon and remote CIF Device Driver, 
   there are some predefined messages. The tcp-ip Server on your Linux machine is working 
   with connection oriented sockets and listens on Port 1099. You can establish only one 
   direct tcp-ip connection to one CIF board at the same time.
   

   4.1 Communication details
       
       SyCon side                           tcp-ip srv (Linux) side
       1. BOARD_SELECT_COMMAND              1. BOARD_SELECT_COMMAND
          request: ask for                     call driver function
          available boards' Info               GetBoardInfoEx() and send 
                                               the info structure to SyCon
       2. BOARD_SELECT_ANSWER               2. SyCon doesn't expect answer
          select one available                 Initialize board selected by
          board and send request               SyCon: call DevInitBoard(N).
          to the server: board N               
          selected
       3,4,                                 3,4,
          pure user data / RCS message         pure user data / RCS message
          send RCS messages to                 Pass messages transparent to
          tcp-ip server                        actual CIF board, send reply 
                                               messages transparent to SyCon
       Each time SyCon selects another board, BOARD_SELECT_ANSWER request is sent.


   4.2 ODM Message Definition

       ODM stands for Online Data Manager.For the first 2 steps described in chapter 4.1 
       there are special messages defined.
       A) request message: -O-D-M-0- (4 Bytes)
                           O, D, M are ASCII characters, 0 is 0x00 hex
	  :: BOARD_SELECT_COMMAND
       B) expected response message from tcp-ip server on remote Linux machine:
                           -O-D-M-1-GENERAL_BOARD_INFO-
                           where GENERAL-BOARD_INFO is a structure defined in 
                           "cifuser.h".
	  :: BOARD_SELECT_COMMAND
       C) request message: -O-D-M-1-Nr-
                           Nr is number of selected board (0x00..0x03 hex)      
          :: BOARD_SELECT_ANSWER

5. Changes

  version name   date     file              description
  
  V1.011         07/08    sourcesink.c      minor bugfixes
  
  V1.010         11/06    sourcesink.c,     now 64-bit & 32-bit compatible
                          ODMTCP.h,         GENERAL_BOARD_INFO changed
			  cif_user.h        BOARD_INFO_32 included
                 
  V1.001	 01/05    sourcesink.c      RCS messages are sent now to the client
		                            considering the real data length in it
                                            i.e. client gets message header lenght + 
                                                             data.len
                                            usBoard is now defined extern
                          main.c            usBoard global definition added



6. Architecture dependance
   
The complete driver package V2.620 can be used on both architectures, 32-bit and 64-bit.
The source code must be always compiled on the target. For tcp-ip connections from 32-bit
SyCon running on MS-Windows system, this tcp-ip server V1.010 will work properly on on both
32-bit or 64-bit Linux machine.   