1、Road vehicles Local Interconnect Network (LIN) Part 5: Application programmers interface (API) PD ISO/TR 17987-5:2016 BSI Standards Publication WB11885_BSI_StandardCovs_2013_AW.indd 1 15/05/2013 15:06National foreword This Published Document is the UK implementation of ISO/TR 17987-5:2016. The UK pa
2、rticipation in its preparation was entrusted to Technical Committee AUE/16, Data Communication (Road Vehicles). A list of organizations represented on this committee can be obtained on request to its secretary. This publication does not purport to include all the necessary provisions of a contract.
3、Users are responsible for its correct application. The British Standards Institution 2016. Published by BSI Standards Limited 2016 ISBN 978 0 580 90705 0 ICS 43.040.15 Compliance with a British Standard cannot confer immunity from legal obligations. This Published Document was published under the au
4、thority of the Standards Policy and Strategy Committee on 30 November 2016. Amendments/corrigenda issued since publication Date Text affected PUBLISHED DOCUMENT PD ISO/TR 17987-5:2016 ISO 2016 Road vehicles Local Interconnect Network (LIN) Part 5: Application programmers interface (API) Vhicules rou
5、tiers Rseau Internet local (LIN) Partie 5: Interface du programmeur dapplication (API) TECHNICAL REPORT ISO/TR 17987-5 Reference number ISO/TR 17987-5:2016(E) First edition 2016-11-15 PD ISO/TR 17987-5:2016 ISO/TR 17987-5:2016(E)ii ISO 2016 All rights reserved COPYRIGHT PROTECTED DOCUMENT ISO 2016,
6、Published in Switzerland All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Pe
7、rmission can be requested from either ISO at the address below or ISOs member body in the country of the requester. ISO copyright office Ch. de Blandonnet 8 CP 401 CH-1214 Vernier, Geneva, Switzerland Tel. +41 22 749 01 11 Fax +41 22 749 09 47 copyrightiso.org www.iso.org PD ISO/TR 17987-5:2016 ISO/
8、TR 17987-5:2016(E)Foreword iv Introduction v 1 Scope . 1 2 Normative references 1 3 T erms, definitions and abbr e viat ed t erms 1 3.1 Terms and definitions . 1 3.2 Symbols . 1 3.3 Abbreviated terms . 1 4 API definitions 1 4.1 LIN cluster generation 1 4.2 Concept of operations . 2 4.2.1 General 2 4
9、.2.2 LIN core API . 2 4.2.3 LIN node configuration and identification API 2 4.2.4 LIN transport layer API 2 4.3 API conventions 3 4.3.1 General 3 4.3.2 Data types 5 4.3.3 Driver and cluster management . 5 4.3.4 Signal interaction. 5 4.3.5 Notification . 7 4.3.6 Schedule management 9 4.3.7 Interface
10、management .10 4.3.8 User provided call outs 16 4.4 Node configuration and identification.17 4.4.1 Overview 17 4.4.2 Node configuration .17 4.4.3 Identification 22 4.5 Transport layer 23 4.5.1 Overview 23 4.5.2 Raw- and messaged-based API .23 4.5.3 Initialization 24 4.5.4 Raw API .24 4.5.5 Overview
11、24 4.5.6 Messaged-based API 26 4.6 Examples .30 4.6.1 Overview 30 4.6.2 Master node example 30 4.6.3 Slave node example 32 Bibliogr aph y .34 ISO 2016 All rights reserved iii Contents Page PD ISO/TR 17987-5:2016 ISO/TR 17987-5:2016(E) Foreword ISO (the International Organization for Standardization)
12、 is a worldwide federation of national standards bodies (ISO member bodies). The work of preparing International Standards is normally carried out through ISO technical committees. Each member body interested in a subject for which a technical committee has been established has the right to be repre
13、sented on that committee. International organizations, governmental and non-governmental, in liaison with ISO, also take part in the work. ISO collaborates closely with the International Electrotechnical Commission (IEC) on all matters of electrotechnical standardization. The procedures used to deve
14、lop this document and those intended for its further maintenance are described in the ISO/IEC Directives, Part 1. In particular the different approval criteria needed for the different types of ISO documents should be noted. This document was drafted in accordance with the editorial rules of the ISO
15、/IEC Directives, Part 2 (see www.iso.org/directives). Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO shall not be held responsible for identifying any or all such patent rights. Details of any patent rights identified during
16、the development of the document will be in the Introduction and/or on the ISO list of patent declarations received (see www.iso.org/patents). Any trade name used in this document is information given for the convenience of users and does not constitute an endorsement. For an explanation on the meani
17、ng of ISO specific terms and expressions related to conformit y assessment, as well as information about ISOs adherence to the World Trade Organization (WTO) principles in the Technical Barriers to Trade (TBT) see the following URL: www.iso.org/iso/foreword.html. The committee responsible for this d
18、ocument is ISO/TC 22, Road vehicles, Subcommittee SC 31, Data communication. A list of all parts in the ISO 17987 series can be found on the ISO website.iv ISO 2016 All rights reserved PD ISO/TR 17987-5:2016 ISO/TR 17987-5:2016(E) Introduction ISO 17987 (all parts) specifies the use cases, the commu
19、nication protocol and physical layer requirements of an in-vehicle communication network called Local Interconnect Network (LIN). The LIN protocol as proposed is an automotive focused low speed Universal Asynchronous Receiver Transmitter (UART) based network. Some of the key characteristics of the L
20、IN protocol are signal- based communication, schedule table-based frame transfer, master/slave communication with error detection, node configuration and diagnostic service communication. The LIN protocol is for low cost automotive control applications, for example, door module and air condition sys
21、tems. It serves as a communication infrastructure for low-speed control applications in vehicles by providing: signal-based communication to exchange information between applications in different nodes; bit rate support from 1 kbit/s to 20 kbit/s; deterministic schedule table-based frame communicati
22、on; network management that wakes up and puts the LIN cluster into sleep mode in a controlled manner; status management that provides error handling and error signalling; transport layer that allows large amount of data to be transmitted (such as diagnostic services); specification of how to handle
23、diagnostic services; electrical physical layer specifications; node description language describing properties of slave nodes; network description file describing behaviour of communication; application programmers interface; ISO 17987 (all parts) is based on the open systems interconnection (OSI) B
24、asic Reference Model as specified in ISO/IEC 7498-1 which structures communication systems into seven layers. The OSI model structures data communication into seven layers called (top down) application layer (layer 7), presentation layer, session layer, transport layer, network layer, data link laye
25、r and physical layer (layer 1). A subset of these layers is used in ISO 17987 (all parts). ISO 17987 (all parts) distinguishes between the services provided by a layer to the layer above it and the protocol used by the layer to send a message between the peer entities of that layer. The reason for t
26、his distinction is to make the services, especially the application layer services and the transport layer services, reusable also for other types of networks than LIN. In this way, the protocol is hidden from the service user and it is possible to change the protocol if special system requirements
27、demand it. ISO 17987 (all parts) provides all documents and references required to support the implementation of the requirements related to. ISO 17987-1: This part provides an overview of the ISO 17987 (all parts) and structure along with the use case definitions and a common set of resources (defi
28、nitions, references) for use by all subsequent parts. ISO 17987-2: This part specifies the requirements related to the transport protocol and the network layer requirements to transport the PDU of a message between LIN nodes. ISO 17987-3: This part specifies the requirements for implementations of t
29、he LIN protocol on the logical level of abstraction. Hardware-related properties are hidden in the defined constraints. ISO 2016 All rights reserved v PD ISO/TR 17987-5:2016 ISO/TR 17987-5:2016(E) ISO 17987-4: This part specifies the requirements for implementations of active hardware components whi
30、ch are necessary to interconnect the protocol implementation. ISO/TR 17987-5: This part specifies the LIN application programmers interface (API) and the node configuration and identification services. The node configuration and identification services are specified in the API and define how a slave
31、 node is configured and how a slave node uses the identification service. ISO 17987-6: This part specifies tests to check the conformance of the LIN protocol implementation according to ISO 17987-2 and ISO 17987-3. This comprises tests for the data link layer, the network layer and the transport lay
32、er. ISO 17987-7: This part specifies tests to check the conformance of the LIN electrical physical layer implementation (logical level of abstraction) according to ISO 17987-4. The LIN API is a network software layer that hides the details of a LIN network configuration (e.g. how signals are mapped
33、into certain frames) for a user making an application program for an arbitrary ECU. The user is provided an API, which is focused on the signals transported on the LIN network. A tool takes care of the step from network configuration to program code. This provides the user with configuration flexibi
34、lity. The LIN API is only one possible API existing today beside others like defined for LIN master nodes in the AUTOSAR standard. Therefore, the LIN API is published as a Technical Report and all definitions given here are informative only.vi ISO 2016 All rights reserved PD ISO/TR 17987-5:2016 TECH
35、NICAL REPORT ISO/TR 17987-5:2016(E) Road vehicles Local Interconnect Network (LIN) Part 5: Application programmers interface (API) 1 Scope This document has been established in order to define the LIN application programmers interface (API). 2 Normative references There are no normative references i
36、n this document. 3 T erms, d efinitions and abbr e viat ed t erms 3.1 T erms and definiti ons For the purposes of this document, the terms and definitions given in ISO 17987-2 and ISO 17987-3 apply. ISO and IEC maintain terminological databases for use in standardization at the following addresses:
37、IEC Electropedia: available at http:/ /www.electropedia.org/ ISO Online browsing platform: available at http:/ /www.iso.org/obp 3.2 S ymbols | logical OR binary operation 3.3 A bbr e viat ed t erms API application programmers interface ms millisecond OSI open systems interconnection PDU protocol dat
38、a unit RX Rx pin of the transceiver UART universal asynchronous receiver transmitter 4 API definitions 4.1 LIN cluster generation The LIN Description file (LDF; see ISO 17987-2) is parsed by a tool and generates a configuration for the LIN device driver. The node capability language specification (N
39、CF) is normally not used in this ISO 2016 All rights reserved 1 PD ISO/TR 17987-5:2016 ISO/TR 17987-5:2016(E) process since its intention is to describe a hardware slave node, and therefore, does not need the API. See ISO 17987-2 for a description of the workflow and the roles of the LDF and NCF. 4.
40、2 Concept of operations 4.2.1 General The API is split in three areas LIN core API, LIN node configuration and identification API, and LIN transport layer API (optional). 4.2.2 LIN core API The LIN core API handles initialization, processing and a signal based interaction between the application and
41、 the LIN core. This implies that the application does not have to bother with frames and transmission of frames. Notification exists to detect transfer of a specific frame if this is necessary, see 4.3.5. API calls to control the LIN core also exist. Two versions exist of most of the API calls stati
42、c calls embed the name of the signal or interface in the name of the call, and dynamic calls provide the signal or interface as a parameter. NOTE The named objects (signals, schedules) defined in the LDF extends their names with the channel postfix name (see channel postfix name definition in ISO 17
43、987-2). 4.2.3 LIN node c onfigur ation and identification A PI The LIN node configuration and identification API is service-based (request/response), i.e. the application in the master node calls an API routine that transmits a request to the specified slave node and awaits a response. The slave nod
44、e device driver automatically handles the service. The behaviour of the LIN node configuration and identification API is covered in the node configuration and identification (see ISO 17987-3). 4.2.4 LIN tr ansport la y er API The LIN transport layer is message based. Its intended use is to work as a
45、 transport layer for messages to a diagnostic message parser outside of the LIN device driver. Two exclusively alternative APIs exist, one raw that allows the application to control the contents of every frame sent and one messaged-based that performs the full transport layer function. The behaviour
46、 of the LIN transport layer API is defined in ISO 17987-2.2 ISO 2016 All rights reserved PD ISO/TR 17987-5:2016 ISO/TR 17987-5:2016(E) 4.3 API conventions 4.3.1 General The LIN core API has a set of functions all based on the idea to give the API a separate name space, in order to minimize the risk
47、of conflicts with existing software. All functions and types have the prefix “l_” (lowercase “L” followed by an “underscore”). T a b l e 1 A P I f u n c t i o n s o v e r v i e w Function Description DRIVER AND CLUSTER MANAGEMENT l_sys_init Performs the initialization of the LIN core. SIGNAL INTERAC
48、TION scalar signal read Reads and returns the current value of the signal. scalar signal write Reads and returns the current value of the signal. byte array read Reads and returns the current values of the selected bytes in the signal. byte array write Sets the current value of the selected bytes in
49、 the signal specified by the name sss to the value specified. NOTIFICATION l_flg_tst Returns a C boolean indicating the current state of the flag specified by the name of the static API call, i.e. returns zero if the flag is cleared, non-zero otherwise. l_flg_clr Sets the current value of the flag specified by the name of the static API call to zero. SCHEDULE MANAGEMENT l_sch_tick Function provides a time base for scheduling. l_sch_set Sets up the next schedule. INTERFACE MANAGEMENT