ADTF_DEVICE_TOOLBOX  3.12.1 (ADTF 3.18.3)
flexray_frame.h
Go to the documentation of this file.
1 
17 #pragma once
18 
19 #include "flexray_types.h"
20 
24 namespace adtf
25 {
26 
30 namespace devicetb
31 {
32 
36 namespace sdk
37 {
38 
42 namespace flexray
43 {
44 
48 namespace axle
49 {
50 
51 #pragma pack(push, 1)
52 #ifdef WIN32
53  #pragma warning(disable : 4200)
54 #endif
55 
60 {
64  enum tFR_TAG
65  {
69  FR_TAG_PDU = 3,
70  FR_TAG_SYNC = 4
71  };
72 
76  enum tFR_FLAGS
77  {
78  FR_FLAG_STARTUP = 0x01,
79  FR_FLAG_SYNC = 0x02,
80  FR_FLAG_NFI = 0x04,
82  FR_FLAG_RESERVED = 0x10
83  };
84 
88  struct tCycleStart
89  {
91  };
92 
96  struct tFrame
97  {
98  uint8_t nFlags;
106  uint8_t nPayloadLength;
107  uint8_t aData[0];
108  };
109 
113  struct tPDU
114  {
118  uint8_t nPayloadLength;
119  uint8_t aData[0];
120  };
121 
125  struct tSync
126  {
127  };
128 
129  /*---- Structure member definition start ----*/
130  uint16_t nSize;
132  uint8_t nReserved;
133  int64_t nTimeStamp;
134 
135  enum { HEADER_SIZE = sizeof(uint16_t) + sizeof(uint32_t) + sizeof(uint8_t) + sizeof(int64_t) };
136 
137  union
138  {
139  tCycleStart sCycleStart; //<! ...
140  tFrame sFrame; //<! ...
141  tPDU sPDU; //<! ...
142  tSync sSync; //<! ...
143  };
144 
145  /*---- Structure member definition end ----*/
146 
154  static uint16_t GetStructureSize(tFR_TAG nTag, uint8_t nPayloadLength=0)
155  {
156  if (nTag == FR_TAG_CYCLESTART) { return HEADER_SIZE + sizeof(tCycleStart); }
157  else if (nTag == FR_TAG_FRAME) { return HEADER_SIZE + sizeof(tFrame) + nPayloadLength*sizeof(uint16_t); }
158  else if (nTag == FR_TAG_PDU) { return HEADER_SIZE + sizeof(tPDU) + nPayloadLength; }
159  else if (nTag == FR_TAG_SYNC) { return HEADER_SIZE + sizeof(tSync); }
160  else { return 0; }
161  }
162 };
163 
164 #ifdef WIN32
165  #pragma warning(default : 4200)
166 #endif
167 #pragma pack(pop)
168 
169 } //namespace axle
171 } //namespace flexray
172 } //namespace sdk
173 } // namespace devicetb
174 } // namespace adtf
Copyright 2024 CARIAD SE.
uint16_t tSlotID
FlexRay slot ID (1..2047)
Definition: flexray_types.h:96
uint32_t tPDUID
FlexRay PDU (Protocol Data Unit) ID.
Definition: flexray_types.h:98
uint8_t tCycleID
FlexRay cycle ID (0..63)
Definition: flexray_types.h:95
uint8_t tChannelID
FlexRay Cluster and Channel ID (FLEXRAY_CHANNEL_A, FLEXRAY_CHANNEL_B, FLEXRAY_CHANNEL_AB).
Definition: flexray_types.h:94
uint32_t tECUID
FlexRay ECU (Electronic Communication Unit) ID.
Definition: flexray_types.h:99
axle::tFlexRayData tFlexRayData
FlexDay data structured is used for storing and transmitting FlexRay data.
ADTF - Namespace.
uint8_t aData[0]
Start of variable sized payload.
uint8_t nFlags
See defintion of values tFR_FLAGS.
Definition: flexray_frame.h:98
uint8_t nPayloadLength
0..127 words == 0..254 bytes
uint8_t aData[0]
Start of variable sized payload.
tChannelID nChannel
See defintion of values FR_FLAG_xxx.
FlexDay data structured is used for storing and transmitting FlexRay data.
Definition: flexray_frame.h:60
tFR_TAG nTag
Tag of union (See tFR_TAG)
tFR_FLAGS
Enumeration of possible FlexRay flags.
Definition: flexray_frame.h:77
static uint16_t GetStructureSize(tFR_TAG nTag, uint8_t nPayloadLength=0)
Returns the size of this structure.
int64_t nTimeStamp
Hardware timestamp in µs.
uint8_t nReserved
Reserved for future use.
uint16_t nSize
Total size in bytes of this structure.
tFR_TAG
Enumeration of possible FlexRay tags.
Definition: flexray_frame.h:65