Home

COMMSTACK 1.8

image

Contents

1. fra et p o d Testo i Debs hl Gg Be o 1 2176 Applivaliors A TestH ode T estude 1_ Fral Rez 120 1 aaa E TeetNinde Testne Buller Assignment Errors 0 Warnings U Infos U 4 Lommunicalon I ask Assignment Eros U Warrmngs U Inlos 4 Advanced Conliguration TT NH COMMSTACK LOSCOM OSCORMS TOMMST ACE Configuration amp Surfer Ascignman CC Reaisters Auto Code Generation Canmunization controller rsgster zonFiguraton Walicak Help Coce Cwtpuk 2ach ererate All Clore 2 Figure 7 Driver Configuration Window 5 2 3 Selector Panel The popup menus ECU MCU and CC are used to select a distinct communication controller in order to display and to manipulate its configuration data 5 2 4 Communication Assignment Grid The Communication Assignment Grid seen in Figure 7 reflects the initial configuration corresponding to the assumed setup introduced in section 5 1 and from which the COMMSTACK configuration generation starts off The Communication Assignment Grid shows information on the exchanged frames among the ECUs of the cluster from the point of view of TestNode1Controller TestNode1Controller is the name for the FlexRay controller hosted by TestNode1 ECU The grid shows all message frames sent and received by the controller Each line of the
2. 3 2 Specific Datatypes Specific datatypes are defined by the COMMSTACK and mentioned to be reserved for COMMSTACK specific usage only The datatypes described in this chapter are single integral datatypes 3 2 1 TDDLL_BooleanType This datatype is used for variables that have to differ between two states The states that must be used for TDDLL_BooleanType are TDDLL_ TRUE and TDDLL_FALSE or expressions as provided by the compiler 3 2 2 TDDLL_ReturnType This datatype is an enumerator used as generic function return type Please consult the API documentation of a specific function for the exact meaning of the return code in the context of the specific function call Supported values for the datatype TDDLL_ReturnType and the generic meanings of these values are described in the following table Value Description TDDLL E OK Function exited successfully TDDLL_E_BAD_CONFIG Some configuration of the FlexRay controller is invalid or bad TDDLL E ACCESS Error accessing the FlexRay controller TDDLL_E OVERFLOW Some date structure or resource is busy TDDLL_E UNDERFLOW Some data structure or resource is empty TDDLL_E INVALID IDX Some argument given is invalid TDDLL E OFFLINE The communication controller is in state offline function execution not permitted TDDLL_E NOT SYNC The communication controller is not synchronized to the cluster function execution not permitted TDDLL TX PENDING The transmission request is pending
3. Additionall subdirectories for FlexRay CC specific implementations might be present named by the COMMSTACK FlexRay CC name in uppercase letters e g ERAY10 MFR4200 MFR4300 When building the COMMSTACK ensure that you pass all include directories and their respective subdirectories include include arch include MFR4200 include ERA Y10 include MFR4300 mentioned before to the compilers include path Also the source path containing COMMSTACK private header files src src ERAY10 src MFR4200 src MFR4300 should be added to the compilers include path Below the COMMSTACK source code product file structure as delivered for an example target architecture called dcsnodearm generic is shown dcesCstFr COMMSTACK root directory Ldoc COMMSTACK documentation MAL include Lgeneric FCAL include FERAY10 FMEFR4200 LMFR4300 include arch dcsnodearm generic Bre Cfg Larch dcsnodearm generic ERAY10 MFR4200 LMFR4300 MAL macro library main header files MAL macro library CPU dependent implementations FCAL macro library main header files FCAL macro library ERAY access implementations FCAL macro library MFR4200 access implementations FCAL macro library MFR4300 access implementations COMMSTACK interface header files COMMSTACK configuration files for example architecture COMMSTACK CC independent source code COMMSTACK configuration files for example architecture COMMSTACK ERAY implementati
4. which consumes less runtime by saving one function call overhead 3 7 4 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on nFrameDscRefIDX Unique ID that identifies the frame to be checked for transmission Copyright DECOMSYS 2006 32 DECOMSYS F N API Documentation 3 7 4 4 Return Values Value Description The frame has been transmitted TDDLL E TX PENDING The frame is still pending for transmission TDDLL_E_INVALID_IDX The given input parameter or some basic configuration is invalid TDDLL_E OFFLINE The COMMSTACK FlexRay controller state is not TDDLL E ONLINE Accessing the FlexRay CC failed 3 7 5 TDDLL_AbortTxFrameByID 3 7 5 1 Synopsis TDDLL ReturnType TDDLL AbortTxFrameByID TDDLL CtrlIDXType nCtrlIDx TDDLL FrameDscRefIDXType nFrameDscRefIDxX 3 7 5 2 Semantics This function aborts a previously performed transmission request see chapter 3 7 2 This operation is carried out in FlexRay controller state TDDLL_E ONLINE only NOTES Q Incase the particular FlexRay controller used doesn t support to abort a transmission request TDDLL E ACCESS is returned Incase there was no frame pending for transmission TDDLL_E_OK is returned HINT If the argument nCtriIDX is ensured to be constant TDDLL_AbortTxFrameBylD_Static can be called instead of TDDLL_AbortTxFrameByID which consumes less runtime by saving on
5. LeaveConfig The transition LeaveConfig leaves the Config state of the state machine immediately into the state Abort The transition Abort leaves the Config state of the state machine immediately into the Off state Reset The FlexRay controller is being reset No access to the FlexRay controller should be performed Reset The transition Reset immediately performs a reset again 1 If the reset is completed the state machine automatically changes into state Config evaluate the current state using API function TDDLL_GetCtrl1State Copyright DECOMSYS 2006 9 DECOMSYS F 7 Aiea Wakeup The FlexRay controller is transmitting a wakeup pattern Abort The transition Abort immediately aborts the transmission of a wakeup pattern and changes into state Off If the transmission of the wakeup pattern is completed the state Wakeup is left automatically into state evaluate the current state using API function TDDLL GetCtrl1State Copyright DECOMSYS 2006 10 DECOMSYS F N API Documentation 3 API Documentation 3 1 Basic Datatypes Basic datatypes are datatypes every other datatype of the COMMSTACK is built of The basic datatypes are required by the COMMSTACK These datatypes will in general be provided by an external source if the COMMSTACK is used in an environment already defining these datatypes If these datatypes do not exi
6. TDDLL_E_INVALID_DATA The data frame received is invalid implemented for backward compatibility 3 2 3 TDDLL_CtriStateType This datatype is an enumerator used for the COMMSTACK FlexRay controller state of each distinct FlexRay controller The COMMSTACK FlexRay controller state is an abstract state that is represented in software only These states do not directly map to vendor specific FlexRay controller states but map as close as possible to them Supported COMMSTACK FlexRay controller states by the datatype TDDLL CtrlStateType are listed in the following table Please refer to the COMMSTACK FlexRay controller state model in chapter 2 2 for a detailed description of COMMSTACK FlexRay controller states Copyright DECOMSYS 2006 siis DECOMSYS y N API Documentation Value Description TDDLL_S_CTRL_NOT_AVAILABLE No FlexRay controller could be detected on the configured port TDDLL S_OFF The FlexRay controller is halted no communication nor synchronization mechanism is carried out The FlexRay controller is being reset hard reset The FlexRay controller is in config mode TDDLL_S WAKEUP A wakeup pattern is being transmitted in the FlexRay controller TDDLL_S_ STARTUP The FlexRay controller is performing some start up procedure to get synchronized to the network or start up the network communication TDDLL_S_ON The FlexRay controller is synchronized to the network The buffer access for transmission and reception from API is
7. The following options are provided by the default COMMSTACK product alignment restriction Description implementation lt dcsMAL generic rw _allow_ Implementation variant for target architectures that allow unaligned h gt unaligned memory accesses lt dcsMAL generic rw forbid _ inline implementation variant see chapter 6 3 1 for big unaligned be inline h gt endian target architectures that require aligned memory access lt dcsMAL generic _rw_forbid_ noinline implementation variant see chapter 6 3 1 for unaligned_be noinline h gt big endian target architectures that require aligned memory access lt dcsMAL generic _rw_forbid_ macro implementation variant see chapter 6 3 1 for big unaligned_be macro h gt endian target architectures that require aligned memory access lt dcsMAL generic rw_forbid_ inline implementation variant see chapter 6 3 1 for little unaligned le inline h gt endian target architectures that require aligned memory access lt dcsMAL_ generic _rw_forbid_ noinline implementation variant see chapter 6 3 1 for unaligned le noinline h gt little endian target architectures that require aligned memory access lt dcsMAL generic rw_forbid_ macro implementation variant see chapter 6 3 1 for unaligned le macro h gt little endian target architectures that require aligned memory access For practical usage of the memory access configuration see the following example t
8. COMMSTACK is designed to enable porting to a different hardware by modifying some very low level hardware specific files The objective of this chapter is to give a quick introduction on how to adapt the COMMSTACK to your target hardware Additionally the provided example adaptations for memory mapped FlexRay controller access only are described This chapter gives a comprehensive description on the all hardware related settings and explains how they must be adopted for the new target hardware 6 3 1 Compiler specific function implementations The COMMSTACK sub modules MAL and FCAL provide C syntax API implementations that provide some required functionality and work on most C compilers For different compiler capabilities there are several alternative implementations provided which can be identified by their different filename postfixes inline noinline and macro e g dcsMAL generic swap inline h dcsMAL generic swap _macro h dcsMAL generic swap noinline h In general the proposed solution is the inline implementation variant If your compiler doesn t support the inline keyword consult the manual whether inline functions are supported by some other compiler specific mechanism or not If function inlining is supported by some different compiler Copyright DECOMSYS 2006 sa D ECO MSYS F N COMMSTACK Configuration syntax of you compiler customCompiler use the provided inline implementation as a templat
9. CPU is a little endian LE device DO DO CPU D7 D7 MFR4300 CC Little Endian D8 D8 Big Endian D15 D15 Figure 22 CPU LE straight connection CC BE One solution to the data bus interface would be a bitwise 1 1 connection which offers transparency for 16 bit data accesses But if 16 bit data will be read into the CPU memory and interpreted as 8 bit data array e g a string the byte access will end up in a mess D8 DO CPU D15 D7 MFR4300 CC Little Endian DO D8 Big Endian D7 D15 Figure 23 CPU LE swapped connection CC BE Another solution would be to do the byte swapping by the data bus connection which offers transparency to 8 bit array accesses but 16 bit units have to be swapped back again Copyright DECOMSYS 2006 79 D ECO MSYS F N COMMSTACK Configuration No matter what hardware connection chosen the COMMSTACK offers the solution for all three types of connections between a CPU and a MFR4200 FlexRay CC lf no MFR4300 CC support is required within the COMMSTACK the switch _TDDLL_HEADER FILE MFR4300_ACCESS_ should be completely removed from file desCstFr Cfg h 6 3 3 4 PHIP1 access configuration MFR4300 FlexRay CC access configuration has to be done setting the compiler switch _TDDLL HEADER FILE PHIP1 ACCESS _infile dcsCstFr Cfg h Since the Philips FlexRay Controller Rev1 is supported in combination with a single MCU
10. Communication Assignment Grid refers to a distinct frame and summarizes several frame attributes The following table gives some explanation on the seen frame attributes Column Description Frame Triggering A frame triggering is a FlexRay frame which is uniquely identified by the channel CH slot base cycle BC and cycle repetition CR RX TX Type Specifies whether the frame is a receive RX or a transmit TX frame Specifies on which physical FlexRay channel the frame is sent Copyright DECOMSYS 2006 60 D ECO MSYS F N DESIGNER PRO Integration Slot Specifies the FlexRay slot used for the frame transmission BC Base Cycle Specifies the base communication cycle 0 63 in which the frame is sent the first time CR Cycle Repetition Specifies the sending repetition of the frame in units of communication cycles 1 64 Counting starts at BC 1 It must be satisfied that BC CR lt 64 Specifies the offset of frame in the communication cycle in units of us Service Denotes the owner of the frame For example it is possible that the frame is owned by the NM TP FlexCOM or seen in Figure 7 by the application itself Buffer Shows the assigned physical FlexRay message buffer or the assigned buffer pool respective BA Report Buffer Reports information on the buffer assignment configuration To Assignment Report see a report the mouse must be dragged over the appropriate grid cell If the conf
11. FlexRay communication controller hardware implementations The DECOMSYS COMMSTACK lt FlexRay gt is a flexible library that easily extends applications with FlexRay capabilities To obtain this use case the DECOMSYS COMMSTACK lt FlexRay gt was developed with modularity and flexibility in mind It is free of any non FlexRay functionality and free of dependability on any external components This enables a simple integration of this library into your existing application framework 1 1 Overview DECOMSYS COMMSTACK is a software driver that abstracts different FlexRay communication controller implementations and provides a generic FlexRay application programming interface It is intended to be used by higher layer software that has no sense about the different FlexRay communication controller implementations available but is familiar with the standard FlexRay behavior and properties Users of DECOMSYS COMMSTACK are e g transport protocols network management FlexRay COM layer FlexCOM and all kinds of user applications using FlexRay directly Application FlexCOM DECOMSYS COMMSTACK Software FlexRay CC Hardware Figure 1 System Overview Copyright DECOMSYS 2006 4 DECOMSYS F 1 Introduction 1 2 Glossary API Application Programming Interface BA Buffer Assignment BE Big Endian BOR Binary Object Repository DECOMSYS DESIGNER PRO data exchange format CC Communication Controller CPU Central Processing Unit
12. Q The global interrupt source TDDLL_BM GLOBAL_INTERRUPT is implemented as an global interrupt enable disable switch only and hence doesn t own an interrupt status In case an interrupt source not supported on a particular FlexRay controller is selected e g TDDLL_BM_ RELATIVE_TIMER_INTERRUPT on MFR4200 no operation is carried out for this interrupt source HINTS QO The interrupt sources are selected by a bitmask that can be combined by a bitwise OR to operate on several interrupt sources at a single function call Copyright DECOMSYS 2006 Ag DECOMSYS F N API Documentation Q Ifthe argument nCtrlIDX is ensured to be constant TDDLL_InterruptResetStatus_Static can be called instead of TDDLL_InterruptResetStatus which consumes less runtime by saving one function call overhead 3 11 4 3Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on Pending interrupts stati that should be reset 3 11 4 4Return Values None 3 11 5TDDLL_SetTimerAbs 3 11 5 1Synopsis TDDLL ReturnType TDDLL SetTimerAbs TDDLL CtrlIDXType nCtrlIDx TDDLL TickType nMacroTick TDDLL CycleType nRepCycle TDDLL CycleType nBaseCycle 3 11 5 2Semantics This function configures the absolute timer of a FlexRay controller NOTE The absolute timer always works in continuous mode HINT If the argument nCtriIDX is ensured to be constant TDDLL_SetTimerAbs_Static can be
13. TDDLL GetPOCStatus CtrlIDXType nCtrlIDX TDDLL POCStatusType pStatus Copyright DECOMSYS 2006 28 DECOMSYS F N API Documentation 3 6 4 2 Semantics This function returns the actual POC status as defined by the FlexRay specification of the requested FlexRay controller NOTES Q Itis always ensured that every element of the status structure will be written in case of positive return code In case of a negative return code the status structure is not ensured to be consistent and must not be used therefore a FlexRay controllers that are not 100 compatible with the POC status definition here will map their internal states to this type with the closest meaning states In this case not all states will be used HINT If the argument nCtrilIDX is ensured to be constant TDDLL_GetPOCStatus_Static can be called instead of TDDLL_GetPOCStatus which consumes less runtime by saving one function call overhead 3 6 4 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on Address the current POC status is written to 3 6 4 4 Return Values Value Description TDDLL E OK The function was successfully finished AVA E INVALID_IDX The given input parameter or some basic given input parameter or some basic configuration is invalid is invalid TDDLL_E aa device specific error occurred when accessing th
14. This member contains an unique FlexRay frame signature that is built up by the following information bitwise 0 8 FlexRay controller index of the FlexRay frame 9 Tx Rx FlexRay frame 10 20 FlexRay frame identifier 21 FlexRay channel A usage 22 FlexRay channel B usage 23 25 Cycle repetition value 26 31 Base cycle value uint32 nConfigFlags This member contains some buffer configuration flags that are used for abstract buffer configuration bitwise 0 9 FlexRay controller buffer index 10 16 Maximum payload length allowed for this buffer 17 Transmission mode 29 32 Not used CRC calculated for the header of the FlexRay frame NOTE For obtaining a reference to data structures of this type of a dedicated frame the COMMSTACK user API functions TDDLL_LookupTxFrame TDDLL_LookupRxFrame should be used 3 3 3 TDDLL_QueueDscType This compound datatype is used for the constant configuration data of software queue assigned to a receive transmit FlexRay frame FlexRay frames assigned a queue to them can be received transmitted using API function TDDLL_RxFrameByIDQueued TDDLL_TxFrameByIDQueued This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description uintl nQueueMemoryIndex This member is an index into a memory assigned to the Copyright DECOMSYS 2006 18 DECOMSYS F N API D
15. This member holds the pointer for FrameBuffer channel A space If it is NULL no initialization table is available buffer space will be initialized with O in this case const uint32 pFrameBuffer B This member holds the pointer for FrameBuffer channel B space If it is NULL no initialization table is available buffer space will be initialized with O in this case uint32 NumCHC_ FrameBuffer A This member holds the size of FrameBuffer channel A space in units of 32bit words uint32 NumCHC FrameBuffer This member holds the size of FrameBuffer channel B space in units of 32bit words uintl6 NumCHICommands This member holds the number of entries within the CHI register initialization list uintl16 NumCHC_SCL A This member holds the number of SCL elements for Channel A uint16 NumCHC_SCL This member holds the number of SCL elements for Channel B This member holds the number of BCL elements This member holds the number of BDL elements 4 4 1 5 TDDLL_PHIP1_VirtualRegisterType This compound datatype holds a virtual register list element as used in lists SCL channel A SCL channel B BCL and BDL for a Philips Rev1 FlexRay controller as contained in the SJA2510 MCU This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description uint32 Register1 This is the first register within an virtual register list element Since t
16. controller s internal registers 4 4 1 4 TDDLL_CHI_PHIP1_CommandType This compound datatype holds a register configuration value for a Philips Rev1 FlexRay controller as contained in the SJA2510 MCU This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description uint16 nCHIOffset This member holds a FlexRay controller register address offset The offset is calculated from the base CHI address of a Philips Rev1 FlexRay controller as contained in the SJA2510 MCU uint16 nCHIValue This member holds the value to be written in the Philips Rev1 FlexRay controller as contained in the SJA2510 MCU register identified by the member nCHIOffset 1 1 2 TDDLL_PHIP1_FrameDsc_ExtendedConfigType This compound datatype contains extended information that is required to configure the buffer of a Philips Rev1 FlexRay controller as contained in the SJA2510 MCU This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description uint16 SCLEIdx This is the index into the SCL used for the particular FlexRay frame the frame is assigned to uint16 BDLEIdx This is the index into the BDL used for the particular FlexRay frame the frame is assigned to 1 1 3 TDDLL_PHIP1_RegisterType This compound datatype contains extended information that
17. endian data representation at the databus interface In the following figures we assume the host CPU and the CC having the same notation regarding the bit numbering Isb D0 msb D31 The following figures present the supported data bus connection patterns CPU D15 D15 ERAY CC Little Endian D16 D16 Little Endian D23 D23 D24 D24 D31 D31 Figure 18 CPU LE 32 16 bit straight connection CC LE Figure 18 shows the connection of a little endian CPU to an ERAY CC with a 16 bit or 32 bit data bus 1 1 connection CPU D15 D15 ERAY CC Big Endian D16 D16 Little Endian D23 D23 D24 D24 D31 D31 Figure 19 CPU BE 32 bit straight connection CC LE Copyright DECOMSYS 2006 sire D ECO MSYS F N COMMSTACK Configuration Figure 19 shows the connection of a big endian CPU to an ERAY CC with a 32 bit data bus 1 1 connection CPU D15 D15 ERAY CC Big Endian Little Endian Figure 20 CPU BE 16 bit straight connection CC LE Figure 20 shows the connection of a big endian CPU to an ERAY CC with a 16 bit data bus 1 1 connection lf no ERAY10 CC support is required within the COMMSTACK the switch _TDDLL_HEADER FILE ERAY10 ACCESS_ should be completely removed from file desCstFr Cfg h 6 3 3 3 MFR4300 access configuration MFR4300 FlexRay CC access configuration has to be done setti
18. internal database view Open the Entity View and open the Type Selector Frame Triggering Receiver Channel Port or Frame Triggering Transmitter Channel Port depending whether you want to apply the queue to a receive or transmission frame triggering Select the frame triggering you want to apply the queue to and enter the appropriate queue depth into field Rx Queue Depth Tx Queue Depth as shown in Figure 9 Copyright DECOMSYS 2006 61 D ECO MSYS 7 N DESIGNER PRO Integration FiaCntity Yiew rame Triggering Receiver ChoannelPart FA Specialisation Type Frame Triggeting Roceicr Chan LIN 124_TastNidel Cartre tn Channel Bae RETENER ENANS ERA FOLID1 134 1_Teetcde2 Cortralle_to Channel Rerever Chancel Prnt Testhad 1Crateoller Fn nanm FOLIDI1 S42 TestNcdel Cortrollc_to_Channclll COMM Task Assignment Testhad 1 Controller Pcl ct MO 101714407 _TestNde2Cor bole to Chrarirel Frame Tricgering RO ID1144_2 PO 1D1144_ 2 Testicdel Cortrdleta Channel Fi fer 012 HUI 18 Sstode Lortreller to Channel som HO IDI 204_TsstNode2Cortrelleto_Channell Ret Quart 10 HO 1039 Testicde Cortrdlei to Channelll Re Suspicious Hook Furctisn UDAJ Tested Corte tn Channel Bs Tineo Hock Funct on H IDA 11B Tastode2Cortrellerto Channel FAL_ID112B_ TsstWode Cortrellcto Channel fH IDI 10 T stNode Cortreller_ to Channell Peer ale re Pock fl ID115B_ T stNodel Cortrcllei_to_Channell Re Tincout Threshold 0
19. is required to configure a Philips Rev1 FlexRay controller as contained in the SJA2510 MCU This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description const Pointer to an array of CHI initialization values TDDLL CHI PHIP1 CommandType pCHICommands const This member holds the pointer for SCL channel A TDDLL_PHIP1 VirtualRegisterType initialization values In case global configuration switch pCHC SCL_A TDDLL_PHIP1_CONSTANT_SCL is enabled this table will be used immediately In case it is NULL no channel A SCL is available const This member holds the pointer for SCL channel B TDDLL_PHIP1 VirtualRegisterType initialization values In case global configuration switch TDDLL_PHIP1 CONSTANT SCL is enabled this Copyright DECOMSYS 2006 55 D ECO MSYS 7 N CC Type Specific Extensions PCHC_SCL_B table will be used immediately In case it is NULL no channel B SCL is available const This member holds the pointer for BCL initialization TDDLL_PHIP1 VirtualRegisterType values This table is copied into RAM during CC pCHC_ BCL initialization In case it is NULL no BCL is available const This member holds the pointer for BDL initialization TDDLL_PHIP1 VirtualRegisterType values This table is copied into RAM during CC pCHC BDL initialization In case it is NULL no BDL is available const uint32 pFrameBuffer A
20. parameter Frame Triggering ft0O_ D64 is required In summary the code for sending the considered frame has the following appearance TODLL ReturnType notatus TDDLL LengthType nLength const char aRxMsg PAYLOAD LENGTH 7 nStatus TDDLL RxFrameByID 0 TDDLL RX FRAME TRIGGERING ftO IDo4 amp aRxMsg 0 PAYLOAD LENGTH amp nLength Copyright DECOMSYS 2006 67 D ECO MSYS F N DESIGNER PRO Integration The first parameter of TDDLL_RxFrameByID gives the interface number to which the FlexRay controller is mapped to aRxMsg is the temporary message buffer for receiving the frame data nLength is the length of the frame actually received PAYLOAD_LENGTH gives the buffer size the frame is written to On success the function returns TDDLL_E_OK Copyright DECOMSYS 2006 68 D ECO MSYS F N COMMSTACK Configuration 6 COMMSTACK Configuration The COMMSTACK design is focused on flexibility The COMMSTACK philosophy is to provide mechanisms that don t limit the user to any specific use case but offers the full range of applicability in the COMMSTACK function domain To enable this feature the COMMSTACK provides a high degree of configurability which has to be provided for operation The binding method of the configuration options is carefully selected to meet the performance and application requirements There are three different binding methods used for the COMMSTACK configuration e Pre Compile configuration
21. right now SJA2510 there is also a single configuration option that describes the connection schema PHIP1 access option Description lt dcsCstFr_ FCAL phipl_mmap a Only PHIP1 FlexRay access configuration available ccess32 le straight h gt 6 3 4 FlexRay CC Mapping Configuration The mapping from FlexRay CC indices given at the COMMSTACK API to real hardware devices is done in a Post Compile configuration style This enables to configure a COMMSTACK delivered as library to be adapted to a wide range of hardware adaptations on a specific hardware platform These configuration modifications have to be done in the configuration file dcesCstFr_ CtrlHW Cfg c In general this file has to be adapted to a hardware a COMMSTACK is used on and must be linked to every application using the COMMSTACK The following configuration options can be modified in this file e number of FlexRay CC provided by the hardware e mapping from API CC index to CC hardware type e mapping a dedicated FlexRay CC to a memory base address e supplying a dedicated FlexRay CC with a hardware reset mechanism First of all an array has to be created that maps FlexRay CC indices as used at the COMMSTACK API to FlexRay controller types Please note that the FlexRay CC indices should follow a closed index range from 0 to the number of FlexRay 1 for optimal resource utilization const TDDLL CtrlMappingType TDDLL CtrlMapping 2 TDDLL CTRL TYPE MFR4200 F
22. same data representation obviously there should be a 1 1 connection The more complex case occurs if the data representation differs Lets assume the CPU is a little endian LE device Copyright DECOMSYS 2006 75 D ECO MSYS F N COMMSTACK Configuration DO DO CPU D7 D7 MFR4200 CC Little Endian D8 D8 Big Endian D15 D15 Figure 16 CPU LE straight connection CC BE One solution to the data bus interface would be a bitwise 1 1 connection which offers transparency for 16 bit data accesses But if 16 bit data will be read into the CPU memory and interpreted as 8 bit data array e g a string the byte access will end up in a mess CPU MFR4200 CC Little Endian Big Endian Figure 17 CPU LE swapped connection CC BE Another solution would be to do the byte swapping by the data bus connection which offers transparency to 8 bit array accesses but 16 bit units have to be swapped back again No matter what hardware connection chosen the COMMSTACK offers the solution for all three types of connections between a CPU and a MFR4200 FlexRay CC lf no MFR4200 CC support is required within the COMMSTACK the switch _TDDLL_HEADER FILE MFR4200 ACCESS_ should be completely removed from file desCstFr Cfg h 6 3 3 2 ERAY10 access configuration Please note that the ERAY10 FlexRay CC IP doesn t specify any endianess on the databus interface Instead cu
23. structural reasons the COMMSTACK contains two sub modules that are each implemented as macros or inline functions depending on your compiler s capabilities These sub modules improve the ease of COMMSTACK porting by providing COMMSTACK internal abstraction while obtaining as much performance as possible The following directories are contained the root directory e include containing public interface header files Public interface header files offer an interface to other software layers or the application e src containing source files and private header files Private header files are included only in the respective software layer where they reside They are primary necessary for a clean software structure and consistency reasons e containing private Memory Access Library The MAL COMMSTACK private library provides generic mechanisms for accessing memory and swapping bytes on a dedicated hardware configuration Copyright DECOMSYS 2006 69 DECOMSYS F 1 COMMSTACK Configuration e FCAL containing private FlexRay Controller Access Layer The FCAL COMMSTACK private layer provides mechanisms for accessing memory mapped FlexRay controllers Each of these subdirectories include and src may contain one subdirectory per supported hardware target architecture however they may contain additional subdirectories The architecture dependent subdirectories are prefixed with arch
24. that maps exactly a frame triggering name as specified in the communication model 3 8 2 3 Parameters Value Description Name of the frame triggering to receive 3 8 2 4 Return Values Description Unique identifier of the frame description structure of the transmission frame identified by the given arguments 3 8 3 TDDLL_RxFrameByID 3 8 3 1 Synopsis TDDLL ReturnType TDDLL RxFrameByID CtrlIDXType nCtrlIDX TDDLL FrameDscRefIDXType nFrameDscRefIDX const void pData TDDLL LengthType nRxBufferLength TDDLL LengthType pnReceivedLength Copyright DECOMSYS 2006 35 DECOMSYS F N API Documentation 3 8 3 2 Semantics This function receives a particular FlexRay frame on a distinct FlexRay controller A reception is carried out in FlexRay controller state TDDLL_E ONLINE only NOTES Q Only syntactically valid frames containing data are received with this API function QO The data bytes are stored in memory in the same order the bytes were received on the FlexRay bus The byte at address pData was received first on the bus the byte at pData 1 second and so on Q There is no alignment restriction required for the data location pointed to by pData HINT If the argument nCtriIDX is ensured to be constant TDDLL_RxFrameBylID_Static can be called instead of TDDLL_RxFrameBylD which consumes less runtime by saving one function call overhead 3 8 3 3 Parameters Value Description nCtrlIDX The FlexRa
25. CHA Transmit a wakeup pattern on FlexRay channel A TDDLL T WAKEUP CHB Transmit a wakeup pattern on FlexRay channel B Copyright DECOMSYS 2006 13 DECOMSYS F N API Documentation TDDLL_T_CTRL_NOT AVAILABLE Set the FlexRay controller to the state TDDLL_S CTRL NOT AVAILABLE 3 2 5 TDDLL_CtriTypesType This datatype is used for variables that represent the different FlexRay vendor specific controllers The values allowed for this type are TDDLL_CTRL_ TYPE _ERAY10 for representing a Bosch E RAY based FlexRay controller TDDLL_ CTRL TYPE MFR4200 for a Freescale FlexRay controller MFR4200 TDDLL_CTRL_ TYPE MFR4300 for a Freescale FlexRay controller MFR4300 and TDDLL CTRL TYPE PHIP1 for a Philips FlexRay Controller Rev1 SJA2510 3 2 6 TDDLL_FrameDscRefIDXType This datatype is used for identifying frame to transmit or receive via the COMMSTACK API Each FlexRay frame is assigned a unique ID within the COMMSTACK configuration Using this ID identifies the frame when calling API functions operating on FlexRay frames 3 2 7 TDDLL_CtrlIDXType This datatype is used for variables that represent an index for a FlexRay controller FlexRay controller indices are used for distinctly identifying a FlexRay controller within the software 3 2 8 TDDLL_FrameIDType This datatype is used for variables that represent a FlexRay frame identifier of a particular frame 3 2 9 TDDLL_ChannelIDXType This datatype is used for variables that represe
26. COMMSTACK lt FLEXRAY gt 1 8 User Manual DECOMSYS Markus Eggenbauer Version 1 8 0 March 2006 2006 by Dependable Computer Systems All rights reserved DECOMSYS F 7 Contact Information DECOMSYS Dependable Computer Systems Mail Hardware und Software Entwicklung GmbH Stumpergasse 48 28 A 1060 Wien Austria 43 1 599 83 0 Phone 43 1 599 83 18 Fax info decomsys com E Mail www decomsys com Web Copyright Notice License agreement Copyright 2006 by Dependable Computer Systems All Rights Reserved No part of this document may be photocopied or reproduced in any form without prior written consent from Dependable Computer Systems Trademarks All trademarks used in this document are the property of their respective owners Copyright DECOMSYS 2006 ii D ECO MSYS F N Table of Contents Table of Contents COMMS PACK raas T E A Tane ean te hc bse eee Paced 3 Copyright DECOMSYS 2006 3 DECOMSYS F N Introduction 1 Introduction The DECOMSYS COMMSTACK lt FlexRay gt is a comprehensible FlexRay controller software driver package The main intention of a software driver is to provide an abstract software interface to some specific hardware device The DECOMSYS COMMSTACK provides a FlexRay specific interface on top of its API while abstracting the peculiarities of specific
27. COMSYS F 7 FlexRay Hardware DECOMSYS COMMSTACK components O FlexRay Hardware The CC hardware consists of one to several FlexRay communication controllers that might be mixed up of different implementations COMMSTACK DECOMSYS COMMSTACK is ported to a dedicated host CPU CC hardware connection schema and is integrated into a specific development environment All connection schemas of communication controllers of the same type must be identical CCs of one implementation may differ in their CC handle only e g different base addresses a Hardware Configuration The hardware configuration contains the device mapping and reset configuration of the FlexRay CC devices The configuration of CC handles identifies dedicated connected FlexRay controllers The CC mapping maps FlexRay CC implementation abstract controller indices to dedicated CC devices Additionally reset functions which are strongly hardware specific have to be supplied within the hardware configuration static configuration is a post compile pre build time configuration Application Configuration The application specific configuration is created by DECOMSYS DESIGNER PRO The application configuration is a post build configuration 2 2 State Model The COMMSTACK behavior is controlled by a state machine that is administrated for each single FlexRay controller driven by the COMMSTACK Within the further documentation this state is referred to as C
28. ECU Electronic Control Unit ERAY10 Bosch ERAY IP FlexRay Communication Controller FIBEX Field Bus Exchange FIFO First In First Out FlexCOM DECOMSYS signal communication layer GUI Graphical User Interface LE Little Endian LSB Least Significant Byte Isb least significant bit MFR4200 Freescale MFR4200 FlexRay Communication Controller MFR4300 Freescale MFR4300 FlexRay Communication Controller MSB Most Significant Byte msb most significant bit NM Network Management PHIP1 Philips ABL FlexRay Communication Controller e g contained in Philips SJA2510 Rx Reception TDDLL Time Driven Data Link Layer TP Transport Protocol TX Transmission XCDEF DECOMSYS Designer data exchange format Copyright DECOMSYS 2006 5 DECOMSYS F 7 2 Architecture 2 1 COMMSTACK Design The internal structure of DECOMSYS COMMSTACK 1 8 can be depicted as shown in Figure 2 API precompile time driver abstraction API runtime driver abstraction CC abstract configuration data CC mapping CC handle reset MFR4200 API MFR4300 API CC specific configuration data E 2 O Q 14 ERAY 10 lt 0 gt ERAY10 lt 1 gt ERAY10 lt 2 gt MFR4200 lt 0 gt MFR4200 lt 1 gt MFR4200 lt 2 gt CCXY lt 0 gt hardware developer system developer application developer Figure 2 COMMSTACK lt FlexRay gt 1 8 System Architecture Copyright DECOMSYS 2006 6 DE
29. Fixed minor mistypings Added API function TDDLL_IsSync Changed FramelD based API functions Changed version information from 1 4 0 to 1 6 Gerald Freiberger Added description on COMMSTACK application configuration with DESIGNER PRO Added index General updates Markus Eggenbauer Added section COMMSTACK configuration Changed versioning according to COMMSTACk versioning system Added notes about MFR4300 implementation and configuration Implemented review remarks from FHOL Added notes about PHIP1 implementation and configuration Markus Eggenbauer Moved document source to OpenOffice Markus Eggenbauer Added Abort transition from state Config to state Markus Eggenbauer Added return code TDDLL_E ACCESS to API function TDDLL_CheckTxFraemByID Markus Eggenbauer Document Update to COMMSTACK 1 8 0 0 9 3 24 10 2005 6 12 2005 31 12 2006 27 2 2006 28 2 2006 13 3 2006 1 1 1 OIO Q h 9 1 9 2 6 0 6 1 6 2 6 6 1 a 24 3 2006 1 8 0 DECOMSYS F 7 7 Index B Basic datatypes 11 S Specific datatypes 12 T TDDLL_AbortTxFrameByID 21 33 TDDLL_APIListType 20 TDDLL BooleanType 12 17 27 TDDLL_BufferIDXType 14 20 25 TDDLL_ChannelIDXType 14 22 29 34 37 TDDLL_CheckTxFrameByIDQ 21 32 34 TDDLL_ CHI ERAY10 CommandType 19 52 TDDLL CHI MFR4200 CommandType 19 TDDLL_ CHI MFR4300 CommandType 53 TDDLL C
30. HI PHIP1 CommandType 55 TDDLL ConfigAllBuffers 26 TDDLL ConfigBuffer 20 25 TDDLL ConfigType 20 24 TDDLL CtrlDscType 19 20 TDDLL CtrlIDXType 14 20 21 22 23 24 25 26 27 28 29 31 32 33 34 35 36 38 39 40 41 42 43 44 45 46 47 48 49 57 TDDLL CtrlInitQ 20 24 TDDLL_CtrlMappingType 22 TDDLL _CtrlStateType 12 20 21 27 28 50 51 52 54 TDDLL _CtrlTransitionType 13 21 28 TDDLL_CtrlTypesType 14 22 TDDLL_CycleType 14 21 22 29 34 37 42 48 TDDLL_EmptyQueue 41 TDDLL_ERAY10_ CtrlListType 22 51 TDDLL_ERAY10_ CtrlStateInfoType 51 TDDLL_ErrorModeType 16 TDDLL_FillRxQueue 39 41 57 TDDLL_FlushTxQueue 38 40 TDDLL_FrameDscRefIDXType 14 21 29 30 31 32 33 34 35 38 39 40 41 57 TDDLL_ FrameDscType 17 19 20 25 TDDLL FrameIDType 14 22 29 34 37 TDDLL_FreeBufferPool 34 TDDLL_GetCtrlState 8 9 10 21 27 TDDLL_GetCycleLength 21 43 TDDLL_GetNumCtrl 23 TDDLL_GetPOCStatus 21 28 29 TDDLL_GetTime 21 42 TDDLL _Init 8 9 23 TDDLL Interrupt SourceType 15 TDDLL InterruptDisable 21 46 TDDLL InterruptEnable 21 45 TDDLL InterruptResetStatus 21 47 48 TDDLL InterruptStatus 21 46 47 TDDLL _IsSync 27 TDDLL LengthType 14 21 22 31 35 37 39 4 TDDLL_LookupRxFrame 18 34 66 67 TDDLL_LookupTxFame 29 TDDLL_ MacroticksToNS 44 TDDLL_MFR4200_ Ctr
31. INTERRUPT is a global interrupt enable disable switch that is in serial connection to all the other interrupt lines which are parallel to each other To work with interrupts the global interrupt source must be enabled In case an interrupt source not supported on a particular FlexRay controller is selected e g TDDLL_BM_ RELATIVE_TIMER_INTERRUPT on MFR4200 no operation is carried out for this interrupt source HINTS QO The interrupt status of each interrupt source is independent from the enable disable state of the corresponding interrupt source The status might return an pending interrupt even if the interrupt source is disabled It is recommended to always clear the interrupt status before enabling an interrupt source to start operating in a consistent interrupt environment QO If the argument nCtriIDX is ensured to be constant TDDLL_InterruptEnable Static can be called instead of TDDLL_InterruptEnable which consumes less runtime by saving one function call overhead 3 11 1 3Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on Interrupt sources that should be enabled 3 11 1 4Return Values None Copyright DECOMSYS 2006 45 DECOMSYS F N API Documentation 3 11 2TDDLL_InterruptDisable 3 11 2 1Synopsis void TDDLL InterruptDisable TDDLL CtrlIDXType nCtrlIDXx TDDLL InterruptSrcTfype nIintSrce 3 11 2 2Semantics This funct
32. LL IsSync TDDLL CtrlIDXType nCtrlIDX 3 6 1 2 Semantics This function returns whether the given controller is synchronized to a cluster or not NOTES In case of any error while accessing the device this function returns TDDLL_FALSE 3 6 1 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on 3 6 1 4 Return Values Value Description The FlexRay controller is synchronized to a FlexRay cluster The FlexRay controller is not synchronized to a FlexRay cluster 3 6 2 TDDLL_GetCtriState 3 6 2 1 Synopsis TDDLL CtrlStateType TDDLL GetCtrlState TDDLL CtrlIDXType nCtrlIDX 3 6 2 2 Semantics This function returns the current active COMMSTACK FlexRay controller state NOTE This function actually evaluates the current COMMSTACK state by requesting the FlexRay controller state So this function is able to perform automatic state transitions as described in the state diagram HINT the argument nCtrlIDX is ensured to be constant TDDLL_GetCtrlState_Static can be called instead of TDDLL_ GetCirlState which consumes less runtime by saving one function call overhead 3 6 2 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on 3 6 2 4 Return Values Value Description Copyright DECOMSYS 2006 ye DECOMSYS F N API Documentation state The actual COMMSTACK Fl
33. OMMSTACK FlexRay controller state Figure 3 shows the state machine states and transitions that are provided by the COMMSTACK Reset 1 Reset Halt Abort 1 Halt Abort 1 a EnterConfig LeaveConfig Abort SendWakeup Abort 1 C gt State C gt Initial State Ctrl not available Init Figure 3 COMMSTACK FlexRay controller state machine Copyright DECOMSYS 2006 7 DECOMSYS F 7 The following table describes the states and transitions of the COMMSTACK in detail Transition Description The FlexRay controller does not perform any access to the network and is not able to be configured e g FlexRay ready state This is the start state after COMMSTACK initialization TDDLL Init if the CC is detected successfully and the cluster is not synchronized Reset This transition changes into the state Reset and performs a hard reset of the FlexRay CC EnterConfig This transition changes into the state Config and switches the CC into config mode SendWakeupChA This transition changes into the state Wakeup und initiates the transmission of a wakeup pattern on FlexRay channel A of the dedicated FlexRay CC SendWakeupChB This transition changes into the state Wakeup und initiates the transmission of a wakeup pattern on FlexRay channel B of the dedicated FlexRay CC Startup This transition changes into the state Startup a
34. OMMSTACK build process TDDLL_RELATIVE TIMER SWITCH This switch includes the relative timer API function TDDLL SetTimerRel into the COMMSTACK build process TDDLL POC STATUS SWITCH This switch includes the POC status API function TDDLL GetPOCStatus into the COMMSTACK build process TDDLL STATIC PAYLOAD _ In case a frame shorter than the application schedule PADDING PATTERN SWITCH configured static payload length should be transmitted from a COMMSTACK transmission API function this switch enables to fill the remaining bytes of the frame with a fill pattern defined In macro TDDLL PAYLOAD PADDING PATTERN within the COMMSTACK configuration file decsCstFr_ Cfg h TDDLL SINGLE CC TYPE OPTIMIZ ATION Since COMMSTACK transmission API functions operate on the per byte frame length but FlexRay requires 16 bit words resulting in an even number of bytes to be transmitted the value defined in COMMSTACK macro TDDLL PAYLOAD PADDING PATTERN is used for filling the last byte in case an odd number of bytes should be transmitted 6 3 COMMSTACK Target Hardware Configuration Most COMMSTACK target hardware configuration options can be modified in COMMSTACK source code distributions only since these settings affect the COMMSTACK compilation process Address mapping and reset configuration of the COMMSTACK is done in a post compile configuration file desCstFr_Ctr1HW_Cfg c that can be modified in COMMSTACK library distributions also The
35. PATTERN SWITCH is defined If TDDLL_STATIC_PAYLOAD_PADDING_PATTERN_SWITCH is not defined the frame is filled with random data up to the static payload length If a frame belongs to the dynamic FlexRay segment the payload length must not exceed the maximum payload length this distinct frame was configured to The data bytes are transmitted on the bus in the same order as the bytes are located in memory The byte at address pData is transmitted first on the bus the byte at pData 1 second and so on There is no alignment restriction required for the data location pointed to by pData 3 9 3 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on Unique ID that identifies the frame to be transmitted Pointer to the payload data to be transmitted within the frame Length of the payload data in units of bytes to be transmitted 3 9 3 4 Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E INVALID IDX The given input parameter or some basic configuration is invalid TDDLL E OVERFLOW The queue is full TDDLL_E OFFLINE The COMMSTACK FlexRay controller state is not TDDLL E ONLINE 3 9 4 TDDLL_RxFrameByIDQueued 3 9 4 1 Synopsis ReturnType TDDLL RxFrameByIDQueued TDDLL CtrlIDXType nCtrlIDX TDDLL FrameDscRefIDXType nFrameDscRefIDX const void pData Copyright DECOMSYS 2006 40 DECOMSYS F N A
36. PI Documentation TDDLL LengthType nRxBufferLength TDDLL LengthType pnReceivedLength 3 9 4 2 Semantics This function receives a particular FlexRay frame out of a software queue A reception is carried out in FlexRay controller state TDDLL_E ONLINE only The frame is put into the software queue by TDDLL FillRxQueue NOTES a Only syntactically valid frames containing data are received with this API function QO The data bytes are stored in memory in the same order the bytes were received on the FlexRay bus The byte at address pData was received first on the bus the byte at pData 1 second and so on QO There is no alignment restriction required for the data location pointed to by pData 3 9 4 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on Unique ID that identifies the frame to be received Pointer the payload data received is written to nRxBufferLength Length of the buffer pData points to in units of bytes There is never more payload written to pData than specified by nRxBufferLength pnReceivedLength Length of the payload actually received in units of bytes If there are more bytes received than the buffer is able to store nRxBufferLength the payload data is truncated and the truncated part is lost 3 9 4 4 Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E INVALID IDX The given input p
37. S 2006 31 DECOMSYS F N API Documentation transmit with the buffer assigned to this frame Otherwise TDDLL_E INVALID IDX will be returned on both cases 3 7 3 4 Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E_INVALID_IDX The given input parameter or some basic configuration is invalid TDDLL_E ACCESS Some device specific error occurred when accessing the FlexRay communication controller TDDLL_E OVERFLOW No resource for frame transmission buffer within the FlexRay controller is available TDDLL E OFFLINE The COMMSTACK FlexRay controller state is not TDDLL E ONLINE 3 7 4 TDDLL_CheckTxFrameByID 3 7 4 1 Synopsis TDDLL ReturnType TDDLL CheckTxFrameByID TDDLL CtrlIDXType nCtrlIDx TDDLL FrameDscRefIDXType nFrameDscRefIDxX 3 7 4 2 Semantics This function checks whether a previously performed transmission request see chapter 3 7 2 has been already executed by the FlexRay controller or not This operation is carried out in FlexRay controller state TDDLL_E ONLINE only NOTE In case there was no frame requested for transmission before TDDLL_E_OK is returned HINTS In case of buffer pooling the buffer reserved for a frame transmission is released with this function call if the frame was already delivered to the network Q If the argument nCtriIDX is ensured to be constant TDDLL_CheckTxFrameBylID_Static can be called instead of TDDLL_CheckTxFrameBylD
38. TDDLL_BM GLOBAL_INTERRUPT is implemented as an global interrupt enable disable switch only and hence doesn t own an interrupt status A 0 bit will be returned always at the global interrupt status flag In case an interrupt source not supported on a particular FlexRay controller is selected e g TDDLL_BM_RELATIVE_TIMER_INTERRUPT on MFR4200 no operation is carried out for this interrupt source HINTS Q The interrupt status of each interrupt source is independent from the enable disable state of the corresponding interrupt source The status might return an pending interrupt even if the interrupt source is disabled Q If the argument nCtriIDX is ensured to be constant TDDLL_ InterruptStatus_Static can be called instead of TDDLL_InterruptStatus which consumes less runtime by saving one function call overhead 3 11 3 3Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on 3 11 3 4Return Values Description Status of all supported interrupts as a bitmask A bit 1 indicates that an interrupt is pending a bit 0 indicates that no interrupt occurred 3 11 4TDDLL_InterruptResetStatus 3 11 4 1Synopsis void TDDLL InterruptResetStatus TDDLL CtrlIDXType nCtrlIDXx TDDLL InterruptSrcTfype nIntSrc 3 11 4 2Semantics This function resets the pending status of the interrupts selected by the sources passed as arguments NOTES
39. Value Description 3 10 4TDDLL_MacroticksToNS 3 10 4 1Synopsis TimeType TDDLL MacroticksToNS TDDLL CtrlIDXType nCtrlIDx TDDLL TickType nTick 3 10 4 2Semantics This function calculates time in units of macroticks into time in units of nanoseconds as configured for a dedicated FlexRay controller NOTE Please be aware that the value range of both units macroticks and nanoseconds are limited by the ranges of their datatypes This function doesn t check for occurring calculation overflows HINT If the argument nCtrlIDX is ensured to be constant TDDLL_MacroticksToNS_Static can be called instead of TDDLL_MacroticksToNS which consumes less runtime by saving one function call overhead 3 10 4 3Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on Copyright DECOMSYS 2006 44 DECOMSYS F N API Documentation 3 10 4 4Return Values Value Description 3 11Timer amp Interrupt Services The timer and interrupts services are required for configuring and administrating the FlexRay controller s interrupt resources 3 11 1TDDLL_InterruptEnable 3 11 1 1Synopsis void TDDLL InterruptEnable TDDLL CtrlIDXType nCtrlIDx TDDLL InterruptSrcTfype nintSrce 3 11 1 2Semantics This function enables the interrupts selected by the sources passed as arguments NOTES QO The global interrupt source GLOBAL_
40. _GetTime_Static can be called instead of TDDLL_GetTime which consumes less runtime by saving one function call overhead 3 10 1 3Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on pClusterTime Pointer to a storage location the current communication cycle offset in units of macroticks is written to pCommCycle Pointer to a storage location the current Communication cycle g value is written to Copyright DECOMSYS 2006 Ab DECOMSYS F N API Documentation 3 10 1 4Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E_INVALID_IDX The given input parameter or some basic configuration is invalid TDDLL E NOT SYNC The FlexRay controller is not synchronized to the cluster 3 10 2TDDLL_GetCycleLength 3 10 2 1Synopsis TDDLL ReturnType TDDLL GetCycleLength TDDLL CtrlIDXType nCtrlIDx TDDLL TickType pCommCycleLength 3 10 2 2Semantics This function returns the actual communication cycle length a FlexRay controller has configured NOTE If some value different from TDDLL_E OK is retuned the output parameter pCommCycleLength is not written but left in its previous state HINT If the argument nCtriIDX is ensured to be constant TDDLL_GetCycleLength_Static can be called instead of TDDLL_GetCycleLength which consumes less runtime by saving one function call overhead 3 10 2 3Parameters Value Desc
41. aken from the file desCstFr_ Cfg h of the COMMSTACK product target architecture configuration for target dcsnodearm_ generic SWAP macros selection configuration define TDDLL HEADER FILE DCSMAL SWAP lt dcsMAL generic swap inline h gt memory access restriction configuration define TDDLL HEADER FILE DCSMAL ALIGNMENT lt dcsMAL generic rw forbid unaligned le inline h gt 6 3 3 FlexRay CC Access Configuration The COMMSTACK product is prepared to connect different FlexRay CC via a parallel interface memory mapped I O to a wide range of CPUs There are three important properties that have to be considered when connecting a CPU memory mapped to a FlexRay CC e Endianess of the CPU e Databus connection bit width byte crossing Copyright DECOMSYS 2006 74 D ECO MSYS F N COMMSTACK Configuration e Endianess of the FlexRay CC According to these properties several system configuration combinations might be possible The connection type to be used has to be configured in the COMMSTACK main configuration file dcsCstFr Cfg h using switches TDDLL HEADER FILE lt CC Type gt _ ACCESS where lt CC_Type gt is one of the supported FlexRay Controllers see the following chapters If only a single FlexRay CC type is required the access switches as described above should be removed completely for not required FlexRay CC types This allows enabling the compiler switch TDDLL SINGLE CC TYPE OPTIMIZATION in file dcsCstFr_Cfg
42. al Re or Ts ame brigge ings sharing the sare slot and chennel Clear All Figure 11 Auto BA Tab The above step must be repeated for each communication controller of an ECU and for all the ECUs to be configured On success all defined frames get a physical FlexRay buffer assigned Thereafter the Communication Assignment grid of the considered controller has the appearance depicted in Figure 12 It can be seen that the Buffer column is filled up with indices which map to the physical FlexRay message buffers The success of the operation can bee seen additionally on the deleted error report signs in the BA Report column please compare Figure 7 Communication Assignment _ Rootedet Teatodeat Teodet 2 Tear eose Teodat 1 estNodel L a CMEA fmi VAS ma 137R Annliccation nF 1 21rb Application Usa 2176 Application firnlD1 204 Application O56 fire C11 208 Application 051 __ E o To o T __ To _ Oo __ Buffer Assignment Errors 0 Warnings 0 Infos 0 7 Communication Task Assignment Errors 0 Warnings 0 Infos Figure 12 Communication Assignment assigend Buffers 5 2 6 3 Minimize Buffer Consumption If this option is checked DECOMSYS DESINGER PRO attempts to assign the same buffer to multiple frame triggerings By that way the consumption of the buffer use is reduced For this optimization it must be satisfied that the fram
43. arameter or some basic configuration is invalid TDDLL E UNDERFLOW The software queue is empty TDDLL E OFFLINE The COMMSTACK FlexRay controller state is not TDDLL E ONLINE 3 9 5 TDDLL_EmptyQueue 3 9 5 1 Synopsis TDDLL ReturnType TDDLL EmptyQueue TDDLL CtrlIDXType nCtrlIDX TDDLL FrameDscRefIDXType nFrameDscRefIDX Copyright DECOMSYS 2006 sA DECOMSYS F N API Documentation 3 9 5 2 Semantics This function discards all entries from a software queue 3 9 5 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on nFrameDscRefIDX Unique ID that identifies the frame whose queue entries should be discarded 3 9 5 4 Return Values Value Description TDDLL E OK The function was successfully finished 3 10Time Services Time services are used for reading time information out of the FlexRay controller configuration and actual state 3 10 1TDDLL_GetTime 3 10 1 1Synopsis TDDLL ReturnType TDDLL GetTime TDDLL CtrlIDXType nCtrlIDx TDDLL TickType pClusterTime TDDLL CycleType pCommCycle 3 10 1 2Semantics This function reads the actual time of the cluster a dedicated FlexRay controller is synchronized to NOTE If some value different from TDDLL_E OK is retuned the output parameters pClusterTime and pCommCycle are not written but left in their previous state HINT If the argument nCtriIDX is ensured to be constant TDDLL
44. available for further the COMMSTACK operations TDDLL S OFF The FlexRay controller was detected successfully and it is not synchronized to any FlexRay cluster TDDLL S_ON The FlexRay controller was detected successfully and it is synchronized to a FlexRay cluster 3 5 1 3 Parameters None 3 5 1 4 Return Values Value Description The COMMSTACK initialization was successfully performed 3 5 2 TDDLL_GetNumCtrl 3 5 2 1 Synopsis TDDLL CtrlIDXType TDDLL GetNumCtrl void 3 5 2 2 Semantics This function returns the number of FlexRay controllers the COMMSTACK has access to 3 5 2 3 Parameters None 3 5 2 4 Return Values Description Copyright DECOMSYS 2006 23 DECOMSYS F N API Documentation 3 5 3 TDDLL_SetConfig 3 5 3 1 Synopsis const TDDLL ConfigType TDDLL SetConfig const TDDLL ConfigType pNewConfig 3 5 3 2 Semantics This function sets a new configuration to be active The new configuration is set immediately after the function call without any delay 3 5 3 3 Parameters Value Description Pointer to a COMMSTACK configuration root entry 3 5 3 4 Return Values Value Description Address of the previously active configuration root entry 3 5 4 TDDLL_CtrlInit 3 5 4 1 Synopsis TDDLL ReturnType TDDLL CtrlInit TDDLL CtrlIDXType nCtrlIDX 3 5 4 2 Semantics This function initializes the registers and all buffers of a FlexRay controller passed as argument ac
45. ber shows whether the FlexRay controller ColdstartNoise startup mechanism completed under a noisy channel TDDLL ErrorSlotModeType This member holds the POC slot mode SlotMode TDDLL WakeupStatusType This member holds the FlexRay controller wakeup status WakeupStatus TDDLLStartupStateType This member holds the FlexRay controller startup state StartupState 3 3 2 TDDLL_FrameDscType This compound datatype holds the constant configuration data of a FlexRay frame that can be transmitted received by the user Additionally buffers are configured by the same datatype because all required information is stored within this datatype This datatype is usually created within the COMMSTACK Copyright DECOMSYS 2006 si DECOMSYS F N API Documentation Member Description void pExtendedConfig This member is a pointer to an extended configuration structure if this is necessary for the buffer configuration of some vendor specific FlexRay controller type If no extended configuration is required this member must contain NULL const TDDLL QueueDscType This member is a pointer to a queue configuration pQueueDsc structure for the frame If no queue is assigned to this frame this member must contain NULL const TDDLL_PoolDscType This member is a pointer to the bufferpool configuration pPoolDsc structure of the bufferpool this frame is assigned to If no bufferpool is assigned to the frame this member must contain NULL uint32 nFrameSig
46. bortTxFrameByID CtrliIDxType TDDLL_ FrameDscRefIDxXType Copyright DECOMSYS 2006 API Documentation TDDLL_ DoCtrilTransition This member holds a pointer to a vendor specific implementation of the API function TDDLL_ GetCtrlState This member holds a pointer to a vendor specific implementation of the API function TDDLL_RxFrameByID This member holds a pointer to a vendor specific implementation of the API function TDDLL_TxFrameByID This member holds a pointer to a vendor specific implementation of the API function TDDLL_ GetTime This member holds a pointer to a vendor specific implementation of the API function TDDLL_GetCycleLength This member holds a pointer to a vendor specific implementation of the API function TDDLL InterruptResetStatus This member holds a pointer to a vendor specific implementation of the API function TDDLL_ InterruptEnable This member holds a pointer to a vendor specific implementation of the API function TDDLL_ InterruptDisable This member holds a pointer to a vendor specific implementation of the API function TDDLL_ InterruptStatus This member holds a pointer to a vendor specific implementation of the API function TDDLL_GetPOCStatus This member holds a pointer to a vendor specific implementation of the API function TDDLL CheckTxFrameByID This member holds a pointer to a vendor specific implementation of the API function TDDLL Chec
47. called instead of TDDLLSetTimerAbs which consumes less runtime by saving one function call overhead 3 11 5 3Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on nMacroTick Communication cycle offset the timer should elapse in units of macroticks nRepCycle Communication cycle repetition value the timer should elapse Base communication cycle the absolute timer should elapse 3 11 5 4Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E_INVALID_IDX The given input parameter or some basic configuration is invalid Copyright DECOMSYS 2006 48 DECOMSYS F N API Documentation TDDLL ACCESS Some device specific error occurred when accessing the FlexRay communication controller 3 11 6TDDLL_SetTimerRel 3 11 6 1Synopsis TDDLL ReturnType TDDLL SetTimerRel TDDLL CtrlIDXType nCtrlIDx TDDLL TickType nMacroTick 3 11 6 2Semantics This function configures the relative timer of a FlexRay controller NOTES Incase the particular FlexRay controller doesn t support a relative timer TDDLL_E ACCESS is returned Q The relative timer always works in continuous mode HINT If the argument nCtriIDX is ensured to be constant TDDLL SetTimerRel_Static can be called instead of TDDLL_SetTimerRel which consumes less runtime by saving one function call overhead 3 11 6 3Parameters Value Desc
48. cess configuration is of type pre compile configuration In the COMMSTACK main configuration file dcsCstFr_ Cfg h two macros that select the correct COMMSTACK behavior for the selected target hardware architecture have to be defined Macro _TDDLL HEADER FILE DCSMAL SWAP_ selects the byte swapping implementation The following options are provided by the default COMMSTACK product swap implementation Description dcsMAL generic swap inline h inline implementation variant see chapter 6 3 1 of byte swapping functionality dcsMAL generic swap noinline h noinline implementation variant see chapter 6 3 1 of byte swapping functionality dcsMAL generic swap macro h macro implementation variant See chapter 6 3 1 of byte swapping functionality Macro _TDDLL HEADER FILE DCSMAL ALIGNMENT_ selects the alignment restrictions of the target hardware architecture the COMMSTACK is executed on An alignment restriction on memory accesses requires in general that the address an memory access occurs must be divisible by the access size with no remainder addr sizeof access 0 In case of an access restriction the COMMSTACK memory access function option forbid_unaligned is provided In case the target Copyright DECOMSYS 2006 73 D ECO MSYS F N COMMSTACK Configuration architecture requires no alignment restrictions addr sizeof access 0 the access function provided by option allow_unaligned shall be used
49. cific nDeviceListIndex FlexRay controller list of this generic FlexRay controller NOTE An entry of this type refers to a vendor specific FlexRay controller list entry of a list of the type TDDLL_ERAY10_CtrlListType or TDDLL_MFR4200_CtrlListType or TDDLL_MFR4300_CtrlListType 3 4 Basic Constants Basic constants are constants that are used by the COMMSTACK but are usually defined outside the COMMSTACK If these datatypes do not exist the COMMSTACK porter must define them for a proper COMMSTACK operation 3 4 1 NULL This constant should represent a pointer to an invalid memory location in most cases 0 The COMMSTACK uses NULL for checking arguments for validity and optional not used configuration options Copyright DECOMSYS 2006 To DECOMSYS F N API Documentation 3 5 Initialization amp Configuration Services Functions in this chapter are required for proper COMMSTACK initialization and configuration procedure before invoking any FlexRay operational functionality 3 5 1 TDDLL_Init 3 5 1 1 Synopsis TDDLL ReturnType TDDLL Init void 3 5 1 2 Semantics This function initializes the COMMSTACK and checks all connected FlexRay controllers for availability Initially the COMMSTACK FlexRay controller states are set to the following states depending on the detected state of the FlexRay controllers Condition TDDLL_S CTRL NOT AVAILABLE There was an error while accessing the FlexRay controller The device is not
50. controller uint16 nCHIValue This member holds the value to be written in the Freescale MFR4200 FlexRay controller register identified by the member nCHIOffset 4 1 2 Extensions There are no extensions specific to MFR4200 COMMSTACK implementation 4 2 Bosch ERAY 4 2 1 Datatypes 4 2 1 1 TDDLL_ERAY10_CtrlStateInfoType This compound datatype holds the FlexRay controller COMMSTACK state administrative information required per Bosch ERAY based FlexRay controller This datatype is required for static volatile memory allocation within the COMMSTACK configuration and COMMSTACK internal functionality but it is not required at the COMMSTACK user API Member Description TDDLL CtrlStateType This member holds the COMMSTACK FlexRay controller nCtrlState state uint16 sISRsave This member saves the enable disable state for all interrupt sources when emulating the global interrupt enable disable switch uint8 This member saves the state of the global interrupt sGlobalInterruptEnable enable disable switch 4 2 1 2 TDDLL_ERAY10_CtriListType This compound datatype holds the FlexRay controller hardware mapping information for a Bosch ERAY based FlexRay controller This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description FCAL_ERAY10_CtrlHandleType This member holds the hardware access port information nCtrlHandle t
51. cording to the current active COMMSTACK configuration data NOTE This function must be called in COMMSTACK controller state TDDLL_S CONFIG only Otherwise TDDLL_E BAD CONFIG is returned HINT If the argument nCtrlIDX is ensured to be constant TDDLL_Ctrllnit_Static can be called instead of TDDLL_Ctrllnit which consumes less runtime by saving one function call overhead 3 5 4 3 Parameters Value Description The FlexRay controller index this function should be performed on 3 5 4 4 Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E INVALID IDX The given input parameter or some basic configuration is invalid TDDLL E BAD CONFIG Some precondition for initializing the FlexRay communication Copyright DECOMSYS 2006 WDA DECOMSYS F N API Documentation controller is not met TDDLL_E ACCESS Some device specific error occurred when accessing the FlexRay communication controller 3 5 5 TDDLL_ConfigBuffer 3 5 5 1 Synopsis TDDLL ReturnType TDDLL ConfigBuffer CtrlIDXType nCtrlIDX TDDLL BufferIDXType nBufferID const TDDLL FrameDscType pBufferDsc 3 5 5 2 Semantics This function initializes a FlexRay buffer with a FlexRay buffer configuration of a dedicated FlexRay controller with all parameters passed as arguments NOTES QO This function must be caled in COMMSTACK controller states TDDLL S CONFIG TDDLL_S_OFF TDDLL S_ON or TDDLL S ONLINE only Otherwi
52. disabled by software TDDLL S ONLINE The FlexRay controller is synchronized to the network The buffer access for transmission and reception from API is enabled 3 2 4 TDDLL_CtriTransitionType This datatype is an enumerator used for the COMMSTACK FlexRay controller state transitions that can be performed for each distinct FlexRay controllers These transitions are required to change the COMMSTACK FlexRay controller state of a FlexRay controller Supported COMMSTACK FlexRay controller transitions by the datatype TDDLL CtrlTransitionType are listed in the following table Please refer to the COMMSTACK FlexRay controller state model in chapter 2 2 for a detailed description of COMMSTACK FlexRay controller transitions Value Description TDDLL T RESET Perform a hard reset on the FlexRay controller TDDLL ENTER CONFIG Enter the FlexRay controller config mode into state TDDLL S CONFIG TDDLL LEAVE CONFIG Leave the FlexRay controller config mode into state TDDLL S_ OFF TDDLL_T_ STARTUP Trigger a start communication request on a FlexRay controller TDDLL_T_ONLINE Set the COMMSTACK FlexRay controller state to TDDLL S ONLINE TDDLL_T_ OFFLINE set the COMMSTACK FlexRay controller state from TDDLL S ONLINE to TDDLL_ S ON TDDLL_T HALT Halt the FlexRay controller at the end of the current communication cycle TDDLL T ABORT Immediately abort communication and synchronization of the FlexRay controller TDDLL T WAKEUP
53. e modify it according to your compiler s inline syntax and provide a compiler specific implementation e g copy dcsMAL generic swap inline h to dcsMAL customCompiler swap inline h matching your compilers syntax Some compilers that automatically perform inlining on static functions and remove not used static functions during optimization from the target binary but don t support any syntactical function inlining might also accept the noinline implementation variant Finally a pure macro implementation macro is provided According to poor performance and potential data consistency problems this implementation should not be used in production code J 7 7 27 In case several alternative MAL FCAL implementations are provided inline noinline macro the DECOMSYS recommended implementation is inline Don t use the function implementation variant macro in production code 6 3 2 CPU Memory Access Configuration The MAL layer contains a library of macros that provide C syntax capabilities for the COMMSTACK implementation These capabilities are e aligned unaligned volatile 32 16 8 bit read write access e byte swapping for 16 32 bit words If your hardware architecture provides distinct assembler operations for byte swapping or memory access the compiler doesn t support the generic implementations might be replaced by inline assembler operations for performance reasons The COMMSTACK memory ac
54. e function call overhead 3 7 5 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on nFrameDscRefIDX Unique ID that identifies the frame the transmission request should be aborted of 3 7 5 4 Return Values Value Description The frame has been transmitted Error accessing the FlexRay controller operation not permitted TDDLL_E INVALID IDX The given input parameter or some basic configuration is invalid TDDLL_E OFFLINE The COMMSTACK FlexRay controller state is not TDDLL E ONLINE Copyright DECOMSYS 2006 33 DECOMSYS F N API Documentation 3 7 6 TDDLL_FreeBufferPool 3 7 6 1 Synopsis ReturnType TDDLL FreeBufferPool 3 7 6 2 Semantics This function releases buffers that were dynamically assigned for transmission but are not in use any more and puts them back into the pool of available buffers This function must be called periodically if buffer pooling was selected during buffer assignment alternatively TDDLL CheckTxFrameByID see chapter 3 7 4 can be called NOTE This function should be called periodically in case buffer pooling is used to ensure buffers are released from their temporary reservation Alternatively TDDLL_CheckTxFrameByID can be used for this job 3 7 6 3 Parameters None 3 7 6 4 Return Values Value Description Number of buffers that were freed to be available again 3 8 Reception Serv
55. e COMMSTACK user API Member Description uint32 This member holds some information on a message buffer nMessageBufferConfiguration configuration message buffer index on the System Memory side and offset to the message buffer data 4 3 2 Extensions There are no extensions specific to MFR4300 COMMSTACK implementation Copyright DECOMSYS 2006 53 D ECO MSYS 7 N CC Type Specific Extensions 4 4 Philips Rev1 FlexRay CC SJA2510 4 4 1 Datatypes 4 4 1 1 TDDLL_PHIP1_SlotControlType This enumerator is used to represent the Philips FlexRay controller Rev 1 as used within the SJA2510 MCU SCL mode Value Description TDDLL SLOTMODE RX The slot is used to receive data TDDLL SLOTMODE TX The slot is used to transmit data TDDLL SLOTMODE IGNORE The slot is not used anymore 4 4 1 2 TDDLL_PHIP1_CtrlStateInfoType This compound datatype holds the FlexRay controller COMMSTACK state administrative information required per Philips Rev1 FlexRay controller as contained in the SJA2510 MCU This datatype is required for static volatile memory allocation within the COMMSTACK configuration and COMMSTACK internal functionality but it is not required at the COMMSTACK user API Member Description TDDLL CtrlStateType This member holds the COMMSTACK FlexRay controller nCtrlState state uint16 SCLAIdx Index into memory allocated for SCL channel A where the SCL channel A for the dedicated FlexRay Controller starts As long as a si
56. e FlexRay communication controller 3 7 Transmission Services The transmission services mentioned in this chapter are required to perform a transmission on the FlexRay network 3 7 1 TDDLL_LookupTxFame 3 7 1 1 Synopsis TDDLL FrameDscRefIDXType TDDLL LookupTxFrame TDDLL CtrlIDXType nCtrlIDx TDDLL FrameIDType nFrameID TDDLL ChannelIDXType nChannel TDDLL CycleType nRepCycle TDDLL CycleType nBaseCycle Copyright DECOMSYS 2006 29 DECOMSYS F N API Documentation 3 7 1 2 Semantics This function returns a unique ID of the reception frame description structure identified by the arguments given NOTE The parameters given to this function must be constant expressions 3 7 1 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on The FlexRay frame identifier of the frame The FlexRay channel of the frame The cycle repetition value of the frame The base cycle of the frame 3 7 1 4 Return Values Description Unique identifier of the frame description structure of the transmission frame identified by the given arguments 3 7 2 TDDLL_TX_FRAME_TRIGGERING 3 7 2 1 Synopsis TDDLL FrameDscRefIDXType TDDLL TX FRAME TRIGGERING FrameTriggeringName 3 7 2 2 Semantics This function returns a unique ID of the reception frame description structure identified by frame triggering name given as argument NOTE This is a
57. e Post Compile configuration e Runtime configuration Pre Compile configuration has impacts on the COMMSTACK compilation process Using compiler switches this kind of configuration influences the COMMSTACK object code This kind of configuration is used for enabling disabling specific COMMSTACK features and setting the main hardware access properties of the COMMSTACK In Post Compile configuration the configuration doesn t affect the COMMSTACK binary data but the configuration data must be present at link time Certain constant tables that affect the runtime behavior of the COMMSTACK must be provided during linking process This kind of configuration is used for small hardware adaptations memory mapping reset configuration which enables a COMMSTACK library to be used flexible on a certain hardware design without recompilation Runtime configuration must be available at latest before COMMSTACK usage at runtime The application configuration which affects the runtime communication behavior of the COMMSTACK is configured this way This means that also any other process than the build process like RAM download or flashprogramming can be enabled to load the COMMSTACK application configuration In this chapter the COMMSTACK file structure is described as well as the configuration files to edit for target customization 6 1 COMMSTACK File Structure The COMMSTACK consists of a root directory that contains all source files and header files For
58. e triggerings sharing the same buffer have the same values for the type RX TX slot and the channel assigned but different values for the base cycle and cycle repetition so that conflicts in accessing the different frames via this single buffer are avoided Copyright DECOMSYS 2006 63 D ECO MSYS F N DESIGNER PRO Integration 5 2 6 4 Manual Buffer Assignment Beside the Automatic Buffer Assignment feature DECOMSYS DESINGER PRO offers the possibility for the manual buffer assignment This function includes the assignment of buffer pools For this feature first it is necessary to define the buffer pool which consists of a single buffer in the simplest case in the Manual BA tab of the Driver Configuration dialog The definition of the buffer pool can be done by Q Adding a name for the pool Enter the pool name in the Name field and pressing Create Adding the pool members Click on the Pool cell in the buffer information grid beneath the Manual BA tab of the buffer you want to add and select the target pool name from the appearing combobox Figure 13 shows an example for the definition of a buffer pool MyBufferPool Advanced Conliguration IF AM LOMMSTADCK FLEX LM JSLUNFI OMMET SICK Configuration amp Suffer Sssignment H Frame Triggerirgs CC Registers Auts B4 Manual BA Code Generction MyButterH ool r 1 N MyButferPool OO Multiple Buffer Pool Assicnment Meme fesign Cl
59. e use of TDDLL_RxFrameBylD and TDDLL_LookupRxFrame COMMSTACK API functions to receive the frame which is configured by the sixth line of the Communication Assignment grid in Figure 12 For calling the function the configuration parameters Slot 64 Channel A Cycle Repetition 1 and Base Cycle 0 are required In summary the code for receiving the considered frame has the following appearance Copyright DECOMSYS 2006 66 D ECO MSYS F N DESIGNER PRO Integration TDDLL ReturnType notatus TDDLL LengthType nlength const char aRxMsg PAYLOAD LENGTH nStatus TDDLL RxFrameByID 0 TDDLL LookupRxFrame 0 64 TDDLL CHA 1 O amp aRxMsg 0 J PAYLOAD LENGTH amp nLength The first parameter of TDDLL_RxFrameBylD and TDDLL_LookupRxFrame gives the interface the FlexRay controller is mapped to aRxMsg is the temporary message buffer for receiving the frame data nLength is the length of the frame actually received PAYLOAD_LENGTH gives the buffer size the frame is written to On success the function returns TDDLL_E_ OK 5 3 4 Example for receiving a frame using the TDDLL_RxFrameByID and TDDLL_RX_FRAME_TRIGGERING COMMSTACK API functions The following code illustrates the use of TDDLL_RxFrameByID and TDDLL_RX_FRAME_TRIGGERING COMMSTACK API functions to receive the frame which is configured by the sixth line of the Communication Assignment grid in Figure 12 For calling the function the configuration
60. ear Selected Assigns a baFfer bufer pao te rultinl Fame Figure 13 Manual BA Tab The next step consist of assigning the defined buffer pools to frame triggerings Hereby the name for the buffer pool must be entered in the Multiple Buffer Pool Assignment combobox then the multiple frame triggerings selected in the Communication Assignment grid by pressing the CTRL botton on the keyboard and selecting the appropriate lines in the Communication Assignment grid and last the button Assign be pressed 5 2 6 5 Code Generation When the buffer assignment step is finished it can be proceeded with generating the configuration files for an ECU This operation can also be done in the Advanced Configuration section of the Driver Config window in tab Code Generation First the output path for the files must be set The setting can be performed by calling the output directory selection dialog by clicking the button Code Output Path in the Advanced Configuration section After clicking this button a standard windows file open dialog appaers with which the user can set the output directory When the directory is set the files can be generated into it This function can be executed by clicking the Generate Code button in the Code Generation tab Figure 14 shows the Advanced Configuration section of the Driver Config window NOTE The Code Output Path button can be found right on the bottom of the Driver Config dialog and can bee s
61. een in Figure 7 Advanced Conligurahon COMMSTACEK FLEXCOM OSCCNFG COMMS TACK Configuration A A assignment cc Negis ers Aute DA Code Gencration COMMSTACK Code Code Path CilestDemna Figure 14 Code Generation Tab Copyright DECOMSYS 2006 64 D ECO MSYS F N DESIGNER PRO Integration The code generation procedure should produce the following files in the output diectory File Name Description desCstFr lt MCU Name gt Cfg h Contains pre processor definitions which maps generic COMMSTACK API functions to FlexRay controller specific ones dcsCstFr lt MCU Name gt Cfg c Contains initialization code for the FlexRay controller s and data structures describing the used FlexRay frames i e holding the assigned physical message buffer index dcsCstFr_ lt MCU_Name gt Memory Cfg c Contains data structures providing memory for the queued reception and transmission of messages and code for administrating the queues The above depicted source code files must be included with the application build process for the owning ECU which normally compiles the remaining COMMSTACK files the ECU application source files and the generated ECU configuration files to objects that are in turn linked to the executable for the target 5 2 6 6 Generate All Function With this feature the user has the ability to generate all COMMSTACK configuration files f
62. exRay controller state See chapter 3 2 3 for possible values 3 6 3 TDDLL_DoCtriTransition 3 6 3 1 Synopsis TDDLL CtrlStateType TDDLL DoCtrlTransition TDDLL CtrlIDXType nCtrlIDX CtrlTransitionType nTransition 3 6 3 2 Semantics This function triggers a COMMSTACK controller state machine transition and returns the current active COMMSTACK FlexRay controller state after triggering the transition NOTES Q This function actually evaluates the current COMMSTACK state by requesting the FlexRay controller state So this function is able to perform automatic state transitions as described in the state diagram before triggering the requested Q Ifa requested transition is not allowed in the current COMMSTACK FlexRay controller state the state machine doesn t leave its current state HINT If the argument nCtrlIDX is ensured to be constant TDDLL_DoCitrlTranistion_Static can be called instead of TDDLL_DoCtrlTransition which consumes less runtime by saving one function call overhead 3 6 3 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on nTransition The transition that should be triggered See chapter 3 2 4 for possible values 3 6 3 4 Return Values Value Description state The actual COMMSTACK FlexRay controller state See chapter 3 2 3 for possible values 3 6 4 TDDLL_GetPOCStatus 3 6 4 1 Synopsis TDDLL ReturnType
63. fied using bitmasks enabling to combine several interrupt sources into a single variable and operation Supported values for interrupt sources are described in the following table Value Description TDDLL_BM_ GLOBAL INTERRUPT This bitmask identifies the global interrupt enable switch for the FlexRay controller This bitmask identifies the FlexRay absolute timer interrupt TDDLL_BM RELATIVE TIMER INTERRUPT This bitmask identifies the FlexRay relative timer interrupt This bitmask identifies the FlexRay cycle start interrupt 3 2 16TDDLL_POCStateType This enumerator is used to represent the FlexRay controller POC state see FlexRay specification type T POCState Value Description The POC state of the FlexRay controller is CONFIG TDDLL_POCSTATE DEFAULT CONFIG The POC state of the FlexRay controller is DEFAULT_CONFIG TDDLL_ cal pa HALT The POC state of the The POC state of the FlexRay controller is HALT controller is HALT TDDLL _ _NORMAL ACTIVE The state of the FlexRay controller NORMAL_ACTIVE TDDLL_POCSTATE NORMAL PASSIVE The POC state of the FlexRay controller is NORMAL_PASSIVE The POC state of the FlexRay controller is READY The POC state of the FlexRay controller is STARTUP The POC state of the FlexRay controller is WAKEUP 3 2 17TDDLL_SlotModeType This enumerator is used to represent the FlexRay controller POC slot mode see FlexRay specification ty
64. function like macro the argument has to be a string that maps exactly a frame triggering name as specified in the communication model 3 7 2 3 Parameters Value Description Name of the frame triggering to transmit 3 7 2 4 Return Values Description Unique identifier of the frame description structure of the transmission frame identified by the given arguments Copyright DECOMSYS 2006 30 DECOMSYS F N API Documentation 3 7 3 TDDLL_TxFrameByID 3 7 3 1 Synopsis TDDLL ReturnType TDDLL TxFrameByID TDDLL CtrlIDXType nCtrlIDX TDDLL FrameDscRefIDXType nFrameDscRefIDX const void pData TDDLL LengthType nLength 3 7 3 2 Semantics This function transmits the payload data given within a particular FlexRay frame on a distinct FlexRay controller All parameters are passed as arguments A transmission is carried out in FlexRay controller state TDDLL_E ONLINE only NOTES QO There is always an even number of bytes transmitted on the FlexRay bus If the payload length nLength is odd one byte extends the payload transmitted on the FlexRay bus This byte stuffed is set to TDDLL_PAYLOAD_PADDING_PATTERN Q Ifa frame belongs to the static FlexRay segment the payload length must be smaller than or equal to the static payload length of the cluster configuration In case the payload length passed at the API is smaller than the static payload length of the cluster the frame is filled with TDDLL_PAYLOAD_PADDING_PATTERN
65. ges the operation mode of a FlexRay buffer identified by nFrameDscRefIDx into mode specified by nSlotType on FlexRay Controller nCtr1lIDxX This Function operates immediately on the SCL element bitfield Control used by the dedicated FlexRay frame 4 4 2 1 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on Unique ID that identifies the frame to be controlled Type Ignore Rx Tx the FlexRay slot should be set to 4 4 2 1 4 Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E INVALID IDX The given input parameter or some basic configuration is invalid Copyright DECOMSYS 2006 57 D ECO MSYS F N DESIGNER PRO Integration 5 DESIGNER PRO Integration The COMMSTACK API is based on application dependent configuration data which must exist for any application The configuration data are represented by C source code and mainly consists of data structures used for initializing the FlexRay hardware and on the other hand for supporting the message exchange over the FlexRay communication system As in general the manually creation of these configuration data is quite a complex task there is convenient code generator support for this purpose This tool support is implemented with DECOMSYS DESIGNER PRO The following sections give instructions on how DESIGNER PRO can be used to generate the COMMSTACK configuration f
66. gnment CC Registers Auto Ja Manual DA Code Gereration Communication controller register corfiguraton Figure 10 CC Registers Tab When pressing the Edit button the Entity View opens in edit mode with communication controller selected in the Selector Panel of the Driver Configuration window After changing any register values with the Entity View the Validate button can be pressed to check the modified parameters Copyright DECOMSYS 2006 62 D ECO MSYS F N DESIGNER PRO Integration NOTE This feature is useful in particular for the advanced configuration of the communication controllers 5 2 6 2 Automatic Buffer Assignment To enable the controller to receive and transmit the defined frames the physical FlexRay message buffers must be configured accordingly This developing step is also named as Buffer Assignment There is the possibility to let the DESIGNER PRO to do the buffer assignment automatically by using the Automatic Buffer Assignment feature This function can be executed by clicking on the Generate button in the Auto BA tab Advanced Configuration section of the Driver Configuration dialog Figure 11 shows a screenshot of the focused Auto BA tab Advanced Conliguration COMMSTACEK FLEXCOM OSCONFIG COMMS TACK Config ration RuFFer 4ssignment CC Megis ers Auto BA OA Code Generaton Aubomatic BufFer Assignment mnmee suffer Consumption L4ssign one bukker bo
67. h_ that completely removes the overhead of CC type evaluation at runtime This saves code memory as well as execution time 6 3 3 1 MFR4200 access configuration MFR4200 FlexRay CC access configuration has to be done setting the compiler switch _TDDLL_ HEADER FILE MFR4200 ACCESS _ in file dcsCstFr_Cfg h to one of the following values MFR4200 access option Description lt dcsCstFr_FCAL mfr4200 mmap See Figure 15 for a detailed description _access be h gt lt dcesCstFr_ FCAL mfr4200 mmap See Figure 16 for a detailed description _access le straight h gt lt dcsCstFr_ FCAL mfr4200 mmap See Figure 17 for a detailed description _access le swapped h gt This configuration item takes into account that the data representation of CPU and the FlexRay communication controller might be different There are three common methods for connecting a 16 bit communication controller depending on the data bus connection and the data representation of the host CPU The following examples show the supported connections to a memory mapped 16 bit MFR4200 communication controller CC with big endian data representation In the following figures we assume the host CPU and the CC having the same notation regarding the bit numbering Isb D0 msb D15 DO DO CPU D7 D7 MFR4200 CC Big Endian D8 D8 Big Endian D15 D15 Figure 15 CPU BE straight connection CC BE If both data bus participants have the
68. his datatype is used for different virtual registers there was an abstract member name choosen uint32 Register2 This is the second register within an virtual register list element Since this datatype is used for different virtual registers there was an abstract member name choosen 4 4 1 6 TDDLL_PHIP1_FrameBufferType This compound datatype holds the framebuffer header part used in a Philips Rev1 FlexRay controller as contained in the SJA2510 MCU This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Copyright DECOMSYS 2006 56 D ECO MSYS 7 N CC Type Specific Extensions Member Description This member holds the message buffer status bit virtual register uint32 HeaderPartl This member holds the message buffer header part1 virtual register uint32 HeaderPart2 This member holds the message buffer header part2 virtual register This member holds the first payload virtual register word 4 4 2 Extensions COMMSTACK implementation for PHIP1 FlexRay controller provides one additional API function which is available for this FlexRay CC COMMSTACK implementation only 4 4 2 1 TDDLL_SetSlotControl_PHIP1 4 4 2 1 1 Synopsis TDDLL ReturnType TDDLL SetSlotControl PHIP1 TDDLL CtrlIDXType nCtrlIDx TDDLL FrameDscRefIDXType nFrameDscRefIDx PHIP1 SlotControlType nSlotType 4 4 2 1 2 Semantics This function chan
69. his function initializes all FlexRay buffers according to the current active COMMSTACK configuration NOTES QO This function must be called in COMMSTACK controller states TDDLL S CONFIG TDDLL_S_ OFF TDDLL S_ON or TDDLL S ONLINE only Otherwise TDDLL_E BAD CONFIG is returned The buffer configuration during COMMSTACK FlexRay controller states TDDLL_S OFF TDDLL_S_ ON and TDDLL_S ONLINE strongly depend on hardware facilities If some reconfiguration option is not possible at the current COMMSTACK state because of some hardware restrictions TDDLL_E BAD CONFIG is returned 3 5 6 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on 3 5 6 4 Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E INVALID IDX The given input parameter or some basic configuration is invalid TDDLL_E BAD CONFIG some precondition for initializing the FlexRay communication buffer is not met TDDLL_E ACCESS Some device specific error occurred when accessing the FlexRay communication controller 3 6 Status Information Services Functions within this chapter are required for reading and activating the states of the COMMSTACK FlexRay controller states and the FlexRay controller states as provided by the hardware Copyright DECOMSYS 2006 26 DECOMSYS F N API Documentation 3 6 1 TDDLL_IsSync 3 6 1 1 Synopsis TDDLL BooleanType TDD
70. ices The reception services mentioned in this chapter are required to perform a receive operations on the FlexRay network 3 8 1 TDDLL_LookupRxFrame 3 8 1 1 Synopsis TDDLL FrameDscRefIDXType TDDLL LookupRxFrame TDDLL CtrlIDXType nCtrlIDX TDDLL FrameIDType nFrameID TDDLL ChannelIDXType nChannel TDDLL CycleType nRepCycle TDDLL CycleType nBaseCycle 3 8 1 2 Semantics This function returns a unique ID of the reception frame description structure identified by the arguments given NOTE The parameters given to this function must be constant expressions 3 8 1 3 Parameters Value Description Copyright DECOMSYS 2006 34 DECOMSYS F N API Documentation nCtrlIDX The FlexRay controller index of the controller this function should be performed on The FlexRay frame identifier of the frame The FlexRay channel of the frame The cycle repetition value of the frame The base cycle of the frame 3 8 1 4 Return Values Value Description Value Unique identifier of the frame description structure of the reception frame identified by the given arguments 3 8 2 TDDLL_RX_FRAME_TRIGGERING 3 8 2 1 Synopsis TDDLL FrameDscRefIDXType TDDLL RX FRAME TRIGGERING FrameTriggeringName 3 8 2 2 Semantics This function returns a unique ID of the reception frame description structure identified by frame triggering name given as argument NOTE This is a function like macro The argument has to be a string
71. iguration contains errors it displays a red sign if everything is ok a green sign Communication Task In case the frame is owned by the FlexCOM service this column shows the assigned communication task CT Report Reports information on the communication task assignment Communicaiton Task configuration To see a report the mouse must be dragged over Report the appropriate cell If the configuration contains errors it displays a red sign if everything is ok a green sign Shows the sending communication controller of the frame Shows the receiving communication controller of the frame Figure 8 Frame Attributes NOTES For the use of the COMMSTACK message API in order to uniquely identify a frame the controller interface must be considered additionally This is the cause why the COMMSTACK message API takes the controller interface in the parameter list see later in this chapter QO The red signs in the BA Report column indicate that there is no buffer assignment done yet 5 2 5 Assigning Queues Additionally each frame configured for reception or transmission can be equipped with a software queue which enables the usage of COMMSTACK queuing API functions chapter 3 9 The depth of each queue can be configured for each distinct frame A queue depth with size 0 disables queuing for the dedicated Frame triggering No memory will be required in this case For using the feature one has to go deep into the DESIGNER Pro
72. ion disables the interrupts selected by the sources passed as arguments NOTES QO The global interrupt source GLOBAL_INTERRUPT is global interrupt enable disable switch that is in serial connection to all the other interrupt lines which are parallel to each other In case an interrupt source not supported on a particular FlexRay controller is selected e g TDDLL_BM_RELATIVE_TIMER_INTERRUPT on MFR4200 no operation is carried out for this interrupt source HINTS QO The interrupt status of each interrupt source is independent from the enable disable state of the corresponding interrupt source The status might return an pending interrupt even if the interrupt source is disabled QO If the argument nCtriIDX is ensured to be constant TDDLL_InterruptDisable Static can be called instead of TDDLL_InterruptDisable which consumes less runtime by saving one function call overhead 3 11 2 3Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on Interrupt sources that should be disabled 3 11 2 4Return Values None 3 11 3TDDLL_InterruptStatus 3 11 3 1Synopsis TDDLL InterruptSrcType TDDLL InterruptStatus TDDLL CtrlIDXType nCtrlIDxX 3 11 3 2Semantics This function returns the status of all supported interrupt sources NOTES Copyright DECOMSYS 2006 46 DECOMSYS F N API Documentation Q The global interrupt source
73. is member holds a pointer to a vendor specific implementation of the API function TDDLL_CtrlIDxType TDDLL_ ConfigBuffer TDDLL BufferIDxXType const TDDLL FrameDcsType TDDLL CtrlStateType This member holds a pointer to a vendor specific pDoCtrlTransition implementation of the API function TDDLL CtrlIDXType Copyright DECOMSYS 2006 20 DECOMSYS F 1 TDDLL CtrlTransitionType TDDLL CtrlStateType pGetCtrlState TDDLL CtrlIDXType TDDLL ReturnType pRxFrameByID TDDLL CtrlIDXType FrameDscRefIDXType void TDDLL LengthType TDDLL LengthType TDDLL ReturnType pTxFrameByID TDDLL CtrlIDXType TDDLL FrameDscRefIDXType const void TDDLL LengthType TDDLL ReturnType pGetTime TDDLL CtrlIDXType TDDLL TickType TDDLL CycleType TDDLL ReturnType pGetCycleLength TDDLL CtrlIDXType TDDLL TickType void pInterruptResetStatus TDDLL CtrlIDXType TDDLL InterruptSrcType void pInterruptEnable CtrlIDXType TDDLL InterruptSrcType void pInterruptDisable TDDLL CtrlIDXType TDDLL InterruptSrcType TDDLL InterruptSrcType pInterruptStatus TDDLL_CtrliIDxType ReturnType pGetPOCStatus TDDLL_CtrlIDXType TDDLL POCStatusType TDDLL_ ReturnType pCheckTxFrameByID TDDLL_CtrlIDXType TDDLL_ FrameDscRefIDxXType TDDLL_ ReturnType pCheckTxFrameByID TDDLL CtrlIDXType TDDLL FrameDscRefIDXType TDDLL ReturnType pA
74. kTxFrameByIDPtr This member holds a pointer to a vendor specific implementation of the API function TDDLL AbortTxFrameByID 21 DECOMSYS F N API Documentation TDDLL ReturnType pSetTimerAbs This member holds a pointer to a vendor specific CtrlIDXType implementation of the API function TDDLL TickType uint8 uint8 TDDLL SetTimerAbs TDDLL ReturnType pSetTimerRel This member holds a pointer to a vendor specific TDDLL_CtrlIDxXType implementation of the API function TDDLL_ TickType TDDLL SetTimerRel TDDLL_ReturnType pRxFIFOFrame This member holds a pointer to a vendor specific TDDLL_Ctr1lIDXType implementation of the API function TDDLL_FrameIDType TDDLL_ RxFIFOFrame TDDLL ChannelIDxXType TDDLL CycleType void TDDLL LengthType TDDLL LengthType 3 3 8 TDDLL_CtriMappingType This compound datatype contains a mapping from a generic FlexRay controller to a vendor specific FlexRay controller implementation At the COMMSTACK user API an index into an array based on this datatype is required to access a generic FlexRay controller This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description TDDLL CtrlTypesType This member holds the vendor specific FlexRay controller nCtrlType implementation TDDLL CtrlIDXType This member holds the index within the vendor spe
75. lListType 22 50 TDDLL_MFR4200_ CtrlStateInfoType 50 TDDLL_MFR4300_ CtrlListType 53 TDDLL_MFR4300_ CtrlStateInfoType 52 TDDLL_NSToMacroticks 43 44 TDDLL PHIP1 CtrlListType 54 TDDLL PHIP1 CtrlStateInfoType 54 TDDLL_ PHIP1 FrameDsc_ ExtendedConfigType s55 TDDLL POCStateType 15 17 TDDLL POCStatusType 17 21 28 TDDLL PoolDscType 18 19 TDDLL_QueueDscType 18 TDDLL ReturnType 12 20 21 22 23 24 25 26 28 31 32 33 34 35 36 38 39 40 41 42 43 48 49 57 65 66 67 TDDLL RX FRAME TRIGGERING 35 TDDLL_RxFIFOFrameByID 36 TDDLL_RxFrameByID 21 35 36 66 67 68 TDDLL_RxFrameByIDQueued 18 39 40 TDDLL_ SetConfig 24 TDDLL_SetTimerAbs 22 48 TDDLL_ SetTimerRel 22 49 TDDLL_ SlotModeType 15 TDDLL StartupStateType 16 TDDLL _TickType 15 21 22 42 43 44 48 49 TDDLL_TimeType 15 43 44 TDDLL TX FRAME TRIGGERING 30 TDDLL_TxFrameByIDQ 21 31 65 66 TDDLL_TxFrameByIDQueued 18 38 39 TDDLL PHIP1 FrameBufferType 56 TDDLL PHIP1 RegisterType 55 TDDLL PHIP1 SlotControlType 54 TDDLL PHIP1 VirtualRegisterType 56
76. lexRay CC type of CC index 0 0 first MFR4200 in type specific list TDDLL CTRL TYPE ERAY10 FlexRay CC type of CC index 1 0 first ERAY10O in type specific list const TDDLL CtrlIDXType TDDLL NumCtrl 2 number of 1 In the example above the FlexRay CC with index 0 maps to an MFR4200 FlexRay CC type and FlexRay CC with index 1 to an ERAY10 FlexRay CC type implementation The number of FlexRay controllers as connected to the target hardware must be stored in the constant variable Copyright DECOMSYS 2006 80 D ECO MSYS F N COMMSTACK Configuration TDDLL NumCtrl As we will see soon each CC type has an own list mapping the devices to hardware resources The second parameter in the example above is the index into the device specific hardware resource list which is described next extern void CCO ResetFunction void const TDDLL MFR4200 Ctrl List 1 FCAL MFR4200 CtrlHandleType 0x80001800 CC base address CCO ResetFunction CC reset function const TDDLL CtrlIDXType TDDLL MFR4200 NumCtrl 1 MFR4200 _Ctr1StateInfoType TDDLL MFR4200 _CtrlStateList 1 With this example the first and only MFR4200 FlexRay CC is mapped to the memory base address 0x80001800 The hardware reset is provided by an external function CCO_ ResetFunction which must be registered for this device The absolute number of MFR4200 FlexRay CCs is defined in the c
77. lexRay controller buffer 4 2 2 Extensions There are no extensions specific to ERAY COMMSTACK implementation 4 3 Freescale MFR4300 4 3 1 Datatypes 4 3 1 1 TDDLL_MFR4300_CtrlStateInfoType This compound datatype holds the FlexRay controller COMMSTACK state administrative information required per Freescale MFR4300 FlexRay controller This datatype is required for static volatile memory allocation within the COMMSTACK configuration and COMMSTACK internal functionality but it is not required at the COMMSTACK user API Member Description TDDLL CtrlStateType This member holds the COMMSTACK FlexRay controller nCtrlState state uint16 sISRsave This member saves the enable disable state for all interrupt sources when emulating the global interrupt enable disable switch uint8 This member saves the state of the global interrupt sGlobalInterruptEnable enable disable switch Copyright DECOMSYS 2006 52 D ECO MSYS 7 N CC Type Specific Extensions 4 3 1 2 TDDLL_MFR4300_CtrlListType This compound datatype holds the FlexRay controller hardware mapping information for a Freescale MFR4300 FlexRay controller This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description FCAL MFR4300_CtrlHandleType This member holds the hardware access port information nCtrlHandle to the Freescale MFR4300 FlexRay controller acce
78. lid FlexRay cluster definition for the above depicted application setup that has either been created with DESIGNER PRO or imported via FIBEX or XCDEF importer into the DESIGNER PRO and that all prior configuration steps to the COMMSTACK configuration generation have been applied 5 2 2 Invocation of the Driver Configuration Plug In The required tool for the COMMSTACK configuration is the Driver Configuration Plug in of DESIGNER PRO The GUI window of this tool can be invoked by opening the Driver Config section in the OPERATION menu of DESIGNER PRO and by clicking the COMMSTACK item in it Figure 6 shows the opened Driver Config operation menu of DESIGNER PRO Figure 7 depicts the initial appearance of the Driver Configuration GUI window OPERATION Import Data ECU HW Refinement ECU SW Refinement Communication Schedule Driver Config E NM E COMMSTACK FLE COM E OSCONFIG Figure 6 DESIGNER PRO Operation Menu Copyright DECOMSYS 2006 59 D ECO MSYS F N DESIGNER PRO Integration Fig Divci Configuiatiun Selector l ECU Testcdci MCU To Modz12ontrolker MEU CC Testhodei Controller Communination Assignment Frame Taggernc Slot Ofect Service BA Report Conm Ta 2T Report Tx OC mos mos rene feie n Diiia lD 17A 111 3180 SApplivaliors A TesH ode T estude fws xp 8 0 amp eoe Teno
79. mulating the global interrupt enable disable switch uint8 This member saves the state of the global interrupt sGlobalInterruptEnable enable disable switch 4 1 1 2 TDDLL_MFR4200_CtriListType This compound datatype holds the FlexRay controller hardware mapping information for a Freescale MFR4200 FlexRay controller This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description FCAL MFR4200 CtrlHandleType This member holds the hardware access port information nCtrlHandle to the Freescale MFR4200 FlexRay controller void PctrlReset void This member holds pointer to a routine that performs a hardware platform dependent hard reset on the Freescale MFR4200 FlexRay controller If there is no way for performing the hardware reset by software this field must contain NULL 4 1 1 3 TDDLL_CHI_MFR4200_CommandType This compound datatype holds a register configuration value for a Freescale MFR4200 FlexRay controller This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Copyright DECOMSYS 2006 50 D ECO MSYS 7 N CC Type Specific Extensions Description uint16 nCHIOffset This member holds a FlexRay controller register address offset The offset is calculated from the base CHI address of a Freescale MFR4200 FlexRay
80. nd switches the controller into the startup state The CC performs an active or passive startup depending on the configuration During this transition the global interrupt source is disabled ctrl not This is the start state after COMMSTACK initialization TDDLL_Init if the CC is available not detected No transition can be invoked from this state Startup The FlexRay controller is in state Startup and tries to set up network communication active or passive depending on the configuration This transition aborts the startup procedure and changes immediately into the state During this transition the global interrupt source is disabled 1 If the startup was successfully the CC is synchronized to the cluster the state Startup is left to state On automatically evaluate the current state using API __ function TDDLL GetCtrl1State Copyright DECOMSYS 2006 8 DECOMSYS F 7 The CC is synchronized to the cluster The buffer access for communication of all COMMSTACK API functions is turned off This is the start state after COMMSTACK initialization TDDLL_Init if the CC is detected successfully and the cluster is synchronized Online The transition immediately switches the state machine into the state Online Halt The transition Halt immediately changes into the state Off and halts the FlexRay communication at the end of the current communication cycle During
81. ng the compiler switch _TDDLL_ HEADER FILE MFR4300 ACCESS _ in file dcsCstFr_Cfg h to one of the following values MFR4300 access option Description lt desCstFr_ FCAL mfr4300_mmap See Figure 21 for a detailed description _access be h gt lt dcesCstFr_FCAL_mfr4300 mmap See Figure 22 for a detailed description _access le straight h gt lt dcesCstFr_FCAL_mfr4300 mmap See Figure 23 for a detailed description _access le swapped h gt This configuration item takes into account that the data representation of CPU and the FlexRay communication controller might be different There are three common methods for connecting a 16 bit communication controller depending on the data bus connection and the data representation of the host CPU The following examples show the supported connections to a memory mapped 16 bit MFR4300 communication controller CC with big endian data representation In the following figures we assume the host CPU and the CC having the same notation regarding the bit numbering Isb D0 msb D15 Copyright DECOMSYS 2006 78 D ECO MSYS 7 N COMMSTACK Configuration DO DO CPU D7 D7 MFR4300 CC Big Endian D8 D8 Big Endian D15 D15 Figure 21 CPU BE straight connection CC BE If both data bus participants have the same data representation obviously there should be a 1 1 connection The more complex case occurs if the data representation differs Lets assume the
82. ngle FlexRay CC is used this index will be O uint16 SCLBIdx Index into memory allocated for SCL channel B where the SCL channel B for the dedicated FlexRay Controller starts As long as a single FlexRay CC is used this index will be O uint16 BCLIdx Index into memory allocated for BCL where the BCL for the dedicated FlexRay Controller starts As long as a single FlexRay CC is used this index will be uintl6 BDLIdx Index into memory allocated for BDL where the BDL for the dedicated FlexRay Controller starts As long as a single FlexRay CC is used this index will be uint32 sISRsave This member saves the enable disable state for all interrupt sources when emulating the global interrupt enable disable switch uint8 This member saves the state of the global interrupt sGlobalInterruptEnable enable disable switch 4 4 1 3 TDDLL_PHIP1_CtrlListType This compound datatype holds the FlexRay controller hardware mapping information for a Philips Rev1 FlexRay controller as contained in the SJA2510 MCU This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description Copyright DECOMSYS 2006 54 D ECO MSYS 7 N CC Type Specific Extensions FCAL PHIP1 CtrlHandleType This member holds the hardware access port information nCtrlHandle to the Philips Revi FlexRay controller as contained in the SJA2510 MCU access to the
83. nst TDDLL FrameDscType This member holds a pointer to a lookup pFrameLookupFct uint32 function that returns a pointer to a frame description structure by passing a frame signature const TDDLL FrameDscType const This member holds a pointer to an array of pFrameList pointers to frame description structures const TDDLL_CtrlDscType This member is an array of pointers each entry pCtrlTypeList TDDLL_ NUM CTRL TYPES pointing to an array of vendor specific controller description structures of type TDDLL CtrlDscType uintl6 nNumFrames This member holds the number of frames in array pointed to by member pFrameList TDDLL_ CtrlIDXType This member is an array that holds the nNumCtrlType TDDLL_NUM CTRL TYPES numbers of FlexRay controllers per vendor specific FlexRay controller type 3 3 7 TDDLL_APIListType This compound datatype holds the vendor specific FlexRay controller API function implementations This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description TDDLL ReturnType pCtrlInit This member holds a pointer to a vendor specific TDDLL CtrlIDXType implementation of the API function TDDLL CtrlInit TDDLL_ReturnType pCheckCtr1l This member holds a pointer to a vendor specific TDDLL_Ctr1lIDXType implementation of the non API function TDDLL CheckCtrl TDDLL ReturnType pConfigBuffer Th
84. nt a channel identifier Possible values for this datatype are provided by the symbolic constants TDDLL_CHA for identifying FlexRay channel A TDDLL CHB for identifying FlexRay channel B and TDDLL_CHAB for identifying FlexRay channel A and B 3 2 10TDDLL_CycleType This datatype is used for variables that are used to carry FlexRay cycle filtering information as the cycle repetition value or the base cycle The cycle repetition value states the period of a FlexRay frame in units of communication cycles The COMMSTACK provides cycle repetition values of 1 2 4 8 16 32 64 only The base cycle represents the offset in the cycle repetition interval Allowed values for the base cycle are 0 to Repetition cycle value 1 3 2 11 TDDLL_LengthType This datatype is used for variables that represent FlexRay payload length information 3 2 12TDDLL_BufferIDXType This datatype is used for variables that represent a buffer index that maps to a transmission reception resource of a FlexRay controller Copyright DECOMSYS 2006 1 DECOMSYS F N API Documentation 3 2 13TDDLL_TickType This type is used for variables that represent time in units of FlexRay macroticks 3 2 14TDDLL_TimeType This type is used for variables that represent time in units of nanoseconds 3 2 15TDDLL_Interrupt SourceType This datatype is used for variables that are able to hold interrupt sources supported by the FlexRay controller The interrupt sources are identi
85. o the Bosch ERAY based FlexRay controller void PctrlReset void This member holds pointer to a routine that performs a hardware platform dependent hard reset on the Bosch ERAY based FlexRay controller If there is no way for performing the hardware reset by software this field must contain NULL Copyright DECOMSYS 2006 51 D ECO MSYS 7 N CC Type Specific Extensions 4 2 1 3 TDDLL_CHI_ERAY10_CommandType This compound datatype holds a register configuration value for a Bosch ERAY based FlexRay controller This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description uint16 nCHIOffset This member holds a FlexRay controller register address offset The offset is calculated from the base CHI address of a Bosch ERAY based FlexRay controller uint32 nCHIValue This member holds the value to be written in the Bosch ERAY based FlexRay controller register identified by the member nCHIOffset 4 2 1 4 TDDLL_ERAY10_FrameDsc_ExtendedConfigType This compound datatype contains extended information that is required to configure the buffer of an ERAY based FlexRay controller This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description uint32 nWRHS3 This member holds the WRHS3 register value of an ERAY based F
86. ocumentation software queues The memory area assigned to the queue starts at this offset within the queue memory uint16 nPayloadLength This member holds the length of the maximum data payload for this queue in units of 16bits uint16 nQueueLength This member holds the number of entries the queue can store increased by 1 NOTE The memory required by a queue in units of sizeof uint16 bytes is calculated by 2 nPayloadLength 1 nQueueLengbth 3 3 4 TDDLL_PoolDscType This compound datatype is used for the constant configuration of a transmit bufferpool Transmit frames of the dynamic FlexRay segment that are assigned to a bufferpool share buffers among other frames assigned to the same bufferpool This can be useful for saving buffers when transmitting frames with low frequency This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description const TDDLL FrameDscType This member points to an array of consecutive buffer pPoolStart configurations assigned to the bufferpool uintl6 nBuffer This member holds the number of buffers assigned to the bufferpool uint16 nPoolAdminIndex This member is an index into an administrative memory assigned to bufferpooling The memory assigned to the bufferpool starts at this offset within the pooled administrative memory NOTE The memory required by a pool in units
87. of sizeof TDDLL_FrameDscType bytes is equal to the number of buffers assigned to that pool 3 3 5 TDDLL_CtriDscType This compound datatype contains the FlexRay controller global configuration data This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description Const TDDLL_FrameDscType This member holds a pointer to an array of configuration pBufferList structures for initial configuration of all buffers of this FlexRay controller const void pCHICommands This member holds a pointer to an array of configuration structures for initial generic register initialization of this FlexRay controller The type of the structure is defined by the vendor specific type of the FlexRay controller TDDLL_CHI_ MFR4200 CommandType TDDLL_CHI_ERAY10 CommandType Copyright DECOMSYS 2006 19 DECOMSYS F N API Documentation uint32 nFactorTime uintl6 nBuffer This member holds the number of buffers within the array the member pBufferList points to uint16 nComands This member holds the number of registers within the array the member pCHICommands points to 3 3 6 TDDLL_ConfigType This compound datatype holds the global COMMSTACK root configuration This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description co
88. on source code COMMSTACK MFR4200 implementation source code COMMSTACK MFR4300 implementation source code 6 2 COMMSTACK Feature Configuration Certain COMMSTACK features can be enabled disabled using compiler switches These switches have immediate impact on the COMMSTACK compilation process Disabled features are removed from the compilation process which optimizes memory and execution time consumption Copyright DECOMSYS 2006 70 D ECO MSYS F N COMMSTACK Configuration The COMMSTACK feature configuration is of type Pre Compile configuration Modifying these switches requires having a source code COMMSTACK distribution 6 2 1 COMMSTACK Feature Switches All COMMSTACK feature switches are implemented in the header file desCstFr_Cfg h All switches operate on a switch defined undefined basis This means that a feature is enables as soon as a key macro mapping to that feature is defined Enabling feature TDDLL_FEATURE_1_SWITCH would be implemented by setting the following source code line into file dcsCstFr_ Cfg h define TDDLL FEATURE 1 SWITCH Disabling feature TDDLL_FEATURE_1_ SWITCH is implemented by either leaving this line completely out of the file or setting the following source code line into file desCstFr_Cfg h undef TDDLL FEATURE 1 SWITCH The following table describes all available features that can be activated deceived using pre compile switches Switch Name Description TDDLL STATE CHECK SWITCH This switch enable
89. onstant variable TDDLL_MFR4200 NumCtrl const TDDLL ERAY10 Ctrl List 1 FCAL ERAY10 CtrlHandleType 0x80002800 CC base address NULL CC reset function const TDDLL CtrlIDXType TDDLL_ ERAY10 NumCtrl 1 ERAY10 _Ctr1StateInfoType TDDLL ERAY10 _CtrlStateList 1 The one and only ERAY10 FlexRay CC is mapped to the memory base address 0x80002800 There is no hardware reset provided for the ERAY10 FlexRay controller Therefore the reset function pointer has to be set to NULL The absolute number of ERAY10 FlexRay CCs is defined in the constant variable TDDLL_ERAY10 NumCtrl Please be aware that there is also some RAM required to store the actual COMMSTACK state for each FlexRay CC used Therefore an array the array size equals to the number of FlexRay CCs of the corresponding type owning the state variable has to be allocated for each FlexRay CC type The symbols allocating that memory are named TDDLL MFR4200 CtrlStateList and TDDLL ERAY10 CtrlStateList respectively Copyright DECOMSYS 2006 81 DECOMSYS F 7 Document Information Date Version Author Changes 30 05 2005 0 1 0 Markus Eggenbauer Initial version created based on doxygen output 22 06 2005 0 2 0 Markus Eggenbauer Updated according to final source code version 11 07 2005 18 08 2005 0 18 08 2005 06 09 2005 Michael Ziehensack Finalized for preliminary release version format spell check Markus Eggenbauer
90. or all ECUs in a single step provided the output directories for all ECUs have been set The function can be activated by clicking the Generate All button which can be seen in the Driver Configuration window depicted in Figure 7 5 3 Applying the COMMSTACK Configuration This section gives some examples on the implementation of the message functions on basis of the generated COMMSTACK configuration and from the point of view of ECU 1 TestNode 5 3 1 Example for sending a frame using the TDDLL_TxFrameByID and TDDLL_LookupTxFrame COMMSTACK API functions The following code illustrates the use of TDDLL_TxFrameBylD and TDDLL_LookupTxFrame COMMSTACK API functions to transmit the frame which is configured by the first line of the Communication Assignment grid in Figure 12 For calling the function the configuration parameters Slot 39 Channel A Cycle Repetition 1 and Base Cycle 0 are required In summary the code for sending the considered frame has the following appearance TDDLL ReturnType notatus const char aTxMsg PAYLOADLENGTH Example 1 nStatus TDDLL TxFrameByID 0 TDDLL LookupTxFrame 0 39 TDDLL CHA 1 O J4 lt MCU_Name gt is the placeholder for the actual MCU name and is expanded on code generation Copyright DECOMSYS 2006 65 D ECO MSYS F N DESIGNER PRO Integration aTxMsg PAYLOAD LENGTH The first parameter of TDDLL_TxFrameBylD TDDLL_LookupTxFrame gi
91. or an application and how this data is utilized by the application later on 5 1 Use Case Assumption As a basis for the documentation the following use case is assumed There is an application consisting of 2 ECUs interconnected via a FlexRay network The FlexRay network consists of two communication channels For fault tolerant reasons all nodes are connected to both FlexRay channels Figure 4 illustrates the previous described hardware setup Channel A Channel B FlexRay FlexRay ECU 1 ECU 2 TestNode1 TestNode2 Figure 4 Assuemd Hardware Setup ECU 1 sends in slot 39 and slot 111 on both channels ECU 2 receives all frames sent by ECU 1 ECU 2 sends in slot 64 and slot 120 on both channels ECU 1 receives all frames sent by ECU 2 Figure 5 illustrates the previous described communication setup Copyright DECOMSYS 2006 58 D ECO MSYS F N DESIGNER PRO Integration FlexRay FlexRay Identifier 39 Slot A Identifier 39 Slot B Identifier 111 Slot A 1 Identifier 111 Slot B ECU 2 TestNode1 Identifier 64 Slot A TestNode2 Identifier 64 Slot B Identifier 120 Slot A Identifier 120 Slot B gt gt gt gt Figure 5 Assumed Communication Setup 5 2 Generating the COMMSTACK Configuration 5 2 1 Assumption The description assumes that a Binary Object Repository file BOR file is available containing a va
92. pe T_SlotMode Copyright DECOMSYS 2006 15 DECOMSYS y N API Documentation Value Description The POC slot mode of the FlexRay controller is SINGLE TDDLL_SLOTMODE_ALL_ PENDING The POC slot mode of the FlexRay controller is ALL_PENDING The POC slot mode of the FlexRay controller is ALL 3 2 18TDDLL_ErrorModeType This enumerator is used to represent the FlexRay controller POC error mode see FlexRay specification type T_ErrorMode Value Description The error mode of the FlexRay controller POC is ACTIVE The error mode of the FlexRay controller POC is PASSIVE ERRORMODE_COMM_HALT The error mode of the FlexRay controller POC is COMM_HALT 3 2 19TDDLL_WakeupStatusType This enumerator is used to represent the FlexRay controller wakeup status see FlexRay specification type T_WakeupStatus Value Description TDDLL WAKEUP_ UNDEFINED The wakeup status is UNDEFINED TDDLL WAKEUP RECEIVED HEADER The wakeup status is RECEIVED_HEADER TDDLL WAKEUP RECEIVED _ WUP The wakeup status is RECEIVED_WUP TDDLL WAKEUP COLLISION HEADER The wakeup status is COLLISION_HEADER TDDLL WAKEUP COLLISION WUP The wakeup status is COLLISION_WUP TDDLL WAKEUP COLLISION UNKNOWN The wakeup status is COLLISION_UNKNOWN TDDLL WAKEUP TRANSMITTED The wakeup status is TRANSMITTED 3 2 20TDDLL_StartupStateType This enumerator is used to represent the FlexRay controller startup substate see FlexRay specification ty
93. pe T_StartupState Value Description A AE TDDLL STARTUP COLDSTART LISTEN The startup substate is COLDSTART_LISTEN TDDLL STARTUP INTEGRATION COLDSTART CHE The startup substate is CK COLDSTART_CHECK 16 Copyright DECOMSYS 2006 DECOMSYS F N API Documentation TDDLL STARTUP _ COLDSTART_ JOIN The startup substate is COLDSTART_JOIN TDDLL STARTUP COLDSTART COLLISION RESOL The startup substate is COLDSTART_COLLISION_RESOLUTIO N TDDLL_ STARTUP _COLDSTART CONSISTENCY CHE The startup substate is CK COLDSTART_CONSISTENCY_CHECK TDDLL STARTUP INTEGRATION LISTEN The startup substate is INTEGRATION_LISTEN TDDLL STARTUP INITIALIZE SCHEDULE The startup substate is INITIALIZE SCHEDULE TDDLL_STARTUP_INTEGRATION CONSISTENCY C The startup substate is INTEGRATION CONSISTENCY CHECK TDDLL STARTUP COLDSTART GAP The startup substate is COLDSTART_GAP 3 3 Structure Data Types 3 3 1 TDDLL_POCStatusType This compound datatype represents the FlexRay controller POC status see FlexRay specification type T_POCStatus This datatype is intended to be used at the COMMSTACK user API Member Description This member holds the FlexRay controller POC state TDDLL BooleanType Freeze This member shows whether the FlexRay POC has entered the halt state due to an error condition TDDLL BooleanType This member shows whether a CHI halt request was CHIHaltRequest performed on the FlexRay controller TDDLL BooleanType This mem
94. red when accessing the FlexRay communication controller TDDLL E UNDERFLOW The FlexRay controller received no frame TDDLL E OVERFLOW The software queue is already filled TDDLL E OFFLINE The COMMSTACK FlexRay controller state is not TDDLL E ONLINE 3 9 3 TDDLL_TxFrameByIDQueued 3 9 3 1 Synopsis ReturnType TDDLL TxFrameByIDQueued TDDLL CtrlIDXType nCtrlIDX TDDLL FrameDscRefIDXType nFrameDscRefIDX const void pData TDDLL LengthType nLength Copyright DECOMSYS 2006 39 DECOMSYS F N API Documentation 3 9 3 2 Semantics This function puts payload data into a distinct frames software queue for transmission The frame is transmitted out of the software queue with the function TDDLL_FlushTxQueue see chapter 3 9 1 This operation is carried out in FlexRay controller state TDDLL_E ONLINE only NOTES There is always an even number of bytes transmitted on the FlexRay bus If the payload length nLength is odd one byte extends the payload transmitted on the FlexRay bus This byte stuffed is set to TDDLL_PAYLOAD_PADDING_ PATTERN lf a frame belongs to the static FlexRay segment the payload length must be smaller than or equal to the static payload length of the cluster configuration In case the payload length passed at the API is smaller than the static payload length of the cluster the frame is filled with TDDLL_PAYLOAD_ PADDING PATTERN up to the static payload length in case TDDLL_STATIC_ PAYLOAD PADDING
95. ried out in FlexRay controller state TDDLL_E ONLINE only NOTES Q Only syntactically valid frames containing data are received with this API function QO The data bytes are stored in memory in the same order the bytes were received on the FlexRay bus The byte at address pData was received first on the bus the byte at pData 1 second and so on QO There is no alignment restriction required for the data location pointed to by pData HINT If the arguments nCtrilDX and pFrameDsc are ensured to be constant TDDLL_RxFIFOFrame_Static can be called instead of TDDLL_RxFIFOFrame which consumes less runtime by saving one function call overhead 3 8 4 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on pnFrameID Pointer to a storage location the frame identifier of the received frame is written to pnChannel Pointer to a storage location the channel the frame was received on is written to pnCycle Pointer to a storage location the cycle value the frame was received in is written to Pointer the payload data received is written to nRxBufferLength Length of the buffer pData points to in units of bytes There is never more payload written to pData than specified by nRxBufferLength pnReceivedLength Length of the payload actually received in units of bytes If there are more bytes received than the buffer is able to store nRxBufferLength the payload data is tr
96. ription nCtrlIDX The FlexRay controller index of the controller this function should be performed on nMacroTick Communication cycle offset the timer should elapse in units of macroticks 3 11 6 4Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E INVALID IDX The given input parameter or some basic configuration is invalid TDDLL_E ACCESS Some device specific error occurred when accessing the FlexRay Communication controller Copyright DECOMSYS 2006 49 D ECO MSYS 7 N CC Type Specific Extensions 4 CC Type Specific Extensions This chapter describes FlexRay CC implementation specific extensions that are supported by special purpose API functions that are available in a generic style Additionally CC implementation specific datatypes are described in this chapter 4 1 Freescale MFR4200 4 1 1 Datatypes 4 1 1 1 TDDLL_MFR4200_CtrlStateInfoType This compound datatype holds the FlexRay controller COMMSTACK state administrative information required per Freescale MFR4200 FlexRay controller This datatype is required for static volatile memory allocation within the COMMSTACK configuration and COMMSTACK internal functionality but it is not required at the COMMSTACK user API Member Description TDDLL CtrlStateType This member holds the COMMSTACK FlexRay controller nCtrlState state uint16 sISRsave This member saves the enable disable state for all interrupt sources when e
97. ription nCtrlIDX The FlexRay controller index of the controller this function should be performed on pCommCycleLength Pointer to a storage location the current communication cycle length in units of macroticks is written to 3 10 2 4Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E INVALID IDX The given input parameter or some basic configuration is invalid TDDLL_E_ ACCESS Some device specific error occurred when accessing the FlexRay communication controller 3 10 3TDDLL_NSToMacroticks 3 10 3 1Synopsis TDDLL TickType TDDLL NSToMacroticks TDDLL CtrlIDXType nCtrlIDx TDDLL TimeType nTime Copyright DECOMSYS 2006 43 DECOMSYS F N API Documentation 3 10 3 2Semantics This function calculates time in units of nanoseconds into time in units of macroticks as configured for a dedicated FlexRay controller NOTE Please be aware that the value range of both units macroticks and nanoseconds are limited by the ranges of their datatypes This function doesn t check for occurring calculation overflows HINT If the argument nCtrilIDX is ensured to be constant TDDLL_NSToMacroticks_Static can be called instead of TDDLL_NSToMacroticks which consumes less runtime by saving one function call overhead 3 10 3 3Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on 3 10 3 4Return Values
98. s the synchronization of the COMMSTACK state at each API function invocation with the FlexRay CC This switch should be always enabled if you do dont have very special knowledge about the COMMSTACK implementation TDDLL_ARGUMENT CHECK SWITCH This switch enables an argument check of the validity of arguments given to COMMSTACK API functions Enabling this switch could help debugging during the development phase TDDLL_ QUEUEING SWITCH This switch enables the build process of the queuing API functions listed below TDDLL_RxFrameByIDQueued TDDLL_TxFrameByIDQueued TDDLL_ FlushTxQueue TDDLL_ Fil1lRxQueue TDDLL_ EmptyQueue TDDLL_BUFFERPOOLING SWITCH This switch enables the buffer pooling mechanism that enables the dynamic buffer assignment over a range of dynamic FlexRay frames If this switch is disabled the application configuration must not use this feature TDDLL_ FIFO SWITCH This switch includes the FIFO reception API function TDDLL_RxFrameByFIFO into the COMMSTACK build process TDDLL_INTERRUPTS SWITCH This switch includes the following interrupt handling API functions into the COMMSTACK build process TDDLL_ InterruptStatus TDDLL_InterruptResetStatus TDDLL_ InterruptEnable TDDLL_ InterruptDisable TDDLL_ABSOLUTE_ TIMER SWITCH This switch includes the absolute timer API function Copyright DECOMSYS 2006 71 D ECO MSYS F N COMMSTACK Configuration SetTimerAbs into the C
99. se TDDLL_E BAD CONFIG is returned The buffer configuration during COMMSTACK FlexRay controller states TDDLL_S OFF TDDLL_S_ ON and TDDLL_S ONLINE strongly depend on hardware facilities If some reconfiguration option is not possible at the current COMMSTACK state because of some hardware restrictions TDDLL_E BAD CONFIG is returned HINT If the argument nCtriIDX and pBufferDsc are ensured to be constant TDDLLConfigBuffer_Static can be called instead of TDDLL_ConfigBuffer which consumes less runtime by saving one function call overhead 3 5 5 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on nBufferID The FlexRay controller buffer index this function should be performed on The FlexRay buffer configuration that should be used by this function 3 5 5 4 Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E INVALID IDX The given input parameter or some basic configuration is invalid TDDLL_E BAD CONFIG Some precondition for initializing the FlexRay communication buffer is not met TDDLL_E ACCESS Some device specific error occurred when accessing the FlexRay Copyright DECOMSYS 2006 25 DECOMSYS F N API Documentation Communication controller 3 5 6 TDDLL_ConfigAl Buffers 3 5 6 1 Synopsis TDDLL ReturnType TDDLL ConfigAllBuffers TDDLL CtrlIDXType nCtrlIDX 3 5 6 2 Semantics T
100. ss to the controller s internal registers FCAL MFR4300_CtrlHandleType This member holds the hardware access port information nCtrlHandle DMA to the Freescale MFR4300 FlexRay controller access to the data stored in message buffers void PctrlReset void This member holds pointer to a routine that performs a hardware platform dependent hard reset on the Freescale MFR4300 FlexRay controller If there is no way for performing the hardware reset by software this field must contain NULL 4 3 1 3 TDDLL_CHI_MFR4300_CommandType This compound datatype holds a register configuration value for a Freescale MFR4300 FlexRay controller This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at the COMMSTACK user API Member Description uint32 nCHIOffset This member holds a FlexRay controller register address offset The offset is calculated from the base CHI address of a Freescale MFR4300 FlexRay controller uint16 nCHIValue This member holds the value to be written in the Freescale MFR4300 FlexRay controller register identified by the member nCHIOffset 1 1 1 TDDLL_MFR4300_FrameDsc_ExtendedConfigType This compound datatype contains extended information that is required to configure the buffer of a MFR4300 FlexRay controller This datatype is required within the COMMSTACK configuration and COMMSTACK internal functionality only but it is not required at th
101. st the COMMSTACK porter must define them for a proper COMMSTACK operation 3 1 1 uint8 This is an integral unsigned datatype that provides a value range of 8bit 0 to 255 decimal 3 1 2 uinti6 This is an integral unsigned datatype that provides a value range of 16bit to 65535 decimal 3 1 3 uint32 This is an integral unsigned datatype that provides a value range of 32bit to 4294967295 decimal 3 1 4 uint8_least This is an integral unsigned datatype that provides at least a value range of 8bit to 255 decimal but possibly more if this would improve execution performance on certain hardware 3 1 5 uint16_least This is an integral unsigned datatype that provides at least a value range of 16bit to 65535 decimal but possibly more if this would improve execution performance on certain hardware 3 1 6 uint32_least This is an integral unsigned datatype that provides at least a value range of 32bit to 4294967295 decimal but possibly more if this would improve execution performance on certain hardware 3 1 7 sint8 This is an integral signed datatype that provides a value range of 8bit 128 to 127 decimal 3 1 8 sint16 This is an integral signed datatype that provides a value range of 16bit 32768 to 32767 decimal Copyright DECOMSYS 2006 sile DECOMSYS F N API Documentation 3 1 9 sint32 This is an integral signed datatype that provides a value range of 32bit 2147483648 to 2147483647 decimal
102. stomer specifc interfaces must be provided which can implement as well a little endian databus interface semantic as well as a big endian datrabus interface semantic The COMMSTACK is prepared to cover most ERAY10 access variants for little endian ERAY10 databus interface implementations Please consult DECOMSYS if you need a solution provided for ERAY10 implementations offering a big endian databus interface Copyright DECOMSYS 2006 76 D ECO MSYS F N COMMSTACK Configuration ERAY10 FlexRay CC access configuration has to be done setting the compiler switch _TDDLL_ HEADER FILE ERAY10 ACCESS_ in file dcsCstFr_Cfg h to one of the following values ERAY10 access option Description lt dcsCstFr_FCAL 10_ _ See Figure 18 for a detailed description access32 le straight h gt lt dcsCstFr_FCAL_eray10_mmap_ See Figure 19 for a detailed description access32 be straight32 h gt lt dcsCstFr_FCAL eray10_mmap_ See Figure 20 for a detailed description access32 be straight16 h gt This configuration item takes into account that the data representation of CPU and the FlexRay communication controller might be different There are several common methods for connecting a 32 bit communication controller depending on the data bus width the data bus connection and the data representation of the host CPU The following examples show the supported connections to a memory mapped 32 bit ERAY10 communication controller CC with little
103. tI IDI 206_T2stode Cortrclle to Channel Ke Suspicious 1resFold U E39 Testcde2Cortrollerto Channel Rx Pre ndication Funcci fl ID84 TestNedelCortrole to Channel RE Queue Depth Member of buffars used For frane rece ve queue Eiker Jeet Dy plizale Create Rue Indicator Hook Fanzthor Hela Lloe oe Figure 9 Queue Depth Configuration 5 2 6 Advanced Configuration Panel In the Advanced Configuration panel of the Driver Configuration window the user has the ability for the advanced setup of the considered target service As this documentation is focused on the COMMSTACK itself and not on the services that are based on it the configuration of NM TP and FlexCOM are not discussed closer 5 2 6 1 Communication Controller Registers As already described earlier in this chapter the Driver Configuration Plug In of DESIGNER PRO generates initialization code for the FlexRay controllers In particular this initialization code consists of register settings for the communication controllers Usually the DESIGNER PRO calculates the register values independent of the cluster settings the message schedule and the used controller derivate With the CC Registers feature the user has the ability to influence the calculated register values Figure 10 shows the appearance of the selected CC Registers tab Advanced Conliguraton NM COMMSTACK FLEXCOM OSCCNFG COMMS TACK Configuration A FoFFer assi
104. this transition the global interrupt source is disabled Abort The transition Abort immediately changes into the state Off and immediately aborts the FlexRay communication During this transition the global interrupt source is disabled 1 If the synchronization is lost the transition to state Off is performed automatically evaluate the current state using API function TDDLL_GetCtr1State During this transition the global interrupt source is disabled Online The FlexRay controller is synchronized to the network and the software driver is activated to actively access buffers for transmission or reception Offline The transition immediately switches the state machine into the state On Halt The transition Halt immediately changes into the state Off and halts the FlexRay communication at the end of the current communication cycle During this transition the global interrupt source is disabled Abort The transition Abort immediately changes into the state Off and immediately aborts the FlexRay communication During this transition the global interrupt source is disabled 1 If the synchronization is lost the transition to Off is performed automatically evaluate the current state using API function TDDLL GetCtrl1State During this transition the global interrupt source is disabled Config The FlexRay controller is in configuration mode All configuration parameters can be changed
105. transmitted 3 9 1 4 Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E INVALID IDX The given input parameter or some basic configuration is invalid TDDLL_E_ ACCESS Some device specific error occurred when accessing the FlexRay communication controller TDDLL E UNDERFLOW The queue is empty TDDLL_E OVERFLOW The communication controller transmission resource buffer is busy TDDLL_E OFFLINE The COMMSTACK FlexRay controller state is not TDDLL E ONLINE Copyright DECOMSYS 2006 38 DECOMSYS F N API Documentation 3 9 2 TDDLL_FillRxQueue 3 9 2 1 Synopsis TDDLL ReturnType TDDLL FillRxQueue TDDLL CtrlIDXType nCtrlIDX TDDLL FrameDscRefIDXType nFrameDscRefIDX 3 9 2 2 Semantics This function received a frame from a FlexRay controller and puts it into a software queue The frame is fetched from the software queue with the function TDDLL_RxFrameByIDQueued see chapter 3 9 4 This operation is carried out in FlexRay controller state TDDLL_E ONLINE only 3 9 2 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on Unique ID that identifies the frame to be received 3 9 2 4 Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E INVALID IDX The given input parameter or some basic configuration is invalid TDDLL E ACCESS Some device specific error occur
106. uncated and the truncated part lost 3 8 4 4 Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E INVALID IDX The given input parameter or some basic configuration is invalid Copyright DECOMSYS 2006 37 DECOMSYS F N API Documentation TDDLL ACCESS Some device specific error occurred when accessing the FlexRay communication controller No valid frame was received by the FIFO TDDLL E OFFLINE The COMMSTACK FlexRay controller state is not TDDLL E ONLINE 3 9 Queue Services The queuing services can be used to decouple the strict synchronous access to the FlexRay controllers from the applications by introducing software queues The access functions to the FlexRay controller via these software queues are described within this chapter 3 9 1 TDDLL_FlushTxQueue 3 9 1 1 Synopsis TDDLL ReturnType TDDLL TxFrameByIDQueued TDDLL CtrlIDXType nCtrlIDX TDDLL FrameDscRefIDXType nFrameDscRefIDX 3 9 1 2 Semantics This function takes a frame out of a software queue and transmits it on a FlexRay controller The frame is put into the software queue with the function TDDLL TxFrameByIDQueued see chapter 3 9 3 This operation is carried out in FlexRay controller state TDDLL_E ONLINE only 3 9 1 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on unique ID that identifies the frame to be
107. up to the static payload length in case TDDLL_STATIC_PAYLOAD_PADDING_PATTERN_SWITCH is defined If TDDLL_STATIC_PAYLOAD_PADDING_PATTERN_SWITCH is not defined the frame is filled with random data up to the static payload length If a frame belongs to the dynamic FlexRay segment the payload length must not exceed the maximum payload length this distinct frame was configured to QO The data bytes are transmitted on the bus in the same order as the bytes are located in memory The byte at address pData is transmitted first on the bus the byte at pData 1 second and so on QO There is no alignment restriction required for the data location pointed to by pData HINT If the argument nCtrlIDX is ensured to be constant TDDLL_TxFrameBylID_Static can be called instead of TDDLL_TxFrameBylD which consumes less runtime by saving one function call overhead 3 7 3 3 Parameters Value Description nCtrlIDX The FlexRay controller index of the controller this function should be performed on Unique ID that identifies the frame to be transmitted Pointer to the payload data to be transmitted within the frame nLength Length of the payload data in units of bytes to be transmitted In the static segment the number of bytes to be transmitted must match the FlexRay static segment payload length of the cluster In the dynamic segment the payload length must not exceed the maximum payload length the FlexRay controller is able to Copyright DECOMSY
108. ves the interface number the FlexRay controller is mapped to alxMsg is the temporary message buffer containing the data for transmission In the shown example this is Example 1 PAYLOAD_LENGTH specifies the frame length On success the function returns TDDLL_E_ OK 5 3 2 Example for sending a frame using the TDDLL_TxFrameByID and TDDLL_TX_FRAME_TRIGGERING COMMSTACK API functions The following code illustrates the use of TDDLL_TxFrameBylID and TDDLL_TX_FRAME_TRIGGERING COMMSTACK API functions to transmit the frame which is configured by the first line of the Communication Assignment grid in Figure 12 For calling the function the configuration parameter Frame Triggering ft0_ID39 is required In summary the code for sending the considered frame has the following appearance TDDLL ReturnType notatus const char aTxMsg PAYLOADLENGTH Example 1 nStatus TDDLL TxFrameByID 0 TDDLL TX FRAME TRIGGERING ID39 aTxMsg PAYLOAD LENGTH The first parameter of TDDLL_TxFrameBylD gives the interface number the FlexRay controller is mapped to alxMsg is the temporary message buffer containing the data for transmission In the shown example this is Example 1 PAYLOAD_LENGTH specifies the frame length On success the function returns TDDLL_E OK 5 3 3 Example for receiving a frame using TDDLL_RxFrameByID and TDDLL_LookupRxFrame COMMSTACK API functions The following code illustrates th
109. y controller index of the controller this function should be performed on Unique ID that identifies the frame to be received Pointer the payload data received is written to nRxBufferLength Length of the buffer pData points to in units of bytes There is never more payload written to pData than specified by nRxBufferLength pnReceivedLength Length of the payload actually received in units of bytes If there are more bytes received than the buffer is able to store nRxBufferLength the payload data is truncated and the truncated part is lost 3 8 3 4 Return Values Value Description TDDLL E OK The function was successfully finished TDDLL_E INVALID IDX The given input parameter or some basic configuration is invalid TDDLL_E_ ACCESS Some device specific error occurred when accessing the FlexRay communication controller TDDLL E UNDERFLOW No valid frame was received TDDLL E OFFLINE The COMMSTACK FlexRay controller state is not TDDLL E ONLINE 3 8 4 TDDLL_RxFIFOFrameByID 3 8 4 1 Synopsis ReturnType TDDLL RxFIFOFrameByID TDDLL CtrlIDXType nCtrlIDX Copyright DECOMSYS 2006 36 DECOMSYS F N API Documentation TDDLL FrameIDType pnFrameID ChannelIDXType pnChannel TDDLL CycleType pnCycle void pData TDDLL LengthType nRxBufferLength TDDLL LengthType pnReceivedLength 3 8 4 2 Semantics This function fetches a frame from the FlexRay controller receive FIFO A reception is car

Download Pdf Manuals

image

Related Search

Related Contents

RESUMEN DE LAS CARACTERÍSTICAS DEL  2004 Infiniti G35 Coupe/Sedan  Samsung LD220HD Korisničko uputstvo  Notice d`utilisation  Operating Instructions  Benutzerhandbuch Rittal PMC USV 1-3kVA  EH1600L, EH800M, EH400H, LH1600C, LH800L  王 一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一  GWS Professional - Ferramentas Bosch  karel dt04 dect base unit technical reference & user's  

Copyright © All rights reserved.
Failed to retrieve file