Transportation Systems
MVB-PC/104-API
Application Programmers'
Interface Version 2.10.0
for MVB PC/104 Class 1.x
Documentation
First edition:
Issue:
Document version:
Document number: =! R.0113+0702&EFT040
28th of July 2004
28th of July 2004
1.0
Number of pages:
55
Transmittal, reproduction, dissemination and/or editing of this document as well as utilization of its contents and communication
thereof to others without express authorization are prohibited. Offenders will be held liable for payment of damages. All rights
created by patent grant or registration of a utility model or design patent are reserved.
© Siemens AG 2004. All Rights Reserved.
Transportation Systems
General safety notes
DANGER
means that death or severe injury will occur if the corresponding precau-
tions are not taken.
WARNING
means that death or severe injury may occur if the corresponding pre-
cautions are not taken.
CAUTION
with a warning triangle means that slight injury may occur if the corre-
sponding precautions are not taken.
CAUTION
without a warning triangle means that damage to objects may occur if the
corresponding precautions are not taken.
IMPORTANT
without a warning triangle means that an undesirable event or state of
affairs may occur if the corresponding information is not observed.
Certification
A quality management system to DIN ISO 9001 certified by DQS is used in the manufacture
and sale of the products and systems listed in this documentation. The DQS certificate is
recognized in all EQ Net countries.
Rights
SIBAS® is a registered trademark of Siemens AG. Other designations in this document may
be trademarks and use of these by third parties for their own purposes may violate the
owner’s rights.
The source code of the MVB-PC/104 API will be released to the user as freeware and is
based on an "as is implementation". The user cannot hold Siemens liable for any claim. Sie-
mens cannot guarantee that the API will operate without malfunctions and/or errors. The user
has no claim to support for the use of the API. Any liability resulting from the use of the API is
excluded.
Application Programmers' Interface Version 2.10.0 for MVB PC/104 Class 1.x Documentation
© Siemens AG 2004. All Rights Reserved.
Version 1.0
2/55
Transportation Systems
Export marks
The regulations for transport/export of goods must be observed as soon as techno-
logy/software in the form of objects (documents or data media) is used within the scope of
’personnel deployments’ or hardware is exported or handed over for possible export.
The export marks used in this user manual correspond to the export marks of the software
described. In this case:
AL:
N
5d992B2
ECCN:
Contacts
Please contact the following if you have any questions about this documentation
or the product described here.
Name:
Department:
PO box:
Place:
e-mail ad-
dress:
TCN-Hotline
TS GT E2
3240
91050 Erlangen
Telephone:
Fax:
++49-9131-7-20616
++49-9131-838-20616
tcn-hotline@ts.siemens.de
Application Programmers' Interface Version 2.10.0 for MVB PC/104 Class 1.x Documentation
© Siemens AG 2004. All Rights Reserved.
Version 1.0
3/55
Transportation Systems
Typographical conventions
Font
Courier New
UPPER CASE
Italics
[Key designation]
[Key1]+[Key2]
[]
<>
...
Meaning
The Courier New font identifies program text, user
inputs and text that appear on the screen.
Directory names, file names, names of applications
and acronyms are printed in upper case.
Exception: just like in the source text, names of header
files are specified in lower case.
Words highlighted in italics designate names of vari-
ables, constants, functions, commands, classes and
structures.
Type in italics enclosed in square brackets represents
keys on the keyboard, for example "Press [Ctrl], [Esc]
or [F1]."
Whenever key designations are combined with a "+"
this means that both keys must be pressed together.
In text or syntax examples, square brackets refer to
optional elements.
Numbers in square brackets in the text refer to litera-
ture in the literature references.
In text or syntax examples, pointed brackets refer to a
variable string. You must enter a string in such cases,
leaving out the pointed brackets.
In text or syntax examples, three dots refer to omitted
code.
Application Programmers' Interface Version 2.10.0 for MVB PC/104 Class 1.x Documentation
© Siemens AG 2004. All Rights Reserved.
Version 1.0
4/55
Transportation Systems
Contents
1
Introduction .............................................................................................. 8
1.1 About this Document.......................................................................................... 8
1.2 Cause ................................................................................................................... 8
1.3 Object ................................................................................................................... 9
1.4 Remarks about the NSDB................................................................................... 9
2
API Expansion Levels............................................................................ 10
2.1 Class 1.1............................................................................................................. 10
2.2 Class 1.2............................................................................................................. 10
2.3 Class 1.3............................................................................................................. 10
2.4 The Monitoring Concept for Process Data ..................................................... 11
Sinktime Supervision ........................................................................ 11
2.4.1
Check Variables (also: Validity Bits)................................................. 12
2.4.2
Failure of Host Computer or Bus Interface ....................................... 12
2.4.3
2.4.4
User checksum................................................................................. 12
Application Models ................................................................................ 14
3
3.1 Class 1.1............................................................................................................. 14
3.2 Class 1.2............................................................................................................. 15
3.3 Class 1.3............................................................................................................. 16
3.4 MVB-M ................................................................................................................ 18
4
API Files .................................................................................................. 21
4.1 Overview ............................................................................................................ 21
4.2 Compiler Switches ............................................................................................ 21
4.3 Files Which Do Not Need to be Changed........................................................ 22
File cl1_1.h.................................................................................... 22
File cl1_1.c.................................................................................... 22
File cl1_2u3.h................................................................................ 22
4.3.1
4.3.2
4.3.3
Application Programmers' Interface Version 2.10.0 for MVB PC/104 Class 1.x Documentation
© Siemens AG 2004. All Rights Reserved.
Version 1.0
5/55
Transportation Systems
4.3.4
4.3.5
4.3.6
File cl1_2u3.c................................................................................ 22
File cl1_ret.h................................................................................ 22
File dpr_dep.h................................................................................ 23
4.4 Files Which Need to be Changed..................................................................... 23
File config.h.................................................................................. 23
File host_dep.h ............................................................................. 24
File host_dep.c ............................................................................. 24
4.5 Additional Files ................................................................................................. 24
File history.txt ........................................................................... 24
4.5.1
File b2array.c................................................................................ 24
4.5.2
4.5.3
File b2array.exe ........................................................................... 25
API Functions ......................................................................................... 26
4.4.1
4.4.2
4.4.3
5
5.1.1
5.1.2
5.1.3
5.1.4
5.1.5
5.1.6
5.1.7
5.1.8
5.1.9
5.1 Class 1.1............................................................................................................. 26
Function MVBCInit() ..................................................................... 26
Function MVBCStart() ................................................................... 27
Function MVBCStop() ..................................................................... 28
Function MVBCGetPort()............................................................... 28
Function MVBCPutPort()............................................................... 29
Function MVBCSetDSW() ................................................................. 29
Function MVBCIdle() ..................................................................... 30
Function MVBCGetDeviceAddress() ........................................... 30
Function MVBCRetriggerWd() ...................................................... 30
5.2 Class 1.2 resp. Class 1.3 .................................................................................. 32
Comments about the XHUGE-define.................................................. 32
Function MVBCGetSpecifiedNSDB() ........................................... 32
Function MVBCTransferNSDB() .................................................... 33
Function MVBCConfigure()........................................................... 34
Function MVBCResolvePort() ...................................................... 35
Function MVBCResolveSignal().................................................. 35
Function MVBCGetPortSTTH() ...................................................... 36
Function MVBCGetSignal()........................................................... 36
Function MVBCPutSignal()........................................................... 37
5.2.1
5.2.2
5.2.3
5.2.4
5.2.5
5.2.6
5.2.7
5.2.8
5.2.9
Application Programmers' Interface Version 2.10.0 for MVB PC/104 Class 1.x Documentation
© Siemens AG 2004. All Rights Reserved.
Version 1.0
6/55
Transportation Systems
5.2.10
5.2.11
5.2.12
5.2.13
5.2.14
5.2.15
Function MVBCGetSignalEx() ...................................................... 38
Function MVBCPutSignalEx() ...................................................... 39
Function MVBCReadChecksum() .................................................... 40
Function MVBCWriteChecksum().................................................. 40
Function MVBCGetNSDBVersion()................................................ 41
Function MVBCGetNSDBPortDef()................................................ 41
5.3 MVB-M ................................................................................................................ 43
Function MVBCGetMVBMConfig().................................................. 43
5.3.1
Function ReadMVBMConfig() ........................................................ 43
5.3.2
Function SaveMVBMConfig() ........................................................ 44
5.3.3
Function MVBCIdle() ..................................................................... 44
5.3.4
5.3.5
All other Functions............................................................................ 45
Appendix................................................................................................. 47
6
6.1 The Structure of the Traffic Store.................................................................... 47
6.1.1
Process data in the Traffic Store ...................................................... 47
6.1.1.1 Port Index Table (PIT) ...................................................................... 47
6.1.1.2 Port Control and Status Table (PCS)................................................ 47
6.1.1.3 Data Area.......................................................................................... 48
Abbreviations ......................................................................................... 53
7
8 Glossary.................................................................................................. 54
9
References.............................................................................................. 55
Figures
Fig. 1: Application model for Class 1.1........................................................................................ 15
Fig. 2: Application model for Class 1.2 and Class 1.3................................................................. 17
Fig. 3: Application model for MVB-M slave ................................................................................. 19
Tables
Tab. 1: API Files.......................................................................................................................... 21
Tab. 2: Compiler Switches of the API.......................................................................................... 22
Application Programmers' Interface Version 2.10.0 for MVB PC/104 Class 1.x Documentation
© Siemens AG 2004. All Rights Reserved.
Version 1.0
7/55
Transportation Systems
1
Introduction
About this Document
1.1
For the integration of subsystems in the MVB vehicle bus, the MVB PC/104 interface module
is the preferred component for installation in the control unit to be supplied. The MVB PC/104
has no firmware. The protocol stack for communication must be implemented on the host
CPU. Siemens provides subsystem suppliers with an Application Programmers' Interface
(API) for this purpose. The API supports the process, message and control data on the MVB.
This documentation is intended for developers who use the MVB PC/104 to implement the
functionality of a TCN slave on their hardware platform. It contains the following:
• An overview of the functionality to be implemented
• Details for source code integration
• Details of the API (Application Programmers' Interface)
It is assumed that the user of this manual is familiar with the following:
• Basic principles of TCN communication: see [1]
• Hardware description of the MVB PC/104 bus interface: see [2] and [3]
• Basic principles of the MVBC ASIC (Multifunction Vehicle Bus Controller):
see [4] and [5]
• For MVB-M applications (MVB in Multiple-unit Vehicles) also: see [6]
Cause
This document is valid for modules according to [2] and [3]. Only [2] applies to new applica-
tions. It is valid for API Version 2.10.0 and higher.
1.2
Whereas, in some applications, it is inadequate to use the MVB PC/104 as a Class 1 node
when connecting to the MVB (i.e. maximum 16 words addressable, one communication part-
ner only), in other applications, the full functionality of MVB classes 2 to 4 (message data,
bus administrator, etc.) is not available or is not needed.
In order to provide optimum support for subsystem suppliers, a graded solution based on the
MVB PC/104 interface is available with functionality between Class 1.0 and Class 2.0. These
solutions are designated as Class 1.1, Class 1.2 and Class 1.3.
Furthermore, also a Class 2 base implementation is offered. The Class 2 base implementa-
tion is described more closely in [7]. In this document it will not be described further.
Application Programmers' Interface Version 2.10.0 for MVB PC/104 Class 1.x Documentation
© Siemens AG 2004. All Rights Reserved.
Version 1.0
8/55