0% found this document useful (0 votes)
291 views50 pages

AURIX - Code - Examples - IfxCan.h at Master Infineon - AURIX - Code - Examples GitHub

Uploaded by

Apurv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
291 views50 pages

AURIX - Code - Examples - IfxCan.h at Master Infineon - AURIX - Code - Examples GitHub

Uploaded by

Apurv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

10/19/22, 4:33 PM AURIX_code_examples/IfxCan.

h at master · Infineon/AURIX_code_examples · GitHub

Infineon / AURIX_code_examples Public

Code Pull requests Actions Projects Security Insights


master

AURIX_code_examples / code_examples / Blinky_LED_1_KIT_TC375_SB / Libraries / iLLD /


TC37A / Tricore / Can / Std / IfxCan.h

MatteoVitturi
December 2020 release - total of 174 code examples


1
contributor

2546 lines (2079 sloc)



97.4 KB

1 /**
2 * \file IfxCan.h
3 * \brief CAN basic functionality
4 * \ingroup IfxLld_Can
5 *
6 * \version iLLD_1_0_1_12_0
7 * \copyright Copyright (c) 2019 Infineon Technologies AG. All rights reserved.
8 *
9 *
10 * IMPORTANT NOTICE
11 *
12 * Use of this file is subject to the terms of use agreed between (i) you or
13 * the company in which ordinary course of business you are acting and (ii)
14 * Infineon Technologies AG or its licensees. If and as long as no such terms
15 * of use are agreed, use of this file is subject to following:
16 *
17 * Boost Software License - Version 1.0 - August 17th, 2003
18 *
19 * Permission is hereby granted, free of charge, to any person or organization
20 * obtaining a copy of the software and accompanying documentation covered by
21 * this license (the "Software") to use, reproduce, display, distribute,
22 * execute, and transmit the Software, and to prepare derivative works of the
23 * Software, and to permit third-parties to whom the Software is furnished to
24 * do so, all subject to the following:
25 *
26 * The copyright notices in the Software and this entire statement, including
27 * the above license grant, this restriction and the following disclaimer, must
28 * be included in all copies of the Software, in whole or in part, and all
29 * derivative works of the Software, unless such copies or derivative works are

30 * solely in the form of machine-executable object code generated by a source


31 * language processor.

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/C… 1/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
32 *
33 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35 * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
36 * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
37 * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
38 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
39 * DEALINGS IN THE SOFTWARE.
40 *
41 *
42 *
43 *
44 * \defgroup IfxLld_Can_Std_Enum Enumerations
45 * \ingroup IfxLld_Can_Std
46 * \defgroup IfxLld_Can_Std_Data_Structures Data Structures
47 * \ingroup IfxLld_Can_Std
48 * \defgroup IfxLld_Can_Std_Node_Functions Node Functions
49 * \ingroup IfxLld_Can_Std
50 * \defgroup IfxLld_Can_Std_Tx_Element_Functions Tx Element Functions
51 * \ingroup IfxLld_Can_Std
52 * \defgroup IfxLld_Can_Std_Rx_Element_Functions Rx Element Functions
53 * \ingroup IfxLld_Can_Std
54 * \defgroup IfxLld_Can_Std_Filter_Functions Filter Functions
55 * \ingroup IfxLld_Can_Std
56 * \defgroup IfxLld_Can_Std_Interrupt_Functions Interrupt Functions
57 * \ingroup IfxLld_Can_Std
58 * \defgroup IfxLld_Can_Std_Module_Functions Module Functions
59 * \ingroup IfxLld_Can_Std
60 * \defgroup IfxLld_Can_Std_Tx_Event_FIFO_Element_Functions Tx Event FIFO Element Functions
61 * \ingroup IfxLld_Can_Std
62 */
63
64 #ifndef IFXCAN_H
65 #define IFXCAN_H 1
66
67 /******************************************************************************/
68 /*----------------------------------Includes----------------------------------*/
69 /******************************************************************************/
70
71 #include "_Impl/IfxCan_cfg.h"
72 #include "Cpu/Std/IfxCpu_Intrinsics.h"
73 #include "_Utilities/Ifx_Assert.h"
74 #include "_PinMap/IfxCan_PinMap.h"
75 #include "Scu/Std/IfxScuCcu.h"
76 #include "Src/Std/IfxSrc.h"
77
78 /******************************************************************************/
79 /*--------------------------------Enumerations--------------------------------*/
80 /******************************************************************************/
81

82 /** \addtogroup IfxLld_Can_Std_Enum


83 * \{ */

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/C… 2/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
84 /** \brief Status of warning limit for error counters in CAN node
85 */
86 typedef enum
87 {
88 IfxCan_CanNodeErrorWarningLimitStatus_notReached = 0, /**< \brief Error counters are below
89 IfxCan_CanNodeErrorWarningLimitStatus_reached = 1 /**< \brief Error counter reached th
90 } IfxCan_CanNodeErrorWarningLimitStatus;
91
92 /** \brief Clock selection option\n
93 * Description in Ifx_CAN.MCR.CLKSELx, (x = 0,1,2)
94 */
95 typedef enum
96 {
97 IfxCan_ClockSelect_0, /**< \brief clock selection 0 */
98 IfxCan_ClockSelect_1, /**< \brief clock selection 1 */
99 IfxCan_ClockSelect_2, /**< \brief clock selection 2 */
100 IfxCan_ClockSelect_3 /**< \brief clock selection 3 */
101 } IfxCan_ClockSelect;
102
103 /** \brief Type of Clock Source selection\n
104 * Description in Ifx_CAN.MCR.CLKSELx, (x = 0,1,2)
105 */
106 typedef enum
107 {
108 IfxCan_ClockSource_noClock = 0, /**< \brief No clock is switched on */
109 IfxCan_ClockSource_asynchronous = 1, /**< \brief The Asynchronous clock source is switched
110 IfxCan_ClockSource_synchronous = 2, /**< \brief The Synchronous clock source is switched
111 IfxCan_ClockSource_both = 3 /**< \brief Both clock sources are switched on */
112 } IfxCan_ClockSource;
113
114 /** \brief Data Field Size\n
115 * Definition in Ifx_CAN.N[x]TX.ESC.B.TBDS, Ifx_CAN.N[x].RX.ESC.B.RBDS, Ifx_CAN.N[x].RX.ESC.B.F
116 */
117 typedef enum
118 {
119 IfxCan_DataFieldSize_8, /**< \brief 8 byte data field */
120 IfxCan_DataFieldSize_12, /**< \brief 12 byte data field */
121 IfxCan_DataFieldSize_16, /**< \brief 16 byte data field */
122 IfxCan_DataFieldSize_20, /**< \brief 20 byte data field */
123 IfxCan_DataFieldSize_24, /**< \brief 24 byte data field */
124 IfxCan_DataFieldSize_32, /**< \brief 32 byte data field */
125 IfxCan_DataFieldSize_48, /**< \brief 48 byte data field */
126 IfxCan_DataFieldSize_64 /**< \brief 64 byte data field */
127 } IfxCan_DataFieldSize;
128
129 /** \brief Data Length code of the Message
130 */
131 typedef enum
132 {
133 IfxCan_DataLengthCode_0, /**< \brief 0 data bytes */

134 IfxCan_DataLengthCode_1, /**< \brief 1 data bytes */


135 IfxCan_DataLengthCode_2, /**< \brief 2 data bytes */

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/C… 3/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
136 IfxCan_DataLengthCode_3, /**< \brief 3 data bytes */
137 IfxCan_DataLengthCode_4, /**< \brief 4 data bytes */
138 IfxCan_DataLengthCode_5, /**< \brief 5 data bytes */
139 IfxCan_DataLengthCode_6, /**< \brief 6 data bytes */
140 IfxCan_DataLengthCode_7, /**< \brief 7 data bytes */
141 IfxCan_DataLengthCode_8, /**< \brief 8 data bytes */
142 IfxCan_DataLengthCode_12, /**< \brief 12 data bytes */
143 IfxCan_DataLengthCode_16, /**< \brief 16 data bytes */
144 IfxCan_DataLengthCode_20, /**< \brief 20 data bytes */
145 IfxCan_DataLengthCode_24, /**< \brief 24 data bytes */
146 IfxCan_DataLengthCode_32, /**< \brief 32 data bytes */
147 IfxCan_DataLengthCode_48, /**< \brief 48 data bytes */
148 IfxCan_DataLengthCode_64 /**< \brief 64 data bytes */
149 } IfxCan_DataLengthCode;
150
151 /** \brief Filter Element Configuration
152 */
153 typedef enum
154 {
155 IfxCan_FilterElementConfiguration_disable, /**< \brief Disable filter e
156 IfxCan_FilterElementConfiguration_storeInRxFifo0, /**< \brief Store in Rx FIFO
157 IfxCan_FilterElementConfiguration_storeInRxFifo1, /**< \brief Store in Rx FIFO
158 IfxCan_FilterElementConfiguration_rejectId, /**< \brief Reject ID if fil
159 IfxCan_FilterElementConfiguration_setPriority, /**< \brief Set priority if
160 IfxCan_FilterElementConfiguration_setPriorityAndStoreInFifo0, /**< \brief Set priority and
161 IfxCan_FilterElementConfiguration_setPriorityAndStoreInFifo1, /**< \brief Set priority and
162 IfxCan_FilterElementConfiguration_storeInRxBuffer /**< \brief Store into Rx Bu
163 } IfxCan_FilterElementConfiguration;
164
165 /** \brief Filter Type
166 */
167 typedef enum
168 {
169 IfxCan_FilterType_range, /**< \brief Range filter from SF1ID to SF2ID (SF2ID is greater
170 IfxCan_FilterType_dualId, /**< \brief Dual ID filter for SF1ID or SF2ID */
171 IfxCan_FilterType_classic, /**< \brief Classic filter: SF1ID = filter, SF2ID = mask */
172 IfxCan_FilterType_none /**< \brief Reserved */
173 } IfxCan_FilterType;
174
175 /** \brief CAN Frame mode\n
176 * Description in Ifx_CAN.N[x].CCCR.CME, (x= 0 to 3)
177 */
178 typedef enum
179 {
180 IfxCan_FrameMode_standard, /**< \brief Standard CAN frame (transmit and receive) */
181 IfxCan_FrameMode_fdLong, /**< \brief CAN FD long frame in transmit and CAN FD long a
182 IfxCan_FrameMode_fdLongAndFast /**< \brief CAN FD long and fast frames (transmit and recei
183 } IfxCan_FrameMode;
184
185 /** \brief CAN frame type

186 */
187 typedef enum

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/C… 4/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
188 {
189 IfxCan_FrameType_receive, /**< \brief Data frame is received */
190 IfxCan_FrameType_transmit, /**< \brief Data frame is generated */
191 IfxCan_FrameType_transmitAndReceive, /**< \brief for both transmit and receive frames */
192 IfxCan_FrameType_remoteRequest, /**< \brief Remote request frame is generated */
193 IfxCan_FrameType_remoteAnswer /**< \brief Answer frame is generated on reception of
194 } IfxCan_FrameType;
195
196 /** \brief Type of interrupt\n
197 * Definition in Ifx_CAN.N[x].IE, Ifx_CAN.N[x].IR, Ifx_CAN.N[x].ILS, (x= 0 to 3)
198 */
199 typedef enum
200 {
201 IfxCan_Interrupt_rxFifo0NewMessage, /**< \brief Rx FIFO 0 New Message Inter
202 IfxCan_Interrupt_rxFifo0WatermarkReached, /**< \brief Rx FIFO 0 Watermark Reached
203 IfxCan_Interrupt_rxFifo0Full, /**< \brief Rx FIFO 0 Full Interrupt */
204 IfxCan_Interrupt_rxFifo0MessageLost, /**< \brief Rx FIFO 0 Message Lost Inte
205 IfxCan_Interrupt_rxFifo1NewMessage, /**< \brief Rx FIFO 1 New Message Inter
206 IfxCan_Interrupt_rxFifo1WatermarkReached, /**< \brief Rx FIFO 1 Watermark Reached
207 IfxCan_Interrupt_rxFifo1Full, /**< \brief Rx FIFO 1 Full Interrupt */
208 IfxCan_Interrupt_rxFifo1MessageLost, /**< \brief Rx FIFO 1 Message Lost Inte
209 IfxCan_Interrupt_highPriorityMessage, /**< \brief High Priority Message Inter
210 IfxCan_Interrupt_transmissionCompleted, /**< \brief Transmission Completed Inte
211 IfxCan_Interrupt_transmissionCancellationFinished, /**< \brief Transmission Cancellation F
212 IfxCan_Interrupt_txFifoEmpty, /**< \brief Tx FIFO Empty Interrupt */
213 IfxCan_Interrupt_txEventFifoNewEntry, /**< \brief Tx Event FIFO New Entry Int
214 IfxCan_Interrupt_txEventFifoWatermarkReached, /**< \brief Tx Event FIFO Watermark Rea
215 IfxCan_Interrupt_txEventFifoFull, /**< \brief Tx Event FIFO Full Interrup
216 IfxCan_Interrupt_txEventFifoEventLost, /**< \brief Tx Event FIFO Event Lost In
217 IfxCan_Interrupt_timestampWraparound, /**< \brief Timestamp Wraparound Interr
218 IfxCan_Interrupt_messageRAMAccessFailure, /**< \brief Message RAM Access Failure
219 IfxCan_Interrupt_timeoutOccurred, /**< \brief Timeout Occurred Interrupt
220 IfxCan_Interrupt_messageStoredToDedicatedRxBuffer, /**< \brief Message stored to Dedicated
221 IfxCan_Interrupt_bitErrorCorrected, /**< \brief Bit Error Corrected Interru
222 IfxCan_Interrupt_bitErrorUncorrected, /**< \brief Bit Error Uncorrected Inter
223 IfxCan_Interrupt_errorLoggingOverflow, /**< \brief Error Logging Overflow Inte
224 IfxCan_Interrupt_errorPassive, /**< \brief Error Passive Interrupt */
225 IfxCan_Interrupt_warningStatus, /**< \brief Warning Status Interrupt */
226 IfxCan_Interrupt_busOffStatus, /**< \brief Bus_Off Status Interrupt */
227 IfxCan_Interrupt_watchdog, /**< \brief Watchdog Interrupt */
228 IfxCan_Interrupt_protocolErrorArbitration, /**< \brief Protocol Error in Arbitrati
229 IfxCan_Interrupt_protocolErrorData, /**< \brief Protocol Error in Data phas
230 IfxCan_Interrupt_AccessToReservedAddress /**< \brief Access to Reserved Address
231 } IfxCan_Interrupt;
232
233 /** \brief Type of interrupt\n
234 * Definition in Ifx_CAN.GRINT[x] (x= 0 , 1)
235 */
236 typedef enum
237 {

238 IfxCan_InterruptGroup_tefifo, /**< \brief Transmit Event FIFO Incidents */


239 IfxCan_InterruptGroup_hpe, /**< \brief High Priority Events */

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/C… 5/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
240 IfxCan_InterruptGroup_wati, /**< \brief Watermark interrupts are mapped here. */
241 IfxCan_InterruptGroup_alrt, /**< \brief Alerts */
242 IfxCan_InterruptGroup_moer, /**< \brief Module errors */
243 IfxCan_InterruptGroup_safe, /**< \brief Safety counter overflow */
244 IfxCan_InterruptGroup_boff, /**< \brief Bus Off */
245 IfxCan_InterruptGroup_loi, /**< \brief Last Error Interrupts */
246 IfxCan_InterruptGroup_reint, /**< \brief Message stored in dedicated receive buffer inter
247 IfxCan_InterruptGroup_rxf1f, /**< \brief Receive FIFO1 full interrupt */
248 IfxCan_InterruptGroup_rxf0f, /**< \brief Receive FIFO0 full interrupt */
249 IfxCan_InterruptGroup_rxf1n, /**< \brief Receive FIFO1 new message Interrupt */
250 IfxCan_InterruptGroup_rxf0n, /**< \brief Receive FIFO0 new message Interrupt */
251 IfxCan_InterruptGroup_reti, /**< \brief Receive timeouts */
252 IfxCan_InterruptGroup_traq, /**< \brief Transmission Queue Events */
253 IfxCan_InterruptGroup_traco /**< \brief Interrupts of the transmission control */
254 } IfxCan_InterruptGroup;
255
256 /** \brief Interrupt line number INT_Ox (x= 0 - 15) \n
257 */
258 typedef enum
259 {
260 IfxCan_InterruptLine_0, /**< \brief Interrupt Line 0 */
261 IfxCan_InterruptLine_1, /**< \brief Interrupt Line 1 */
262 IfxCan_InterruptLine_2, /**< \brief Interrupt Line 2 */
263 IfxCan_InterruptLine_3, /**< \brief Interrupt Line 3 */
264 IfxCan_InterruptLine_4, /**< \brief Interrupt Line 4 */
265 IfxCan_InterruptLine_5, /**< \brief Interrupt Line 5 */
266 IfxCan_InterruptLine_6, /**< \brief Interrupt Line 6 */
267 IfxCan_InterruptLine_7, /**< \brief Interrupt Line 7 */
268 IfxCan_InterruptLine_8, /**< \brief Interrupt Line 8 */
269 IfxCan_InterruptLine_9, /**< \brief Interrupt Line 9 */
270 IfxCan_InterruptLine_10, /**< \brief Interrupt Line 10 */
271 IfxCan_InterruptLine_11, /**< \brief Interrupt Line 11 */
272 IfxCan_InterruptLine_12, /**< \brief Interrupt Line 12 */
273 IfxCan_InterruptLine_13, /**< \brief Interrupt Line 13 */
274 IfxCan_InterruptLine_14, /**< \brief Interrupt Line 14 */
275 IfxCan_InterruptLine_15 /**< \brief Interrupt Line 15 */
276 } IfxCan_InterruptLine;
277
278 /** \brief Type of last error to occur on the CAN node
279 */
280 typedef enum
281 {
282 IfxCan_LastErrorCodeType_noError = 0, /**< \brief No Error occured in the recent CAN
283 IfxCan_LastErrorCodeType_stuffError = 1, /**< \brief More than 5 consecutive equal bits
284 IfxCan_LastErrorCodeType_formError = 2, /**< \brief Fixed format part of recieved frame
285 IfxCan_LastErrorCodeType_ackError = 3, /**< \brief No ACK recieved from another node f
286 IfxCan_LastErrorCodeType_bit1Error = 4, /**< \brief Transmitted recessive and read back
287 IfxCan_LastErrorCodeType_bit0Error = 5, /**< \brief Transmitted dominant and read back
288 IfxCan_LastErrorCodeType_crcError = 6, /**< \brief CRC Error */
289 IfxCan_LastErrorCodeType_noCANBusEvent = 7 /**< \brief No CAN bus event occured */

290 } IfxCan_LastErrorCodeType;
291

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/C… 6/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
292 /** \brief Message Id length (Standard / Extended)
293 */
294 typedef enum
295 {
296 IfxCan_MessageIdLength_standard, /**< \brief Standard Message ID */
297 IfxCan_MessageIdLength_extended, /**< \brief Extended Message ID */
298 IfxCan_MessageIdLength_both /**< \brief Both Standard and Extended message IDs */
299 } IfxCan_MessageIdLength;
300
301 /** \brief Indicate the action to be taken with the messages which do not match with any elemen
302 */
303 typedef enum
304 {
305 IfxCan_NonMatchingFrame_acceptToRxFifo0 = 0, /**< \brief Accept the non matching messages
306 IfxCan_NonMatchingFrame_acceptToRxFifo1 = 1, /**< \brief Accepts the non matching messages
307 IfxCan_NonMatchingFrame_reject = 2 /**< \brief Reject the non-matching messages
308 } IfxCan_NonMatchingFrame;
309
310 /** \brief Rx Buffer number
311 */
312 typedef enum
313 {
314 IfxCan_RxBufferId_0, /**< \brief Rx buffer 0 */
315 IfxCan_RxBufferId_1, /**< \brief Rx buffer 1 */
316 IfxCan_RxBufferId_2, /**< \brief Rx buffer 2 */
317 IfxCan_RxBufferId_3, /**< \brief Rx buffer 3 */
318 IfxCan_RxBufferId_4, /**< \brief Rx buffer 4 */
319 IfxCan_RxBufferId_5, /**< \brief Rx buffer 5 */
320 IfxCan_RxBufferId_6, /**< \brief Rx buffer 6 */
321 IfxCan_RxBufferId_7, /**< \brief Rx buffer 7 */
322 IfxCan_RxBufferId_8, /**< \brief Rx buffer 8 */
323 IfxCan_RxBufferId_9, /**< \brief Rx buffer 9 */
324 IfxCan_RxBufferId_10, /**< \brief Rx buffer 10 */
325 IfxCan_RxBufferId_11, /**< \brief Rx buffer 11 */
326 IfxCan_RxBufferId_12, /**< \brief Rx buffer 12 */
327 IfxCan_RxBufferId_13, /**< \brief Rx buffer 13 */
328 IfxCan_RxBufferId_14, /**< \brief Rx buffer 14 */
329 IfxCan_RxBufferId_15, /**< \brief Rx buffer 15 */
330 IfxCan_RxBufferId_16, /**< \brief Rx buffer 16 */
331 IfxCan_RxBufferId_17, /**< \brief Rx buffer 17 */
332 IfxCan_RxBufferId_18, /**< \brief Rx buffer 18 */
333 IfxCan_RxBufferId_19, /**< \brief Rx buffer 19 */
334 IfxCan_RxBufferId_20, /**< \brief Rx buffer 20 */
335 IfxCan_RxBufferId_21, /**< \brief Rx buffer 21 */
336 IfxCan_RxBufferId_22, /**< \brief Rx buffer 22 */
337 IfxCan_RxBufferId_23, /**< \brief Rx buffer 23 */
338 IfxCan_RxBufferId_24, /**< \brief Rx buffer 24 */
339 IfxCan_RxBufferId_25, /**< \brief Rx buffer 25 */
340 IfxCan_RxBufferId_26, /**< \brief Rx buffer 26 */
341 IfxCan_RxBufferId_27, /**< \brief Rx buffer 27 */

342 IfxCan_RxBufferId_28, /**< \brief Rx buffer 28 */


343 IfxCan_RxBufferId_29, /**< \brief Rx buffer 29 */

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/C… 7/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
344 IfxCan_RxBufferId_30, /**< \brief Rx buffer 30 */
345 IfxCan_RxBufferId_31, /**< \brief Rx buffer 31 */
346 IfxCan_RxBufferId_32, /**< \brief Rx buffer 32 */
347 IfxCan_RxBufferId_33, /**< \brief Rx buffer 33 */
348 IfxCan_RxBufferId_34, /**< \brief Rx buffer 34 */
349 IfxCan_RxBufferId_35, /**< \brief Rx buffer 35 */
350 IfxCan_RxBufferId_36, /**< \brief Rx buffer 36 */
351 IfxCan_RxBufferId_37, /**< \brief Rx buffer 37 */
352 IfxCan_RxBufferId_38, /**< \brief Rx buffer 38 */
353 IfxCan_RxBufferId_39, /**< \brief Rx buffer 39 */
354 IfxCan_RxBufferId_40, /**< \brief Rx buffer 40 */
355 IfxCan_RxBufferId_41, /**< \brief Rx buffer 41 */
356 IfxCan_RxBufferId_42, /**< \brief Rx buffer 42 */
357 IfxCan_RxBufferId_43, /**< \brief Rx buffer 43 */
358 IfxCan_RxBufferId_44, /**< \brief Rx buffer 44 */
359 IfxCan_RxBufferId_45, /**< \brief Rx buffer 45 */
360 IfxCan_RxBufferId_46, /**< \brief Rx buffer 46 */
361 IfxCan_RxBufferId_47, /**< \brief Rx buffer 47 */
362 IfxCan_RxBufferId_48, /**< \brief Rx buffer 48 */
363 IfxCan_RxBufferId_49, /**< \brief Rx buffer 49 */
364 IfxCan_RxBufferId_50, /**< \brief Rx buffer 50 */
365 IfxCan_RxBufferId_51, /**< \brief Rx buffer 51 */
366 IfxCan_RxBufferId_52, /**< \brief Rx buffer 52 */
367 IfxCan_RxBufferId_53, /**< \brief Rx buffer 53 */
368 IfxCan_RxBufferId_54, /**< \brief Rx buffer 54 */
369 IfxCan_RxBufferId_55, /**< \brief Rx buffer 55 */
370 IfxCan_RxBufferId_56, /**< \brief Rx buffer 56 */
371 IfxCan_RxBufferId_57, /**< \brief Rx buffer 57 */
372 IfxCan_RxBufferId_58, /**< \brief Rx buffer 58 */
373 IfxCan_RxBufferId_59, /**< \brief Rx buffer 59 */
374 IfxCan_RxBufferId_60, /**< \brief Rx buffer 60 */
375 IfxCan_RxBufferId_61, /**< \brief Rx buffer 61 */
376 IfxCan_RxBufferId_62, /**< \brief Rx buffer 62 */
377 IfxCan_RxBufferId_63 /**< \brief Rx buffer 63 */
378 } IfxCan_RxBufferId;
379
380 /** \brief Rx FIFO 0/1 operating mode\n
381 * Description in Ifx_CAN.N[x].RXFyC.FyOM, (x= 0 to 3; y = 0, 1)
382 */
383 typedef enum
384 {
385 IfxCan_RxFifoMode_blocking, /**< \brief Blocking mode */
386 IfxCan_RxFifoMode_overwrite /**< \brief Overwrite mode */
387 } IfxCan_RxFifoMode;
388
389 /** \brief Rx Buffers or FIFO 0 or combination Mode of reception
390 */
391 typedef enum
392 {
393 IfxCan_RxMode_dedicatedBuffers, /**< \brief Rx dedicated buffers operation */

394 IfxCan_RxMode_fifo0, /**< \brief Rx FIFO 0 operation */


395 IfxCan_RxMode_fifo1, /**< \brief Rx FIFO 1 operation */

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/C… 8/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
396 IfxCan_RxMode_sharedFifo0, /**< \brief Rx shared dedicated buffers and Rx FIFO 0 oper
397 IfxCan_RxMode_sharedFifo1, /**< \brief Rx shared dedicated buffers and Rx FIFO 1 oper
398 IfxCan_RxMode_sharedAll /**< \brief Rx shared dedicated buffers and Rx FIFO 0 and
399 } IfxCan_RxMode;
400
401 /** \brief Enable/disable the sensitivity of the module to sleep signal\n
402 * Definition in Ifx_CAN.CLC.B.EDIS
403 */
404 typedef enum
405 {
406 IfxCan_SleepMode_enable = 0, /**< \brief enables sleep mode */
407 IfxCan_SleepMode_disable = 1 /**< \brief disables sleep mode */
408 } IfxCan_SleepMode;
409
410 /** \brief CAN API status definition
411 */
412 typedef enum
413 {
414 IfxCan_Status_ok = 0x00000000,
415 IfxCan_Status_notInitialised = 0x00000001,
416 IfxCan_Status_busOff = 0x00000010,
417 IfxCan_Status_notSentBusy = 0x00000020,
418 IfxCan_Status_receiveEmpty = 0x00000040,
419 IfxCan_Status_messageLost = 0x00000080,
420 IfxCan_Status_newData = 0x00000100,
421 IfxCan_Status_newDataButOneLost = 0x00000180
422 } IfxCan_Status;
423
424 /** \brief OCDS Suspend Control (OCDS.SUS)
425 */
426 typedef enum
427 {
428 IfxCan_SuspendMode_none = 0, /**< \brief No suspend */
429 IfxCan_SuspendMode_hard = 1, /**< \brief Hard Suspend */
430 IfxCan_SuspendMode_soft = 2 /**< \brief Soft Suspend */
431 } IfxCan_SuspendMode;
432
433 /** \brief Tx Buffer number
434 */
435 typedef enum
436 {
437 IfxCan_TxBufferId_0, /**< \brief Tx buffer 0 */
438 IfxCan_TxBufferId_1, /**< \brief Tx buffer 1 */
439 IfxCan_TxBufferId_2, /**< \brief Tx buffer 2 */
440 IfxCan_TxBufferId_3, /**< \brief Tx buffer 3 */
441 IfxCan_TxBufferId_4, /**< \brief Tx buffer 4 */
442 IfxCan_TxBufferId_5, /**< \brief Tx buffer 5 */
443 IfxCan_TxBufferId_6, /**< \brief Tx buffer 6 */
444 IfxCan_TxBufferId_7, /**< \brief Tx buffer 7 */
445 IfxCan_TxBufferId_8, /**< \brief Tx buffer 8 */

446 IfxCan_TxBufferId_9, /**< \brief Tx buffer 9 */


447 IfxCan_TxBufferId_10, /**< \brief Tx buffer 10 */

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/C… 9/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
448 IfxCan_TxBufferId_11, /**< \brief Tx buffer 11 */
449 IfxCan_TxBufferId_12, /**< \brief Tx buffer 12 */
450 IfxCan_TxBufferId_13, /**< \brief Tx buffer 13 */
451 IfxCan_TxBufferId_14, /**< \brief Tx buffer 14 */
452 IfxCan_TxBufferId_15, /**< \brief Tx buffer 15 */
453 IfxCan_TxBufferId_16, /**< \brief Tx buffer 16 */
454 IfxCan_TxBufferId_17, /**< \brief Tx buffer 17 */
455 IfxCan_TxBufferId_18, /**< \brief Tx buffer 18 */
456 IfxCan_TxBufferId_19, /**< \brief Tx buffer 19 */
457 IfxCan_TxBufferId_20, /**< \brief Tx buffer 20 */
458 IfxCan_TxBufferId_21, /**< \brief Tx buffer 21 */
459 IfxCan_TxBufferId_22, /**< \brief Tx buffer 22 */
460 IfxCan_TxBufferId_23, /**< \brief Tx buffer 23 */
461 IfxCan_TxBufferId_24, /**< \brief Tx buffer 24 */
462 IfxCan_TxBufferId_25, /**< \brief Tx buffer 25 */
463 IfxCan_TxBufferId_26, /**< \brief Tx buffer 26 */
464 IfxCan_TxBufferId_27, /**< \brief Tx buffer 27 */
465 IfxCan_TxBufferId_28, /**< \brief Tx buffer 28 */
466 IfxCan_TxBufferId_29, /**< \brief Tx buffer 29 */
467 IfxCan_TxBufferId_30, /**< \brief Tx buffer 30 */
468 IfxCan_TxBufferId_31 /**< \brief Tx buffer 31 */
469 } IfxCan_TxBufferId;
470
471 /** \brief Tx FIFO/Queue Mode
472 */
473 typedef enum
474 {
475 IfxCan_TxMode_fifo, /**< \brief Tx FIFO operation */
476 IfxCan_TxMode_queue, /**< \brief Tx Queue operation */
477 IfxCan_TxMode_dedicatedBuffers, /**< \brief Tx dedicated buffers operation */
478 IfxCan_TxMode_sharedFifo, /**< \brief Tx shared dedicated buffers and Tx FIFO operat
479 IfxCan_TxMode_sharedQueue /**< \brief Tx shared dedicated buffers and Tx Queue opera
480 } IfxCan_TxMode;
481
482 /** \} */
483
484 /** \brief CAN node Bus Off status
485 */
486 typedef enum
487 {
488 IfxCan_CanNodeBusOffErrorStatus_NoErr = 0, /**< \brief CAN node not in Bus Off state */
489 IfxCan_CanNodeBusOffErrorStatus_BusOffErr = 1 /**< \brief CAN node in Bus Off state */
490 } IfxCan_CanNodeBusOffErrorStatus;
491
492 /** \brief CAN node communication state
493 */
494 typedef enum
495 {
496 IfxCan_CanNodeCommunicationState_synchronize = 0, /**< \brief CAN node is synchronizing on
497 IfxCan_CanNodeCommunicationState_idle = 1, /**< \brief Node is neither receiving no

498 IfxCan_CanNodeCommunicationState_receive = 2, /**< \brief Node is operating as receive


499 IfxCan_CanNodeCommunicationState_transmit = 3 /**< \brief Node is operating as transmi

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 10/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
500 } IfxCan_CanNodeCommunicationState;
501
502 /******************************************************************************/
503 /*-----------------------------Data Structures--------------------------------*/
504 /******************************************************************************/
505
506 /** \addtogroup IfxLld_Can_Std_Data_Structures
507 * \{ */
508 /** \brief tructure for Filter configuration
509 */
510 typedef struct
511 {
512 uint8 number; /**< \brief Filter Number */
513 IfxCan_FilterElementConfiguration elementConfiguration; /**< \brief *FEC, Filter Elem
514 IfxCan_FilterType type; /**< \brief *FT, Filter Type
515 uint32 id1; /**< \brief *FID1 First ID of
516 uint32 id2; /**< \brief *FID2 Second ID o
517 IfxCan_RxBufferId rxBufferOffset; /**< \brief Rx Buffer number
518 } IfxCan_Filter;
519
520 /** \brief Configuration for Interrupt groups
521 */
522 typedef struct
523 {
524 IfxCan_InterruptLine interruptLine; /**< \brief Intterupt line to which this interrui
525 Ifx_Priority priority; /**< \brief Priority of the interrupt */
526 IfxSrc_Tos typeOfService; /**< \brief Type of Service */
527 } IfxCan_GroupInterruptConfig;
528
529 /** \brief Structure for CAN Message configuration (transmit/receive)
530 */
531 typedef struct
532 {
533 uint8 bufferNumber; /**< \brief (Tx / Rx) Buffer Element nu
534 uint32 messageId; /**< \brief ID, Identifier */
535 boolean remoteTransmitRequest; /**< \brief RTR, Remote Transmit Reques
536 IfxCan_MessageIdLength messageIdLength; /**< \brief XTD, Message Id length (Sta
537 boolean errorStateIndicator; /**< \brief ESI, Error State Indicator
538 IfxCan_DataLengthCode dataLengthCode; /**< \brief DLC, Data Length Code */
539 IfxCan_FrameMode frameMode; /**< \brief CAN frame mode */
540 boolean txEventFifoControl; /**< \brief EFC, Tx Event FIFO Control
541 boolean storeInTxFifoQueue; /**< \brief Write message in Tx FIFO/QU
542 boolean readFromRxFifo0; /**< \brief Read message from Rx FIFO 0
543 boolean readFromRxFifo1; /**< \brief Read message from Rx FIFO 1
544 } IfxCan_Message;
545
546 /** \brief Structure for Message RAM configuration
547 */
548 typedef struct
549 {

550 uint32 baseAddress; /**< \brief Message RAM base address of the CA
551 uint16 standardFilterListStartAddress; /**< \brief Start address of Standard Message

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 11/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
552 uint16 extendedFilterListStartAddress; /**< \brief Start address of Extended Message
553 uint16 rxFifo0StartAddress; /**< \brief Start address of Rx FIFO 0 in Mess
554 uint16 rxFifo1StartAddress; /**< \brief Start address of Rx FIFO 1 in Mess
555 uint16 rxBuffersStartAddress; /**< \brief Start address of Rx Buffers sectio
556 uint16 txEventFifoStartAddress; /**< \brief Start address of Tx Event FIFO in
557 uint16 txBuffersStartAddress; /**< \brief Start address of Tx Buffers sectio
558 } IfxCan_MessageRAM;
559
560 /** \} */
561
562 /** \addtogroup IfxLld_Can_Std_Node_Functions
563 * \{ */
564
565 /******************************************************************************/
566 /*-------------------------Inline Function Prototypes-------------------------*/
567 /******************************************************************************/
568
569 /** \brief Disables the configuration change\n
570 * The CPU has no write access to the protected configuration registers
571 * \param node Specifies the pointer to the CAN Node registers
572 * \return None
573 */
574 IFX_INLINE void IfxCan_Node_disableConfigurationChange(Ifx_CAN_N *node);
575
576 /** \brief Enables the configuration change\n
577 * The CPU has write access to the protected configuration registers (while CCCR.INIT = 1)
578 * \param node Specifies the pointer to the CAN Node registers
579 * \return None
580 */
581 IFX_INLINE void IfxCan_Node_enableConfigurationChange(Ifx_CAN_N *node);
582
583 /** \brief Enables the internal Virtual CAN bus loopback mode
584 * \param node Specifies the pointer to the CAN Node registers
585 * \return None
586 */
587 IFX_INLINE void IfxCan_Node_enableLoopbackMode(Ifx_CAN_N *node);
588
589 /** \brief Returns the status of whether the CAN Node is synchronised or not
590 * \param node Specifies the pointer to the CAN Node registers
591 * \return Status TRUE: synchronized, FALSE : Sync in progress
592 */
593 IFX_INLINE boolean IfxCan_Node_isNodeSynchronized(Ifx_CAN_N *node);
594
595 /** \brief Initialises the node\n
596 * 0= Normal Operation\n
597 * 1= Initialization is started
598 * \param node Specifies the pointer to the CAN Node registers
599 * \param enable Enable / Disable choice
600 * \return None
601 */

602 IFX_INLINE void IfxCan_Node_setInitialisation(Ifx_CAN_N *node, boolean enable);


603

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 12/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
604 /** \brief Sets Transceiver Delay Compensation offset
605 * \param node Specifies the pointer to the CAN Node registers
606 * \param delay delay offset value
607 * \return None
608 */
609 IFX_INLINE void IfxCan_Node_setTransceiverDelayCompensationOffset(Ifx_CAN_N *node, uint8 delay)
610
611 /** \brief Get the LEC error status of the CAN node.
612 * \param node Specifies the pointer to CAN node registers
613 * \return LEC error status in CAN node PSR register
614 */
615 IFX_INLINE IfxCan_LastErrorCodeType IfxCan_Node_getLastErroCodeStatus(Ifx_CAN_N *node);
616
617 /** \brief Error Passive status of the CAN node.
618 * TRUE: CAN node in error passive.
619 * FALSE: CAN node not in error passive.
620 * \param node Specifies the pointer to CAN node registers
621 * \return Error Passive error status of CAN node (TRUE/FALSE).
622 */
623 IFX_INLINE boolean IfxCan_Node_isErrorPassive(Ifx_CAN_N *node);
624
625 /** \brief Get the warning status of the CAN node.
626 * \param node Specifies the pointer to CAN node registers
627 * \return Warning status in CAN node
628 */
629 IFX_INLINE IfxCan_CanNodeErrorWarningLimitStatus IfxCan_Node_getWarningStatus(Ifx_CAN_N *node);
630
631 /** \brief Get the Bus Off status of the CAN node.
632 * \param node Specifies the pointer to CAN node registers
633 * \return Bus Off Error status in CAN node
634 */
635 IFX_INLINE IfxCan_CanNodeBusOffErrorStatus IfxCan_Node_getBusOffStatus(Ifx_CAN_N *node);
636
637 /** \brief Get the Activity status of the CAN node.
638 * \param node Specifies the pointer to CAN node registers
639 * \return Activity status of CAN node
640 */
641 IFX_INLINE IfxCan_CanNodeCommunicationState IfxCan_Node_getActivityStatus(Ifx_CAN_N *node);
642
643 /** \brief Get the Error status in data phase of the CAN node in the recent CANFD operation wit
644 * \param node Specifies the pointer to CAN node registers
645 * \return Error status of the recent CAN FD with BRS flag set.
646 */
647 IFX_INLINE IfxCan_LastErrorCodeType IfxCan_Node_getDataPhaseLastErrorCode(Ifx_CAN_N *node);
648
649 /** \brief Protocol Exception Event status
650 * TRUE: Protocol Exception event occured.
651 * FALSE: Protocol Exception event not occured.
652 * \param node Specifies the pointer to CAN node registers
653 * \return Get the Protocol Exception event status (TRUE/FALSE)

654 */
655 IFX_INLINE boolean IfxCan_Node_isProtocolExceptionEventOccured(Ifx_CAN_N *node);

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 13/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
656
657 /** \brief Returns the error status of the recent recieved CAN FD message.
658 * TRUE : Error status indicator is enabled
659 * FALSE: Erro status indicator not enabled.
660 * \param node Specifies the pointer to CAN node registers
661 * \return Error indicator for recent received CAN FD message (TRUE/FALSE)
662 */
663 IFX_INLINE boolean IfxCan_Node_isErrorStatusIndicatorEnabled(Ifx_CAN_N *node);
664
665 /** \brief Bit Rate Switch status of the last recieved CAN FD message.
666 * TRUE: Bit rate switch is enabled.
667 * FALSE: Bit rate switch is disabled.
668 * \param node Specifies the pointer to CAN node registers
669 * \return Bit Rate Switch flag status (TRUE/FALSE)
670 */
671 IFX_INLINE boolean IfxCan_Node_isBitRateSwitchFlagEnabled(Ifx_CAN_N *node);
672
673 /** \brief Return the DLC code corresponding to the data length in bytes
674 * \param dataLength Data length in bytes
675 * \return Data length code
676 */
677 IFX_INLINE IfxCan_DataLengthCode IfxCan_Node_getCodeFromDataLengthInBytes(uint32 dataLength);
678
679 /******************************************************************************/
680 /*-------------------------Global Function Prototypes-------------------------*/
681 /******************************************************************************/
682
683 /** \brief Converts data length code (DLC) into number of words
684 * \param dataLengthCode DLC, Data Length Code
685 * \return Number of data words
686 */
687 IFX_EXTERN uint32 IfxCan_Node_getDataLength(IfxCan_DataLengthCode dataLengthCode);
688
689 /** \brief Converts data length code (DLC) into number of data words.
690 * This function is deprecated. Use new function IfxCan_Node_getDataLength
691 * \param node Specifies the pointer to the CAN Node registers
692 * \param dataLengthCode DLC, Data Length Code
693 * \return Number of data words
694 */
695 IFX_EXTERN uint32 IfxCan_Node_getDataLengthFromCode(Ifx_CAN_N *node, IfxCan_DataLengthCode data
696
697 /** \brief Returns CAN frame mode of operation for a received frame
698 * \param rxBufferElement Rx Buffer Element
699 * \return CAN frame mode
700 */
701 IFX_EXTERN IfxCan_FrameMode IfxCan_Node_getFrameMode(Ifx_CAN_RXMSG *rxBufferElement);
702
703 /** \brief Select and initialise the CAN node receive pin
704 * \param node Specifies the pointer to the CAN Node registers
705 * \param rxd Rx pin

706 * \param mode Input mode


707 * \param padDriver Pad Driver Configuration

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 14/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
708 * \return TRUE: Returns TRUE if the operation was successful\n
709 * FALSE: Returns FALSE if the operation was errorneous
710 */
711 IFX_EXTERN boolean IfxCan_Node_initRxPin(Ifx_CAN_N *node, IfxCan_Rxd_In *rxd, IfxPort_InputMode
712
713 /** \brief Select and initialise the CAN node transmit pin
714 * \param txd Tx pin
715 * \param mode Output mode
716 * \param padDriver Pad driver Configuration
717 * \return TRUE: Returns TRUE if the operation was successful\n
718 * FALSE: Returns FALSE if the operation was errorneous
719 */
720 IFX_EXTERN boolean IfxCan_Node_initTxPin(IfxCan_Txd_Out *txd, IfxPort_OutputMode mode, IfxPort_
721
722 /** \brief Calculates and Sets the CAN baudrate for standard frames and arbitration phase of CA
723 * \param node Specifies the pointer to the CAN Node registers
724 * \param moduleFreq Specifies the CAN module frequency
725 * \param baudrate Specifies the baud rate. Unit: baud
726 * \param samplePoint Specifies the sample point. Range = [0, 10000] resp. [0%, 100%] of the to
727 * \param syncJumpWidth Specifies the re-synchronization jump width
728 * \return None
729 */
730 IFX_EXTERN void IfxCan_Node_setBitTiming(Ifx_CAN_N *node, float32 moduleFreq, uint32 baudrate,
731
732 /** \brief Sets the values of CAN baudrate for standard frames
733 * \param node Specifies the pointer to the CAN Node registers
734 * \param syncJumpWidth Synchronization Jump Width
735 * \param timeSegment2 Time segment after sample point
736 * \param timeSegment1 Time segment before sample point
737 * \param prescaler Baud Rate Prescaler
738 * \return None
739 */
740 IFX_EXTERN void IfxCan_Node_setBitTimingValues(Ifx_CAN_N *node, uint16 syncJumpWidth, uint8 tim
741
742 /** \brief Calulates and Sets the CAN fast baudrate for CAN FD frames data phase
743 * \param node Specifies the pointer to the CAN Node registers
744 * \param moduleFreq Specifies the CAN module frequency
745 * \param baudrate Specifies the baud rate. Unit: baud
746 * \param samplePoint Specifies the sample point. Range = [0, 10000] resp. [0%, 100%] of the to
747 * \param syncJumpWidth Specifies the re-synchronization jump width
748 * \return None
749 */
750 IFX_EXTERN void IfxCan_Node_setFastBitTiming(Ifx_CAN_N *node, float32 moduleFreq, uint32 baudra
751
752 /** \brief Sets the values of CAN fast baudrate for CAN FD frames data phase
753 * \param node Specifies the pointer to the CAN Node registers
754 * \param syncJumpWidth Synchronization Jump Width
755 * \param timeSegment2 Time segment after sample point
756 * \param timeSegment1 Time segment before sample point
757 * \param prescaler Baud Rate Prescaler

758 * \return None


759 */

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 15/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
760 IFX_EXTERN void IfxCan_Node_setFastBitTimingValues(Ifx_CAN_N *node, uint16 syncJumpWidth, uint8
761
762 /** \brief Enables the CAN frame mode for transmission
763 * \param node Specifies the pointer to the CAN Node registers
764 * \param frameMode CAN frame mode
765 * \return None
766 */
767 IFX_EXTERN void IfxCan_Node_setFrameMode(Ifx_CAN_N *node, IfxCan_FrameMode frameMode);
768
769 /** \brief Sets CAN frame mode request for transmission
770 * \param txBufferElement Tx Buffer Element
771 * \param frameMode CAN frame mode
772 * \return None
773 */
774 IFX_EXTERN void IfxCan_Node_setFrameModeReq(Ifx_CAN_TXMSG *txBufferElement, IfxCan_FrameMode fr
775
776 /** \brief Sets CAN frame mode request for transmission.
777 * This function is deprecated. Use new function IfxCan_Node_setFrameModeReq
778 * \param node Specifies the pointer to the CAN Node registers
779 * \param txBufferElement Tx Buffer Element
780 * \param frameMode CAN frame mode
781 * \return None
782 */
783 IFX_EXTERN void IfxCan_Node_setFrameModeRequest(Ifx_CAN_N *node, Ifx_CAN_TXMSG *txBufferElement
784
785 /** \brief Converts data length code (DLC) into number of bytes
786 * \param dataLengthCode Data length code
787 * \return Data length in bytes
788 */
789 IFX_EXTERN uint32 IfxCan_Node_getDataLengthInBytes(IfxCan_DataLengthCode dataLengthCode);
790
791 /** \} */
792
793 /** \addtogroup IfxLld_Can_Std_Tx_Element_Functions
794 * \{ */
795
796 /******************************************************************************/
797 /*-------------------------Inline Function Prototypes-------------------------*/
798 /******************************************************************************/
799
800 /** \brief Returns Tx FIFO/Queue Put Index
801 * \param node Specifies the pointer to the CAN Node registers
802 * \return Tx Buffer Element Number
803 */
804 IFX_INLINE IfxCan_TxBufferId IfxCan_Node_getTxFifoQueuePutIndex(Ifx_CAN_N *node);
805
806 /** \brief Returns the status of whether cancellation is finished on the selected Tx buffer
807 * \param node Specifies the pointer to the CAN Node registers
808 * \param txBufferId Tx Buffer number
809 * \return Status

810 */
811 IFX_INLINE boolean IfxCan_Node_isTxBufferCancellationFinished(Ifx_CAN_N *node, IfxCan_TxBufferI

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 16/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
812
813 /** \brief Returns the status of pending request of the selected Tx buffer
814 * \param node Specifies the pointer to the CAN Node registers
815 * \param txBufferId Tx Buffer number
816 * \return Status
817 */
818 IFX_INLINE boolean IfxCan_Node_isTxBufferRequestPending(Ifx_CAN_N *node, IfxCan_TxBufferId txBu
819
820 /** \brief Returns the status of whether transmission occured on the selected Tx buffer
821 * \param node Specifies the pointer to the CAN Node registers
822 * \param txBufferId Tx Buffer number
823 * \return Status
824 */
825 IFX_INLINE boolean IfxCan_Node_isTxBufferTransmissionOccured(Ifx_CAN_N *node, IfxCan_TxBufferId
826
827 /** \brief Returns the status of Tx Fifo/Queue is full or not
828 * \param node Specifies the pointer to the CAN Node registers
829 * \return Status
830 */
831 IFX_INLINE boolean IfxCan_Node_isTxFifoQueueFull(Ifx_CAN_N *node);
832
833 /** \brief pauses the CAN Node for two CAN bit times before starting the next transmission
834 * \param node Specifies the pointer to the CAN Node registers
835 * \param enable Enable / Disable choice
836 * \return None
837 */
838 IFX_INLINE void IfxCan_Node_pauseTransmission(Ifx_CAN_N *node, boolean enable);
839
840 /** \brief Sets the Data Length Code (DLC) for transmit frame
841 * \param txBufferElement Tx Buffer Element
842 * \param dataLengthCode DLC, data length code
843 * \return None
844 */
845 IFX_INLINE void IfxCan_Node_setDataLength(Ifx_CAN_TXMSG *txBufferElement, IfxCan_DataLengthCode
846
847 /** \brief Sets the Data Length Code (DLC) for transmit frame.
848 * This function is deprecated. Use new function IfxCan_Node_setDataLength
849 * \param node Specifies the pointer to the CAN Node registers
850 * \param txBufferElement Tx Buffer Element
851 * \param dataLengthCode DLC, data length code
852 * \return None
853 */
854 IFX_INLINE void IfxCan_Node_setDataLengthCode(Ifx_CAN_N *node, Ifx_CAN_TXMSG *txBufferElement,
855
856 /** \brief Sets the number of dedicated Tx Buffers
857 * \param node Specifies the pointer to the CAN Node registers
858 * \param number Number of Tx Buffers
859 * \return None
860 */
861 IFX_INLINE void IfxCan_Node_setDedicatedTxBuffersNumber(Ifx_CAN_N *node, uint8 number);

862
863 /** \brief Sets the Error State Indicator (ESI) for transmit frame

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 17/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
864 * \param txBufferElement Tx Buffer Element
865 * \param enable Choice (True/ False)
866 * \return None
867 */
868 IFX_INLINE void IfxCan_Node_setErrStateIndicator(Ifx_CAN_TXMSG *txBufferElement, boolean enable
869
870 /** \brief Sets the Error State Indicator (ESI) for transmit frame.
871 * This function is decprecated. Use new function IfxCan_Node_setErrStateIndicator
872 * \param node Specifies the pointer to the CAN Node registers
873 * \param txBufferElement Tx Buffer Element
874 * \param enable Choice (True/ False)
875 * \return None
876 */
877 IFX_INLINE void IfxCan_Node_setErrorStateIndicator(Ifx_CAN_N *node, Ifx_CAN_TXMSG *txBufferElem
878
879 /** \brief Sets the Message Marker (MM) for transmit frame
880 * \param txBufferElement Tx Buffer Element
881 * \param bufferId MM, Message Marker , Buffer Id
882 * \return None
883 */
884 IFX_INLINE void IfxCan_Node_setMessageMarker(Ifx_CAN_TXMSG *txBufferElement, IfxCan_TxBufferId
885
886 /** \brief Sets the identifier (ID) for transmit frame.
887 * \param txBufferElement Tx Buffer Element
888 * \param messageId Identifier
889 * \param messageIdLength Message Id length (Standard / Extended)
890 * \return None
891 */
892 IFX_INLINE void IfxCan_Node_setMsgId(Ifx_CAN_TXMSG *txBufferElement, uint32 messageId, IfxCan_M
893
894 /** \brief Sets the identifier (ID) for transmit frame.
895 * This function is deprecated. Use the new function IfxCan_Node_setMsgId
896 * \param node Specifies the pointer to the CAN Node registers
897 * \param txBufferElement Tx Buffer Element
898 * \param messageId Identifier
899 * \param messageIdLength Message Id length (Standard / Extended)
900 * \return None
901 */
902 IFX_INLINE void IfxCan_Node_setMesssageId(Ifx_CAN_N *node, Ifx_CAN_TXMSG *txBufferElement, uint
903
904 /** \brief Sets the remote Transmit Request (RTR) for transmit frame
905 * \param txBufferElement Tx Buffer Element
906 * \param enable Choice (True/ False)
907 * \return None
908 */
909 IFX_INLINE void IfxCan_Node_setRemoteTransmitReq(Ifx_CAN_TXMSG *txBufferElement, boolean enable
910
911 /** \brief Sets the remote Transmit Request (RTR) for transmit frame.
912 * This function is deprecated. Use new function IfxCan_Node_setRemoteTransmitReq
913 * \param node Specifies the pointer to the CAN Node registers

914 * \param txBufferElement Tx Buffer Element


915 * \param enable Choice (True/ False)

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 18/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
916 * \return None
917 */
918 IFX_INLINE void IfxCan_Node_setRemoteTransmitRequest(Ifx_CAN_N *node, Ifx_CAN_TXMSG *txBufferEl
919
920 /** \brief Sets Transmit FIFO/Queue Mode
921 * \param node Specifies the pointer to the CAN Node registers
922 * \param mode Tx FIFO/Queue Mode
923 * \return None
924 */
925 IFX_INLINE void IfxCan_Node_setTransmitFifoQueueMode(Ifx_CAN_N *node, IfxCan_TxMode mode);
926
927 /** \brief Sets Transmit FIFO/Queue Size
928 * \param node Specifies the pointer to the CAN Node registers
929 * \param number Number of Tx Buffers used for Tx FIFO/Queue
930 * \return None
931 */
932 IFX_INLINE void IfxCan_Node_setTransmitFifoQueueSize(Ifx_CAN_N *node, uint8 number);
933
934 /** \brief Sets the Add Request for the selected Tx buffer
935 * \param node Specifies the pointer to the CAN Node registers
936 * \param txBufferId Tx Buffer number
937 * \return None
938 */
939 IFX_INLINE void IfxCan_Node_setTxBufferAddRequest(Ifx_CAN_N *node, IfxCan_TxBufferId txBufferId
940
941 /** \brief Sets the Cancellation Request for the selected Tx buffer
942 * \param node Specifies the pointer to the CAN Node registers
943 * \param txBufferId Tx Buffer number
944 * \return None
945 */
946 IFX_INLINE void IfxCan_Node_setTxBufferCancellationRequest(Ifx_CAN_N *node, IfxCan_TxBufferId t
947
948 /** \brief Sets Tx Buffer Data Field Size
949 * \param node Specifies the pointer to the CAN Node registers
950 * \param size Tx Buffer Data Field Size
951 * \return None
952 */
953 IFX_INLINE void IfxCan_Node_setTxBufferDataFieldSize(Ifx_CAN_N *node, IfxCan_DataFieldSize size
954
955 /** \brief Sets the start address of Tx Buffers section in the Message RAM (32-bit word address
956 * \param node Specifies the pointer to the CAN Node registers
957 * \param address Start address of Tx Buffers in the message RAM
958 * \return None
959 */
960 IFX_INLINE void IfxCan_Node_setTxBuffersStartAddress(Ifx_CAN_N *node, uint16 address);
961
962 /** \brief Sets the Tx Event Fifo Control (EFC) for transmit frame
963 * \param txBufferElement Tx Buffer Element
964 * \param enable Choice (True/ False)
965 * \return None

966 */
967 IFX_INLINE void IfxCan_Node_setTxEventFifoCtrl(Ifx_CAN_TXMSG *txBufferElement, boolean enable);

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 19/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
968
969 /** \brief Sets the Tx Event Fifo Control (EFC) for transmit frame.
970 * This function is deprecated. Use new function IfxCan_Node_setTxEventFifoCtrl
971 * \param node Specifies the pointer to the CAN Node registers
972 * \param txBufferElement Tx Buffer Element
973 * \param enable Choice (True/ False)
974 * \return None
975 */
976 IFX_INLINE void IfxCan_Node_setTxEventFifoControl(Ifx_CAN_N *node, Ifx_CAN_TXMSG *txBufferEleme
977
978 /******************************************************************************/
979 /*-------------------------Global Function Prototypes-------------------------*/
980 /******************************************************************************/
981
982 /** \brief Returns Tx Buffer Data Field Size in bytes
983 * \param node Specifies the pointer to the CAN Node registers
984 * \return Data field size
985 */
986 IFX_EXTERN uint8 IfxCan_Node_getTxBufferDataFieldSize(Ifx_CAN_N *node);
987
988 /** \brief Returns the address of selected Tx buffer element
989 * \param node Specifies the pointer to the CAN Node registers
990 * \param ramBaseAddress Message RAM base address of CAN module
991 * \param txBuffersStartAddress Start address of Tx Buffers section in the Message RAM
992 * \param txBufferNumber Tx buffer element number
993 * \return Tx Buffer Element Address
994 */
995 IFX_EXTERN Ifx_CAN_TXMSG *IfxCan_Node_getTxBufferElementAddress(Ifx_CAN_N *node, uint32 ramBase
996
997 /** \brief Writes Data into Tx buffer element Node_writeTxBufData
998 * \param txBufferElement Tx Buffer Element
999 * \param dataLengthCode DLC, Data Length Code
1000 * \param data Pointer to data (in words)
1001 * \return None
1002 */
1003 IFX_EXTERN void IfxCan_Node_writeTxBufData(Ifx_CAN_TXMSG *txBufferElement, IfxCan_DataLengthCod
1004
1005 /** \brief Writes Data into Tx buffer element.
1006 * This function is deprecated. Use new function IfxCan_Node_writeTxBufData
1007 * \param node Specifies the pointer to the CAN Node registers
1008 * \param txBufferElement Tx Buffer Element
1009 * \param dataLengthCode DLC, Data Length Code
1010 * \param data Pointer to data (in words)
1011 * \return None
1012 */
1013 IFX_EXTERN void IfxCan_Node_writeData(Ifx_CAN_N *node, Ifx_CAN_TXMSG *txBufferElement, IfxCan_D
1014
1015 /** \} */
1016
1017 /** \addtogroup IfxLld_Can_Std_Rx_Element_Functions

1018 * \{ */
1019

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 20/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1020 /******************************************************************************/
1021 /*-------------------------Inline Function Prototypes-------------------------*/
1022 /******************************************************************************/
1023
1024 /** \brief Returns the Data Length Code from the received frame
1025 * \param rxBufferElement Rx Buffer Element
1026 * \return Data Length Code
1027 */
1028 IFX_INLINE uint32 IfxCan_Node_getDataLengthCode(Ifx_CAN_RXMSG *rxBufferElement);
1029
1030 /** \brief Returns the identifier (ID) from the received frame
1031 * \param rxBufferElement Rx Buffer Element
1032 * \return Identifier
1033 */
1034 IFX_INLINE uint32 IfxCan_Node_getMesssageId(Ifx_CAN_RXMSG *rxBufferElement);
1035
1036 /** \brief Returns Rx FIFO 0 Fill Level
1037 * \param node Specifies the pointer to the CAN Node registers
1038 * \return Fill level
1039 */
1040 IFX_INLINE uint8 IfxCan_Node_getRxFifo0FillLevel(Ifx_CAN_N *node);
1041
1042 /** \brief Returns Rx FIFO 0 get index
1043 * \param node Specifies the pointer to the CAN Node registers
1044 * \return Rx Buffer Element Number
1045 */
1046 IFX_INLINE IfxCan_RxBufferId IfxCan_Node_getRxFifo0GetIndex(Ifx_CAN_N *node);
1047
1048 /** \brief Returns Rx FIFO 1 Fill Level
1049 * \param node Specifies the pointer to the CAN Node registers
1050 * \return Fill level
1051 */
1052 IFX_INLINE uint8 IfxCan_Node_getRxFifo1FillLevel(Ifx_CAN_N *node);
1053
1054 /** \brief Returns Rx FIFO 1 get index
1055 * \param node Specifies the pointer to the CAN Node registers
1056 * \return Rx Buffer Element Number
1057 */
1058 IFX_INLINE IfxCan_RxBufferId IfxCan_Node_getRxFifo1GetIndex(Ifx_CAN_N *node);
1059
1060 /** \brief Sets Rx Buffer Data Field Size
1061 * \param node Specifies the pointer to the CAN Node registers
1062 * \param size Rx Buffer Data Field Size
1063 * \return None
1064 */
1065 IFX_INLINE void IfxCan_Node_setRxBufferDataFieldSize(Ifx_CAN_N *node, IfxCan_DataFieldSize size
1066
1067 /** \brief Sets the start address of Rx Buffers section in the Message RAM (32-bit word address
1068 * \param node Specifies the pointer to the CAN Node registers
1069 * \param address Start address of Rx Buffers in the Message RAM

1070 * \return None


1071 */

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 21/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1072 IFX_INLINE void IfxCan_Node_setRxBuffersStartAddress(Ifx_CAN_N *node, uint16 address);
1073
1074 /** \brief Sets Rx FIFO 0 Acknowledge Index
1075 * \param node Specifies the pointer to the CAN Node registers
1076 * \param RxBufferNumber Rx buffer element number
1077 * \return None
1078 */
1079 IFX_INLINE void IfxCan_Node_setRxFifo0AcknowledgeIndex(Ifx_CAN_N *node, IfxCan_RxBufferId RxBuf
1080
1081 /** \brief Sets Rx Buffer Fifo 0 Data Field Size
1082 * \param node Specifies the pointer to the CAN Node registers
1083 * \param size Rx FIFO 0 Data Field Size
1084 * \return None
1085 */
1086 IFX_INLINE void IfxCan_Node_setRxFifo0DataFieldSize(Ifx_CAN_N *node, IfxCan_DataFieldSize size)
1087
1088 /** \brief Sets Rx Buffer Fifo 0 operating mode
1089 * \param node Specifies the pointer to the CAN Node registers
1090 * \param mode Rx FIFO 0 operating Mode
1091 * \return None
1092 */
1093 IFX_INLINE void IfxCan_Node_setRxFifo0OperatingMode(Ifx_CAN_N *node, IfxCan_RxFifoMode mode);
1094
1095 /** \brief Sets Rx FIFO 0 Size
1096 * \param node Specifies the pointer to the CAN Node registers
1097 * \param size Rx FIFO 0 Size
1098 * \return None
1099 */
1100 IFX_INLINE void IfxCan_Node_setRxFifo0Size(Ifx_CAN_N *node, uint8 size);
1101
1102 /** \brief Sets the start address of Rx FIFO 0 section in the Message RAM (32-bit word address)
1103 * \param node Specifies the pointer to the CAN Node registers
1104 * \param address Start address of Rx FIFO 0 in the Message RAM
1105 * \return None
1106 */
1107 IFX_INLINE void IfxCan_Node_setRxFifo0StartAddress(Ifx_CAN_N *node, uint16 address);
1108
1109 /** \brief Sets Rx FIFO 0 Watermark Level
1110 * \param node Specifies the pointer to the CAN Node registers
1111 * \param level Rx FIFO 0 Watermark Level
1112 * \return None
1113 */
1114 IFX_INLINE void IfxCan_Node_setRxFifo0WatermarkLevel(Ifx_CAN_N *node, uint8 level);
1115
1116 /** \brief Sets Rx FIFO 1 Acknowledge Index
1117 * \param node Specifies the pointer to the CAN Node registers
1118 * \param RxBufferNumber Rx buffer element number
1119 * \return None
1120 */
1121 IFX_INLINE void IfxCan_Node_setRxFifo1AcknowledgeIndex(Ifx_CAN_N *node, IfxCan_RxBufferId RxBuf

1122
1123 /** \brief Sets Rx Buffer Fifo 1 Data Field Size

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 22/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1124 * \param node Specifies the pointer to the CAN Node registers
1125 * \param size Rx FIFO 1 Data Field Size
1126 * \return None
1127 */
1128 IFX_INLINE void IfxCan_Node_setRxFifo1DataFieldSize(Ifx_CAN_N *node, IfxCan_DataFieldSize size)
1129
1130 /** \brief Sets Rx Buffer Fifo 1 operating mode
1131 * \param node Specifies the pointer to the CAN Node registers
1132 * \param mode Rx FIFO 1 operating Mode
1133 * \return None
1134 */
1135 IFX_INLINE void IfxCan_Node_setRxFifo1OperatingMode(Ifx_CAN_N *node, IfxCan_RxFifoMode mode);
1136
1137 /** \brief Sets Rx FIFO 1 Size
1138 * \param node Specifies the pointer to the CAN Node registers
1139 * \param size Rx FIFO 1 Size
1140 * \return None
1141 */
1142 IFX_INLINE void IfxCan_Node_setRxFifo1Size(Ifx_CAN_N *node, uint8 size);
1143
1144 /** \brief Sets the start address of Rx FIFO 1 section in the Message RAM (32-bit word address)
1145 * \param node Specifies the pointer to the CAN Node registers
1146 * \param address Start address of Rx FIFO 1 in the Message RAM
1147 * \return None
1148 */
1149 IFX_INLINE void IfxCan_Node_setRxFifo1StartAddress(Ifx_CAN_N *node, uint16 address);
1150
1151 /** \brief Sets Rx FIFO 1 Watermark Level
1152 * \param node Specifies the pointer to the CAN Node registers
1153 * \param level Rx FIFO 1 Watermark Level
1154 * \return None
1155 */
1156 IFX_INLINE void IfxCan_Node_setRxFifo1WatermarkLevel(Ifx_CAN_N *node, uint8 level);
1157
1158 /******************************************************************************/
1159 /*-------------------------Global Function Prototypes-------------------------*/
1160 /******************************************************************************/
1161
1162 /** \brief Clears the New Data flag of the selected Rx buffer
1163 * \param node Specifies the pointer to the CAN Node registers
1164 * \param rxBufferId Rx Buffer number
1165 * \return None
1166 */
1167 IFX_EXTERN void IfxCan_Node_clearRxBufferNewDataFlag(Ifx_CAN_N *node, IfxCan_RxBufferId rxBuffe
1168
1169 /** \brief Returns Rx Buffer Data Field Size in bytes
1170 * \param node Specifies the pointer to the CAN Node registers
1171 * \return Data field size
1172 */
1173 IFX_EXTERN uint8 IfxCan_Node_getRxBufferDataFieldSize(Ifx_CAN_N *node);

1174
1175 /** \brief Returns the address of selected Rx buffer element

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 23/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1176 * \param node Specifies the pointer to the CAN Node registers
1177 * \param ramBaseAddress Message RAM base address of CAN Module
1178 * \param rxBuffersStartAddress Start address of Rx Buffers section in the Message RAM
1179 * \param rxBufferNumber Rx buffer element number
1180 * \return Rx Buffer Element Address
1181 */
1182 IFX_EXTERN Ifx_CAN_RXMSG *IfxCan_Node_getRxBufferElementAddress(Ifx_CAN_N *node, uint32 ramBase
1183
1184 /** \brief Returns Rx FIFO 0 Data Field Size in bytes
1185 * \param node Specifies the pointer to the CAN Node registers
1186 * \return Data field size
1187 */
1188 IFX_EXTERN uint8 IfxCan_Node_getRxFifo0DataFieldSize(Ifx_CAN_N *node);
1189
1190 /** \brief Returns the address of selected Rx FIFO 0 element
1191 * \param node Specifies the pointer to the CAN Node registers
1192 * \param ramBaseAddress Message RAM base address of CAN Module
1193 * \param rxFifo0StartAddress Start address of Rx FIFO 0 section in the Message RAM
1194 * \param rxBufferNumber Rx buffer element number
1195 * \return Rx FIFO 0 Element Address
1196 */
1197 IFX_EXTERN Ifx_CAN_RXMSG *IfxCan_Node_getRxFifo0ElementAddress(Ifx_CAN_N *node, uint32 ramBaseA
1198
1199 /** \brief Returns Rx FIFO 1 Data Field Size in bytes
1200 * \param node Specifies the pointer to the CAN Node registers
1201 * \return Data field size
1202 */
1203 IFX_EXTERN uint8 IfxCan_Node_getRxFifo1DataFieldSize(Ifx_CAN_N *node);
1204
1205 /** \brief Returns the address of selected Rx FIFO 1 element
1206 * \param node Specifies the pointer to the CAN Node registers
1207 * \param ramBaseAddress Message RAM base address of CAN Module
1208 * \param rxFifo1StartAddress Start address of Rx FIFO 1 section in the Message RAM
1209 * \param rxBufferNumber Rx buffer element number
1210 * \return Rx FIFO 1 Element Address
1211 */
1212 IFX_EXTERN Ifx_CAN_RXMSG *IfxCan_Node_getRxFifo1ElementAddress(Ifx_CAN_N *node, uint32 ramBaseA
1213
1214 /** \brief Returns the status of whether the selcted Rx buffer has been updated from new data
1215 * \param node Specifies the pointer to the CAN Node registers
1216 * \param rxBufferId Rx Buffer number
1217 * \return Status
1218 */
1219 IFX_EXTERN boolean IfxCan_Node_isRxBufferNewDataUpdated(Ifx_CAN_N *node, IfxCan_RxBufferId rxBu
1220
1221 /** \brief Reads data from Rx buffer element
1222 * \param rxBufferElement Rx Buffer Element
1223 * \param dataLengthCode DLC, Data Length Code
1224 * \param data Pointer to data (in words)
1225 * \return None

1226 */
1227 IFX_EXTERN void IfxCan_Node_readData(Ifx_CAN_RXMSG *rxBufferElement, IfxCan_DataLengthCode data

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 24/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1228
1229 /** \} */
1230
1231 /** \addtogroup IfxLld_Can_Std_Filter_Functions
1232 * \{ */
1233
1234 /******************************************************************************/
1235 /*-------------------------Inline Function Prototypes-------------------------*/
1236 /******************************************************************************/
1237
1238 /** \brief Disables the selected interrupt
1239 * \param node Specifies the pointer to the CAN Node registers
1240 * \return None
1241 */
1242 IFX_INLINE void IfxCan_Node_acceptRemoteFramesWithStandardId(Ifx_CAN_N *node);
1243
1244 /** \brief Disables the selected interrupt
1245 * \param node Specifies the pointer to the CAN Node registers
1246 * \return None
1247 */
1248 IFX_INLINE void IfxCan_Node_acceptRemoteFrameswithExtendedId(Ifx_CAN_N *node);
1249
1250 /** \brief Configure the filter for non matching frames with extended id.
1251 * \param node Specifies the pointer to the CAN Node registers
1252 * \param filter action to be performed on non matching messages.
1253 * \return None
1254 */
1255 IFX_INLINE void IfxCan_Node_configureExtendedFilterForNonMatchingFrames(Ifx_CAN_N *node, IfxCan
1256
1257 /** \brief Configure the filter for non matching frames with standard id.
1258 * \param node Specifies the pointer to the CAN Node registers
1259 * \param filter action to be performed on non matching messages.
1260 * \return None
1261 */
1262 IFX_INLINE void IfxCan_Node_configureStandardFilterForNonMatchingFrames(Ifx_CAN_N *node, IfxCan
1263
1264 /** \brief Reject the remote frames with extended id.
1265 * \param node Specifies the pointer to the CAN Node registers
1266 * \return None
1267 */
1268 IFX_INLINE void IfxCan_Node_rejectRemoteFramesWithExtendedId(Ifx_CAN_N *node);
1269
1270 /** \brief Reject the remote frames with standard id.
1271 * \param node Specifies the pointer to the CAN Node registers
1272 * \return None
1273 */
1274 IFX_INLINE void IfxCan_Node_rejectRemoteFramesWithStandardId(Ifx_CAN_N *node);
1275
1276 /** \brief Sets the Extended Filter Element Configuration
1277 * \param extendedFilterElement Extended Filter Element

1278 * \param filterElementConfiguration Filter Element Configuration


1279 * \return None

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 25/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1280 */
1281 IFX_INLINE void IfxCan_Node_setExtendedFilterConfiguration(Ifx_CAN_EXTMSG *extendedFilterElemen
1282
1283 /** \brief Sets the Extended Filter ID 1 for Extended Filter Element
1284 * \param extendedFilterElement Extended Filter Element
1285 * \param id Filter ID 1
1286 * \return None
1287 */
1288 IFX_INLINE void IfxCan_Node_setExtendedFilterId1(Ifx_CAN_EXTMSG *extendedFilterElement, uint32
1289
1290 /** \brief Sets the Extended Filter ID 2 for Extended Filter Element
1291 * \param extendedFilterElement Extended Filter Element
1292 * \param id Filter ID 2
1293 * \return None
1294 */
1295 IFX_INLINE void IfxCan_Node_setExtendedFilterId2(Ifx_CAN_EXTMSG *extendedFilterElement, uint32
1296
1297 /** \brief Sets the Extended Message ID filter list size
1298 * \param node Specifies the pointer to the CAN Node registers
1299 * \param size Number of Extended Message ID filter elements
1300 * \return None
1301 */
1302 IFX_INLINE void IfxCan_Node_setExtendedFilterListSize(Ifx_CAN_N *node, uint8 size);
1303
1304 /** \brief Sets the start address of Extended Message ID filter list (32-bit word address)
1305 * \param node Specifies the pointer to the CAN Node registers
1306 * \param address Start address of Extended Message ID filter list in the Message RAM
1307 * \return None
1308 */
1309 IFX_INLINE void IfxCan_Node_setExtendedFilterListStartAddress(Ifx_CAN_N *node, uint16 address);
1310
1311 /** \brief Sets the Offset to the Rx Buffer Start Address RXBC.RBSA for storage of a matching m
1312 * \param extendedFilterElement Extended Filter Element
1313 * \param rxBufferNumber Offset to the Rx Buffer Start Address RXBC.RBSA for storage of a match
1314 * \return None
1315 */
1316 IFX_INLINE void IfxCan_Node_setExtendedFilterRxBufferOffset(Ifx_CAN_EXTMSG *extendedFilterEleme
1317
1318 /** \brief Sets the Extended Filter Type for Extended Filter Element
1319 * \param extendedFilterElement Extended Filter Element
1320 * \param filterType Filter Type
1321 * \return None
1322 */
1323 IFX_INLINE void IfxCan_Node_setExtendedFilterType(Ifx_CAN_EXTMSG *extendedFilterElement, IfxCan
1324
1325 /** \brief Sets the Standard Filter Element Configuration
1326 * \param standardFilterElement Standard Filter Element
1327 * \param filterElementConfiguration Filter Element Configuration
1328 * \return None
1329 */

1330 IFX_INLINE void IfxCan_Node_setStandardFilterConfiguration(Ifx_CAN_STDMSG *standardFilterElemen


1331

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 26/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1332 /** \brief Sets the Standard Filter ID 1 for Standard Filter Element
1333 * \param standardFilterElement Standard Filter Element
1334 * \param id Filter ID 1
1335 * \return None
1336 */
1337 IFX_INLINE void IfxCan_Node_setStandardFilterId1(Ifx_CAN_STDMSG *standardFilterElement, uint32
1338
1339 /** \brief Sets the Standard Filter ID 2 for Standard Filter Element
1340 * \param standardFilterElement Standard Filter Element
1341 * \param id Filter ID 2
1342 * \return None
1343 */
1344 IFX_INLINE void IfxCan_Node_setStandardFilterId2(Ifx_CAN_STDMSG *standardFilterElement, uint32
1345
1346 /** \brief Sets the Standard Message ID filter list size
1347 * \param node Specifies the pointer to the CAN Node registers
1348 * \param size Number of Standard Message ID filter elements
1349 * \return None
1350 */
1351 IFX_INLINE void IfxCan_Node_setStandardFilterListSize(Ifx_CAN_N *node, uint8 size);
1352
1353 /** \brief Sets the start address of Standard Message ID filter list (32-bit word address)
1354 * \param node Specifies the pointer to the CAN Node registers
1355 * \param address Start address of Standard Message ID filter in the Message RAM
1356 * \return None
1357 */
1358 IFX_INLINE void IfxCan_Node_setStandardFilterListStartAddress(Ifx_CAN_N *node, uint16 address);
1359
1360 /** \brief Sets the Offset to the Rx Buffer Start Address RXBC.RBSA for storage of a matching m
1361 * \param standardFilterElement Standard Filter Element
1362 * \param rxBufferNumber Offset to the Rx Buffer Start Address RXBC.RBSA for storage of a match
1363 * \return None
1364 */
1365 IFX_INLINE void IfxCan_Node_setStandardFilterRxBufferOffset(Ifx_CAN_STDMSG *standardFilterEleme
1366
1367 /** \brief Sets the Standard Filter Type for Standard Filter Element
1368 * \param standardFilterElement Standard Filter Element
1369 * \param filterType Filter Type
1370 * \return None
1371 */
1372 IFX_INLINE void IfxCan_Node_setStandardFilterType(Ifx_CAN_STDMSG *standardFilterElement, IfxCan
1373
1374 /******************************************************************************/
1375 /*-------------------------Global Function Prototypes-------------------------*/
1376 /******************************************************************************/
1377
1378 /** \brief Returns the address of selected extended filter element
1379 * \param ramBaseAddress Message RAM base address of CAN Module
1380 * \param extendedFilterListStartAddress Start address of Extended Message ID filter list (32-b
1381 * \param filterNumber extended filter element number

1382 * \return Extended Filter Element Address


1383 */

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 27/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1384 IFX_EXTERN Ifx_CAN_EXTMSG *IfxCan_Node_getExtendedFilterElementAddress(uint32 ramBaseAddress, u
1385
1386 /** \brief Returns the address of selected standard filter element
1387 * \param ramBaseAddress Message RAM base address of CAN Module
1388 * \param standardFilterListStartAddress Start address of Standard Message ID filter list (32-b
1389 * \param filterNumber Standard filter element number
1390 * \return Standard Filter Element Address
1391 */
1392 IFX_EXTERN Ifx_CAN_STDMSG *IfxCan_Node_getStandardFilterElementAddress(uint32 ramBaseAddress, u
1393
1394 /** \} */
1395
1396 /** \addtogroup IfxLld_Can_Std_Interrupt_Functions
1397 * \{ */
1398
1399 /******************************************************************************/
1400 /*-------------------------Inline Function Prototypes-------------------------*/
1401 /******************************************************************************/
1402
1403 /** \brief Clears the selected interrupt Flag
1404 * \param node Specifies the pointer to the CAN Node registers
1405 * \param interrupt Type of Interrupt
1406 * \return None
1407 */
1408 IFX_INLINE void IfxCan_Node_clearInterruptFlag(Ifx_CAN_N *node, IfxCan_Interrupt interrupt);
1409
1410 /** \brief Disables the selected interrupt
1411 * \param node Specifies the pointer to the CAN Node registers
1412 * \param interrupt Type of Interrupt
1413 * \return None
1414 */
1415 IFX_INLINE void IfxCan_Node_disableInterrupt(Ifx_CAN_N *node, IfxCan_Interrupt interrupt);
1416
1417 /** \brief Disables the Cancellation Finished Interrupt of the selected Tx buffer
1418 * \param node Specifies the pointer to the CAN Node registers
1419 * \param txBufferId Tx Buffer number
1420 * \return None
1421 */
1422 IFX_INLINE void IfxCan_Node_disableTxBufferCancellationFinishedInterrupt(Ifx_CAN_N *node, IfxCa
1423
1424 /** \brief Disables the Transmission Interrupt of the selected Tx buffer
1425 * \param node Specifies the pointer to the CAN Node registers
1426 * \param txBufferId Tx Buffer number
1427 * \return None
1428 */
1429 IFX_INLINE void IfxCan_Node_disableTxBufferTransmissionInterrupt(Ifx_CAN_N *node, IfxCan_TxBuff
1430
1431 /** \brief Enables the selected interrupt
1432 * \param node Specifies the pointer to the CAN Node registers
1433 * \param interrupt Type of Interrupt

1434 * \return None


1435 */

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 28/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1436 IFX_INLINE void IfxCan_Node_enableInterrupt(Ifx_CAN_N *node, IfxCan_Interrupt interrupt);
1437
1438 /** \brief Enables the Cancellation Finished Interrupt of the selected Tx buffer
1439 * \param node Specifies the pointer to the CAN Node registers
1440 * \param txBufferId Tx Buffer number
1441 * \return None
1442 */
1443 IFX_INLINE void IfxCan_Node_enableTxBufferCancellationFinishedInterrupt(Ifx_CAN_N *node, IfxCan
1444
1445 /** \brief Enables the Transmission Interrupt of the selected Tx buffer
1446 * \param node Specifies the pointer to the CAN Node registers
1447 * \param txBufferId Tx Buffer number
1448 * \return None
1449 */
1450 IFX_INLINE void IfxCan_Node_enableTxBufferTransmissionInterrupt(Ifx_CAN_N *node, IfxCan_TxBuffe
1451
1452 /** \brief Returns the status of selected interrupt flag
1453 * \param node Specifies the pointer to the CAN Node registers
1454 * \param interrupt Type of Interrupt
1455 * \return Status TRUE / FALSE
1456 */
1457 IFX_INLINE boolean IfxCan_Node_getInterruptFlagStatus(Ifx_CAN_N *node, IfxCan_Interrupt interru
1458
1459 /******************************************************************************/
1460 /*-------------------------Global Function Prototypes-------------------------*/
1461 /******************************************************************************/
1462
1463 /** \brief Sets the slected interrupt to the selcted interrupt line
1464 * \param node Specifies the pointer to the CAN Node registers
1465 * \param interruptGroup Type of Interrupt group
1466 * \param interruptLine Interrupt line number
1467 * \return None
1468 */
1469 IFX_EXTERN void IfxCan_Node_setGroupInterruptLine(Ifx_CAN_N *node, IfxCan_InterruptGroup interr
1470
1471 /** \brief Sets the slected interrupt to the selcted interrupt line
1472 * \param node Specifies the pointer to the CAN Node registers
1473 * \param interrupt Type of Interrupt
1474 * \param interruptLine Interrupt line number
1475 * \return None
1476 */
1477 IFX_EXTERN void IfxCan_Node_setInterruptLine(Ifx_CAN_N *node, IfxCan_Interrupt interrupt, IfxCa
1478
1479 /** \} */
1480
1481 /** \addtogroup IfxLld_Can_Std_Module_Functions
1482 * \{ */
1483
1484 /******************************************************************************/
1485 /*-------------------------Inline Function Prototypes-------------------------*/

1486 /******************************************************************************/
1487

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 29/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1488 /** \brief Returns the base adress of the selected Node of CAN module
1489 * \param can Specifies the pointer to the CAN registers
1490 * \param nodeId Node number of the module
1491 * \return Specifies the pointer to the CAN Node registers
1492 */
1493 IFX_INLINE Ifx_CAN_N *IfxCan_getNodePointer(Ifx_CAN *can, IfxCan_NodeId nodeId);
1494
1495 /** \brief Returns the status of module enabled or disabled
1496 * \param can Specifies the pointer to the CAN registers
1497 * \return Status (TRUE / FALSE)
1498 */
1499 IFX_INLINE boolean IfxCan_isModuleEnabled(Ifx_CAN *can);
1500
1501 /** \brief Returns the module's suspend state.
1502 * TRUE :if module is suspended.
1503 * FALSE:if module is not yet suspended.
1504 * \param can Pointer to CAN module registers
1505 * \return Suspend status (TRUE / FALSE)
1506 */
1507 IFX_INLINE boolean IfxCan_isModuleSuspended(Ifx_CAN *can);
1508
1509 /** \brief Sets the sensitivity of the module to sleep signal
1510 * \param can pointer to CAN registers
1511 * \param mode mode selection (enable/disable)
1512 * \return None
1513 */
1514 IFX_INLINE void IfxCan_setSleepMode(Ifx_CAN *can, IfxCan_SleepMode mode);
1515
1516 /** \brief Set the Module to Hard/Soft suspend mode.
1517 * Note: The api works only when the OCDS is enabled and in Supervisor Mode. When OCDS is disab
1518 * \param can Pointer to CAN module registers
1519 * \param mode Module suspend mode
1520 * \return None
1521 */
1522 IFX_INLINE void IfxCan_setSuspendMode(Ifx_CAN *can, IfxCan_SuspendMode mode);
1523
1524 /******************************************************************************/
1525 /*-------------------------Global Function Prototypes-------------------------*/
1526 /******************************************************************************/
1527
1528 /** \brief Disables the module (sets the disable request)
1529 * \param can Specifies the pointer to the CAN registers
1530 * \return None
1531 */
1532 IFX_EXTERN void IfxCan_disableModule(Ifx_CAN *can);
1533
1534 /** \brief Enables the module (clears the disable request)
1535 * \param can Specifies the pointer to the CAN registers
1536 * \return None
1537 */

1538 IFX_EXTERN void IfxCan_enableModule(Ifx_CAN *can);


1539

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 30/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1540 /**
1541 * \param can Module index of the CAN
1542 * \return CAN module register address
1543 */
1544 IFX_EXTERN Ifx_CAN *IfxCan_getAddress(IfxCan_Index can);
1545
1546 /** \brief API to get the resource index of the CAN specified.
1547 * \return can resource index
1548 */
1549 IFX_EXTERN IfxCan_Index IfxCan_getIndex(Ifx_CAN *can);
1550
1551 /** \brief Returns the operatinf frequency of the CAN module
1552 * \return Module Frequency
1553 */
1554 IFX_EXTERN float32 IfxCan_getModuleFrequency(void);
1555
1556 /** \brief resets CAN kernel
1557 * \param can pointer to CAN registers
1558 * \return None
1559 */
1560 IFX_EXTERN void IfxCan_resetModule(Ifx_CAN *can);
1561
1562 /** \brief sets the clocksource selection
1563 * \param can Specifies the pointer to the CAN registers
1564 * \param clockSelect Clock selection option
1565 * \param clockSource Type of Clock Source selection
1566 * \return None
1567 */
1568 IFX_EXTERN void IfxCan_setClockSource(Ifx_CAN *can, IfxCan_ClockSelect clockSelect, IfxCan_Cloc
1569
1570 /** \} */
1571
1572 /** \addtogroup IfxLld_Can_Std_Tx_Event_FIFO_Element_Functions
1573 * \{ */
1574
1575 /******************************************************************************/
1576 /*-------------------------Inline Function Prototypes-------------------------*/
1577 /******************************************************************************/
1578
1579 /** \brief Returns the Bit Rate Switch (BRS) from the Tx Event Fifo element
1580 * \param txEventFifoElement Tx Event FIFO Element
1581 * \return Bit Rate Switch (TRUE/FALSE)
1582 */
1583 IFX_INLINE boolean IfxCan_Node_getBRSFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement);
1584
1585 /** \brief Returns the Data Length Code from the Tx Event Fifo Element
1586 * \param txEventFifoElement Tx Event Fifo Element
1587 * \return Data Length Code
1588 */
1589 IFX_INLINE uint32 IfxCan_Node_getDLCFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement);

1590
1591 /** \brief Returns the Error State Indicator (ESI) from the Tx Event Fifo element

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 31/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1592 * \param txEventFifoElement Tx Event FIFO Element
1593 * \return Error State Indicator
1594 */
1595 IFX_INLINE boolean IfxCan_Node_getESIFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement);
1596
1597 /** \brief Returns the FD Format (FDF) from the Tx Event Fifo element
1598 * \param txEventFifoElement Tx Event FIFO Element
1599 * \return FD format (TRUE/FALSE)
1600 */
1601 IFX_INLINE boolean IfxCan_Node_getFDFFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement);
1602
1603 /** \brief Returns the Message Marker (MM) from the Tx Event Fifo element
1604 * \param txEventFifoElement Tx Event FIFO Element
1605 * \return Message Marker
1606 */
1607 IFX_INLINE uint8 IfxCan_Node_getMMFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement);
1608
1609 /** \brief Returns the identifier (ID) from the Tx Event Fifo element
1610 * \param txEventFifoElement Tx Event FIFO Element
1611 * \return Identifier
1612 */
1613 IFX_INLINE uint32 IfxCan_Node_getMesssageIdFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement)
1614
1615 /** \brief Returns the Remote Transmission Request Status (RTR) from the Tx Event Fifo element
1616 * \param txEventFifoElement Tx Event FIFO Element
1617 * \return Remote Transmission Request Status
1618 */
1619 IFX_INLINE boolean IfxCan_Node_getRTRFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement);
1620
1621 /** \brief Returns the Tx Time Stamp (TXTS) from the Tx Event Fifo element
1622 * \param txEventFifoElement Tx Event FIFO Element
1623 * \return Tx Time Stamp
1624 */
1625 IFX_INLINE uint16 IfxCan_Node_getTXTSFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement);
1626
1627 /** \brief Returns the Tx Event Fifo Acknowledge Index
1628 * \param node Specifies the pointer to the CAN Node registers
1629 * \return Returns Tx Event Fifo Acknowledge Index
1630 */
1631 IFX_INLINE uint8 IfxCan_Node_getTxEventFifoAcknowledgeIndex(Ifx_CAN_N *node);
1632
1633 /** \brief Returns the Tx Event Fifo Fill Level
1634 * \param node Specifies the pointer to the CAN Node registers
1635 * \return Returns Tx Event Fifo Fill Level
1636 */
1637 IFX_INLINE uint8 IfxCan_Node_getTxEventFifoFillLevel(Ifx_CAN_N *node);
1638
1639 /** \brief Returns the Tx Event Fifo Get Index
1640 * \param node Specifies the pointer to the CAN Node registers
1641 * \return Returns Tx Event Fifo Get Index

1642 */
1643 IFX_INLINE uint8 IfxCan_Node_getTxEventFifoGetIndex(Ifx_CAN_N *node);

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 32/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1644
1645 /** \brief Returns the Tx Event Fifo Put Index
1646 * \param node Specifies the pointer to the CAN Node registers
1647 * \return Returns Tx Event Fifo Put Index
1648 */
1649 IFX_INLINE uint8 IfxCan_Node_getTxEventFifoPutIndex(Ifx_CAN_N *node);
1650
1651 /** \brief Returns Tx Event Fifo Size
1652 * \param node Specifies the pointer to the CAN Node registers
1653 * \return Tx Event Fifo Size
1654 */
1655 IFX_INLINE uint8 IfxCan_Node_getTxEventFifoSize(Ifx_CAN_N *node);
1656
1657 /** \brief Returns Tx Event Fifo Start Address
1658 * \param node Specifies the pointer to the CAN Node registers
1659 * \return Tx Event Fifo Start Address
1660 */
1661 IFX_INLINE uint16 IfxCan_Node_getTxEventFifoStartAddress(Ifx_CAN_N *node);
1662
1663 /** \brief Returns Tx Event Fifo Watermark Level
1664 * \param node Specifies the pointer to the CAN Node registers
1665 * \return Tx Event Fifo Watermark Level
1666 */
1667 IFX_INLINE uint8 IfxCan_Node_getTxEventFifoWatermarkLevel(Ifx_CAN_N *node);
1668
1669 /** \brief Returns the status of Tx Event Fifo Element lost
1670 * \param node Specifies the pointer to the CAN Node registers
1671 * \return Returns status of Tx Event Fifo Element Lost\n
1672 * True : elemnt lost\n
1673 * False : element not lost
1674 */
1675 IFX_INLINE boolean IfxCan_Node_isTxEventFifoElementLost(Ifx_CAN_N *node);
1676
1677 /** \brief Returns the status of Tx Event Fifo Full
1678 * \param node Specifies the pointer to the CAN Node registers
1679 * \return Returns status of Tx Event Fifo Full\n
1680 * True : Fifo full\n
1681 * False : Fifo not full
1682 */
1683 IFX_INLINE boolean IfxCan_Node_isTxEventFifoFull(Ifx_CAN_N *node);
1684
1685 /** \brief Sets Tx Event Fifo Size
1686 * \param node Specifies the pointer to the CAN Node registers
1687 * \param size Tx Event Fifo Size
1688 * \return None
1689 */
1690 IFX_INLINE void IfxCan_Node_setTxEventFifoSize(Ifx_CAN_N *node, uint8 size);
1691
1692 /** \brief Sets Tx Event Fifo Start Address
1693 * \param node Specifies the pointer to the CAN Node registers

1694 * \param address Tx Event Fifo Start Address


1695 * \return None

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 33/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1696 */
1697 IFX_INLINE void IfxCan_Node_setTxEventFifoStartAddress(Ifx_CAN_N *node, uint16 address);
1698
1699 /** \brief Sets Tx Event Fifo Watermark Level
1700 * \param node Specifies the pointer to the CAN Node registers
1701 * \param level Tx Event Fifo Watermark Level
1702 * \return None
1703 */
1704 IFX_INLINE void IfxCan_Node_setTxEventFifoWatermarkLevel(Ifx_CAN_N *node, uint8 level);
1705
1706 /******************************************************************************/
1707 /*-------------------------Global Function Prototypes-------------------------*/
1708 /******************************************************************************/
1709
1710 /** \brief Returns CAN frame mode of operation for a Tx Event Fifo Element
1711 * \param txEventFifoElement Tx Event Fifo Element
1712 * \return CAN frame mode
1713 */
1714 IFX_EXTERN IfxCan_FrameMode IfxCan_Node_getFrameModeFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFif
1715
1716 /** \brief Returns the address of selected Tx Event Fifo element
1717 * \param ramBaseAddress Message RAM base address of CAN module
1718 * \param txEventFifoStartAddress Start address of Tx Event Fifo section in the Message RAM
1719 * \param txEventFifoNumber Tx Event Fifo element number
1720 * \return Tx Event Fifo Element Address
1721 */
1722 IFX_EXTERN Ifx_CAN_TXEVENT *IfxCan_Node_getTxEventFifoElementAddress(uint32 ramBaseAddress, uin
1723
1724 /** \} */
1725
1726 /******************************************************************************/
1727 /*-------------------------Inline Function Prototypes-------------------------*/
1728 /******************************************************************************/
1729
1730 /** \brief CAN frame format of the last received message.
1731 * TRUE: CAN FD frame received
1732 * FALSE: CAN FD frame not received
1733 * \param node Specifies the pointer to CAN node registers
1734 * \return CAN Frame format (TRUE/FALSE)
1735 */
1736 IFX_INLINE boolean IfxCan_Node_isCanFDMsgReceived(Ifx_CAN_N *node);
1737
1738 /******************************************************************************/
1739 /*-------------------------Global Function Prototypes-------------------------*/
1740 /******************************************************************************/
1741
1742 /** \brief Returns the address of interrupt node source register
1743 * \param can Specifies the pointer to the CAN registers
1744 * \param interruptLine Interrupt line number
1745 * \return Address of interrupt node source register

1746 */
1747 IFX_EXTERN volatile Ifx_SRC_SRCR *IfxCan_getSrcPointer(Ifx_CAN *can, IfxCan_InterruptLine inter

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 34/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1748
1749 /******************************************************************************/
1750 /*---------------------Inline Function Implementations------------------------*/
1751 /******************************************************************************/
1752
1753 IFX_INLINE void IfxCan_Node_acceptRemoteFramesWithStandardId(Ifx_CAN_N *node)
1754 {
1755 node->GFC.B.RRFS = 0U;
1756 }
1757
1758
1759 IFX_INLINE void IfxCan_Node_acceptRemoteFrameswithExtendedId(Ifx_CAN_N *node)
1760 {
1761 node->GFC.B.RRFE = 0U;
1762 }
1763
1764
1765 IFX_INLINE void IfxCan_Node_clearInterruptFlag(Ifx_CAN_N *node, IfxCan_Interrupt interrupt)
1766 {
1767 uint32 value = (1U << interrupt);
1768 node->IR.U = value;
1769 }
1770
1771
1772 IFX_INLINE void IfxCan_Node_configureExtendedFilterForNonMatchingFrames(Ifx_CAN_N *node, IfxCan
1773 {
1774 node->GFC.B.ANFE = filter;
1775 }
1776
1777
1778 IFX_INLINE void IfxCan_Node_configureStandardFilterForNonMatchingFrames(Ifx_CAN_N *node, IfxCan
1779 {
1780 node->GFC.B.ANFS = filter;
1781 }
1782
1783
1784 IFX_INLINE void IfxCan_Node_disableConfigurationChange(Ifx_CAN_N *node)
1785 {
1786 node->CCCR.B.CCE = 0;
1787
1788 while (node->CCCR.B.CCE != 0)
1789 {}
1790
1791 node->CCCR.B.INIT = 0;
1792
1793 while (node->CCCR.B.INIT != 0)
1794 {}
1795 }
1796
1797

1798 IFX_INLINE void IfxCan_Node_disableInterrupt(Ifx_CAN_N *node, IfxCan_Interrupt interrupt)


1799 {

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 35/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1800 uint32 mask = (1U << interrupt);
1801 node->IE.U = node->IE.U & ~(mask);
1802 }
1803
1804
1805 IFX_INLINE void IfxCan_Node_disableTxBufferCancellationFinishedInterrupt(Ifx_CAN_N *node, IfxCa
1806 {
1807 uint32 mask = (1U << txBufferId);
1808 node->TX.BCIE.U = node->TX.BCIE.U & ~(mask);
1809 }
1810
1811
1812 IFX_INLINE void IfxCan_Node_disableTxBufferTransmissionInterrupt(Ifx_CAN_N *node, IfxCan_TxBuff
1813 {
1814 uint32 mask = (1U << txBufferId);
1815 node->TX.BTIE.U = node->TX.BTIE.U & ~(mask);
1816 }
1817
1818
1819 IFX_INLINE void IfxCan_Node_enableConfigurationChange(Ifx_CAN_N *node)
1820 {
1821 Ifx_CAN_N_CCCR cccr;
1822
1823 /* If INIT already set, clear it before setting again. */
1824 /* The module needs some time if INIT was rewritten !*/
1825 if (node->CCCR.B.INIT == 1)
1826 {
1827 node->CCCR.B.CCE = 0;
1828
1829 while (node->CCCR.B.CCE != 0)
1830 {}
1831
1832 node->CCCR.B.INIT = 0;
1833
1834 while (node->CCCR.B.INIT != 0)
1835 {}
1836 }
1837
1838 node->CCCR.B.INIT = 1;
1839
1840 while (node->CCCR.B.INIT != 1)
1841 {}
1842
1843 {
1844 cccr.U = node->CCCR.U;
1845 cccr.B.INIT = 1;
1846 cccr.B.CCE = 1;
1847 node->CCCR.U = cccr.U;
1848 }
1849 }

1850
1851

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 36/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1852 IFX_INLINE void IfxCan_Node_enableInterrupt(Ifx_CAN_N *node, IfxCan_Interrupt interrupt)
1853 {
1854 uint32 mask = (1U << interrupt);
1855 node->IE.U = node->IE.U | (mask);
1856 }
1857
1858
1859 IFX_INLINE void IfxCan_Node_enableLoopbackMode(Ifx_CAN_N *node)
1860 {
1861 node->NPCR.B.LBM = 1;
1862 }
1863
1864
1865 IFX_INLINE void IfxCan_Node_enableTxBufferCancellationFinishedInterrupt(Ifx_CAN_N *node, IfxCan
1866 {
1867 uint32 mask = (1U << txBufferId);
1868 node->TX.BCIE.U = node->TX.BCIE.U | (mask);
1869 }
1870
1871
1872 IFX_INLINE void IfxCan_Node_enableTxBufferTransmissionInterrupt(Ifx_CAN_N *node, IfxCan_TxBuffe
1873 {
1874 uint32 mask = (1U << txBufferId);
1875 node->TX.BTIE.U = node->TX.BTIE.U | (mask);
1876 }
1877
1878
1879 IFX_INLINE boolean IfxCan_Node_getBRSFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement)
1880 {
1881 return txEventFifoElement->E1.B.BRS;
1882 }
1883
1884
1885 IFX_INLINE uint32 IfxCan_Node_getDLCFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement)
1886 {
1887 return (IfxCan_DataLengthCode)txEventFifoElement->E1.B.DLC;
1888 }
1889
1890
1891 IFX_INLINE uint32 IfxCan_Node_getDataLengthCode(Ifx_CAN_RXMSG *rxBufferElement)
1892 {
1893 return (IfxCan_DataLengthCode)rxBufferElement->R1.B.DLC;
1894 }
1895
1896
1897 IFX_INLINE boolean IfxCan_Node_getESIFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement)
1898 {
1899 return txEventFifoElement->E0.B.ESI;
1900 }
1901

1902
1903 IFX_INLINE boolean IfxCan_Node_getFDFFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement)

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 37/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1904 {
1905 return txEventFifoElement->E1.B.FDF;
1906 }
1907
1908
1909 IFX_INLINE boolean IfxCan_Node_getInterruptFlagStatus(Ifx_CAN_N *node, IfxCan_Interrupt interru
1910 {
1911 uint32 mask = (1U << interrupt);
1912 boolean status = (node->IR.U & mask) != 0;
1913 return status;
1914 }
1915
1916
1917 IFX_INLINE uint8 IfxCan_Node_getMMFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement)
1918 {
1919 return (uint8)txEventFifoElement->E1.B.MM;
1920 }
1921
1922
1923 IFX_INLINE uint32 IfxCan_Node_getMesssageId(Ifx_CAN_RXMSG *rxBufferElement)
1924 {
1925 /* get identifier extention */
1926 IfxCan_MessageIdLength messageIdLength = (IfxCan_MessageIdLength)rxBufferElement->R0.B.XTD;
1927
1928 /* get identifier */
1929 return rxBufferElement->R0.B.ID >> ((messageIdLength != IfxCan_MessageIdLength_standard) ?
1930 }
1931
1932
1933 IFX_INLINE uint32 IfxCan_Node_getMesssageIdFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement)
1934 {
1935 /* get identifier extention */
1936 IfxCan_MessageIdLength messageIdLength = (IfxCan_MessageIdLength)txEventFifoElement->E0.B.X
1937
1938 /* get identifier */
1939 return txEventFifoElement->E0.B.ID >> ((messageIdLength != IfxCan_MessageIdLength_standard)
1940 }
1941
1942
1943 IFX_INLINE boolean IfxCan_Node_getRTRFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement)
1944 {
1945 return txEventFifoElement->E0.B.RTR;
1946 }
1947
1948
1949 IFX_INLINE uint8 IfxCan_Node_getRxFifo0FillLevel(Ifx_CAN_N *node)
1950 {
1951 return node->RX.F0S.B.F0FL;
1952 }
1953

1954
1955 IFX_INLINE IfxCan_RxBufferId IfxCan_Node_getRxFifo0GetIndex(Ifx_CAN_N *node)

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 38/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
1956 {
1957 return (IfxCan_RxBufferId)node->RX.F0S.B.F0GI;
1958 }
1959
1960
1961 IFX_INLINE uint8 IfxCan_Node_getRxFifo1FillLevel(Ifx_CAN_N *node)
1962 {
1963 return node->RX.F1S.B.F1FL;
1964 }
1965
1966
1967 IFX_INLINE IfxCan_RxBufferId IfxCan_Node_getRxFifo1GetIndex(Ifx_CAN_N *node)
1968 {
1969 return (IfxCan_RxBufferId)node->RX.F1S.B.F1GI;
1970 }
1971
1972
1973 IFX_INLINE uint16 IfxCan_Node_getTXTSFromTxEventFifo(Ifx_CAN_TXEVENT *txEventFifoElement)
1974 {
1975 return (uint16)txEventFifoElement->E1.B.TXTS;
1976 }
1977
1978
1979 IFX_INLINE uint8 IfxCan_Node_getTxEventFifoAcknowledgeIndex(Ifx_CAN_N *node)
1980 {
1981 return (uint8)node->TX.EFA.B.EFAI;
1982 }
1983
1984
1985 IFX_INLINE uint8 IfxCan_Node_getTxEventFifoFillLevel(Ifx_CAN_N *node)
1986 {
1987 return (uint8)node->TX.EFS.B.EFFL;
1988 }
1989
1990
1991 IFX_INLINE uint8 IfxCan_Node_getTxEventFifoGetIndex(Ifx_CAN_N *node)
1992 {
1993 return (uint8)node->TX.EFS.B.EFGI;
1994 }
1995
1996
1997 IFX_INLINE uint8 IfxCan_Node_getTxEventFifoPutIndex(Ifx_CAN_N *node)
1998 {
1999 return (uint8)node->TX.EFS.B.EFPI;
2000 }
2001
2002
2003 IFX_INLINE uint8 IfxCan_Node_getTxEventFifoSize(Ifx_CAN_N *node)
2004 {
2005 return (uint8)node->TX.EFC.B.EFS;

2006 }
2007

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 39/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
2008
2009 IFX_INLINE uint16 IfxCan_Node_getTxEventFifoStartAddress(Ifx_CAN_N *node)
2010 {
2011 return (uint16)node->TX.EFC.B.EFSA;
2012 }
2013
2014
2015 IFX_INLINE uint8 IfxCan_Node_getTxEventFifoWatermarkLevel(Ifx_CAN_N *node)
2016 {
2017 return (uint8)node->TX.EFC.B.EFWM;
2018 }
2019
2020
2021 IFX_INLINE IfxCan_TxBufferId IfxCan_Node_getTxFifoQueuePutIndex(Ifx_CAN_N *node)
2022 {
2023 return (IfxCan_TxBufferId)node->TX.FQS.B.TFQPI;
2024 }
2025
2026
2027 IFX_INLINE boolean IfxCan_Node_isNodeSynchronized(Ifx_CAN_N *node)
2028 {
2029 return (boolean)((node->PSR.B.ACT != 0) ? 1 : 0);
2030 }
2031
2032
2033 IFX_INLINE boolean IfxCan_Node_isTxBufferCancellationFinished(Ifx_CAN_N *node, IfxCan_TxBufferI
2034 {
2035 uint32 mask = (1U << txBufferId);
2036 boolean tempVar = (boolean)(node->TX.BTO.U & mask);
2037 return tempVar;
2038 }
2039
2040
2041 IFX_INLINE boolean IfxCan_Node_isTxBufferRequestPending(Ifx_CAN_N *node, IfxCan_TxBufferId txBu
2042 {
2043 uint32 mask = (1U << txBufferId);
2044 boolean tempVar = (boolean)(node->TX.BRP.U & mask);
2045 return tempVar;
2046 }
2047
2048
2049 IFX_INLINE boolean IfxCan_Node_isTxBufferTransmissionOccured(Ifx_CAN_N *node, IfxCan_TxBufferId
2050 {
2051 uint32 mask = (1U << txBufferId);
2052 return (boolean)(node->TX.BTO.U & mask);
2053 }
2054
2055
2056 IFX_INLINE boolean IfxCan_Node_isTxEventFifoElementLost(Ifx_CAN_N *node)
2057 {

2058 return node->TX.EFS.B.TEFL;


2059 }

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 40/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
2060
2061
2062 IFX_INLINE boolean IfxCan_Node_isTxEventFifoFull(Ifx_CAN_N *node)
2063 {
2064 return node->TX.EFS.B.EFF;
2065 }
2066
2067
2068 IFX_INLINE boolean IfxCan_Node_isTxFifoQueueFull(Ifx_CAN_N *node)
2069 {
2070 return node->TX.FQS.B.TFQF;
2071 }
2072
2073
2074 IFX_INLINE void IfxCan_Node_pauseTransmission(Ifx_CAN_N *node, boolean enable)
2075 {
2076 node->CCCR.B.TXP = enable ? 1 : 0;
2077 }
2078
2079
2080 IFX_INLINE void IfxCan_Node_rejectRemoteFramesWithExtendedId(Ifx_CAN_N *node)
2081 {
2082 node->GFC.B.RRFE = 1U;
2083 }
2084
2085
2086 IFX_INLINE void IfxCan_Node_rejectRemoteFramesWithStandardId(Ifx_CAN_N *node)
2087 {
2088 node->GFC.B.RRFS = 1U;
2089 }
2090
2091
2092 IFX_INLINE void IfxCan_Node_setDataLength(Ifx_CAN_TXMSG *txBufferElement, IfxCan_DataLengthCode
2093 {
2094 txBufferElement->T1.B.DLC = dataLengthCode;
2095 }
2096
2097
2098 IFX_INLINE void IfxCan_Node_setDataLengthCode(Ifx_CAN_N *node, Ifx_CAN_TXMSG *txBufferElement,
2099 {
2100 IFX_UNUSED_PARAMETER(node);
2101 txBufferElement->T1.B.DLC = dataLengthCode;
2102 }
2103
2104
2105 IFX_INLINE void IfxCan_Node_setDedicatedTxBuffersNumber(Ifx_CAN_N *node, uint8 number)
2106 {
2107 node->TX.BC.B.NDTB = number;
2108 }
2109

2110
2111 IFX_INLINE void IfxCan_Node_setErrStateIndicator(Ifx_CAN_TXMSG *txBufferElement, boolean enable

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 41/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
2112 {
2113 txBufferElement->T0.B.ESI = enable ? 1 : 0;
2114 }
2115
2116
2117 IFX_INLINE void IfxCan_Node_setErrorStateIndicator(Ifx_CAN_N *node, Ifx_CAN_TXMSG *txBufferElem
2118 {
2119 IFX_UNUSED_PARAMETER(node);
2120 txBufferElement->T0.B.ESI = enable ? 1 : 0;
2121 }
2122
2123
2124 IFX_INLINE void IfxCan_Node_setExtendedFilterConfiguration(Ifx_CAN_EXTMSG *extendedFilterElemen
2125 {
2126 extendedFilterElement->F0.B.EFEC = filterElementConfiguration;
2127 }
2128
2129
2130 IFX_INLINE void IfxCan_Node_setExtendedFilterId1(Ifx_CAN_EXTMSG *extendedFilterElement, uint32
2131 {
2132 extendedFilterElement->F0.B.EFID1 = id;
2133 }
2134
2135
2136 IFX_INLINE void IfxCan_Node_setExtendedFilterId2(Ifx_CAN_EXTMSG *extendedFilterElement, uint32
2137 {
2138 extendedFilterElement->F1.B.EFID2 = id;
2139 }
2140
2141
2142 IFX_INLINE void IfxCan_Node_setExtendedFilterListSize(Ifx_CAN_N *node, uint8 size)
2143 {
2144 node->XIDFC.B.LSE = size;
2145 }
2146
2147
2148 IFX_INLINE void IfxCan_Node_setExtendedFilterListStartAddress(Ifx_CAN_N *node, uint16 address)
2149 {
2150 node->XIDFC.B.FLESA = address >> 2;
2151 }
2152
2153
2154 IFX_INLINE void IfxCan_Node_setExtendedFilterRxBufferOffset(Ifx_CAN_EXTMSG *extendedFilterEleme
2155 {
2156 extendedFilterElement->F1.B.EFID2 = (uint8)rxBufferNumber;
2157 }
2158
2159
2160 IFX_INLINE void IfxCan_Node_setExtendedFilterType(Ifx_CAN_EXTMSG *extendedFilterElement, IfxCan
2161 {

2162 extendedFilterElement->F1.B.EFT = filterType;


2163 }

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 42/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
2164
2165
2166 IFX_INLINE void IfxCan_Node_setInitialisation(Ifx_CAN_N *node, boolean enable)
2167 {
2168 node->CCCR.B.INIT = enable ? 1 : 0;
2169 }
2170
2171
2172 IFX_INLINE void IfxCan_Node_setMessageMarker(Ifx_CAN_TXMSG *txBufferElement, IfxCan_TxBufferId
2173 {
2174 txBufferElement->T1.B.MM = bufferId;
2175 }
2176
2177
2178 IFX_INLINE void IfxCan_Node_setMsgId(Ifx_CAN_TXMSG *txBufferElement, uint32 messageId, IfxCan_M
2179 {
2180 /* set identifier extention */
2181 txBufferElement->T0.B.XTD = (messageIdLength != IfxCan_MessageIdLength_extended) ? 0 : 1;
2182 /* set identifier */
2183 txBufferElement->T0.B.ID = messageId << ((messageIdLength != IfxCan_MessageIdLength_standa
2184 }
2185
2186
2187 IFX_INLINE void IfxCan_Node_setMesssageId(Ifx_CAN_N *node, Ifx_CAN_TXMSG *txBufferElement, uint
2188 {
2189 IFX_UNUSED_PARAMETER(node);
2190 /* set identifier extention */
2191 txBufferElement->T0.B.XTD = (messageIdLength != IfxCan_MessageIdLength_extended) ? 0 : 1;
2192 /* set identifier */
2193 txBufferElement->T0.B.ID = messageId << ((messageIdLength != IfxCan_MessageIdLength_standa
2194 }
2195
2196
2197 IFX_INLINE void IfxCan_Node_setRemoteTransmitReq(Ifx_CAN_TXMSG *txBufferElement, boolean enable
2198 {
2199 txBufferElement->T0.B.RTR = enable ? 1 : 0;
2200 }
2201
2202
2203 IFX_INLINE void IfxCan_Node_setRemoteTransmitRequest(Ifx_CAN_N *node, Ifx_CAN_TXMSG *txBufferEl
2204 {
2205 IFX_UNUSED_PARAMETER(node);
2206 txBufferElement->T0.B.RTR = enable ? 1 : 0;
2207 }
2208
2209
2210 IFX_INLINE void IfxCan_Node_setRxBufferDataFieldSize(Ifx_CAN_N *node, IfxCan_DataFieldSize size
2211 {
2212 node->RX.ESC.B.RBDS = size;
2213 }

2214
2215

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 43/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
2216 IFX_INLINE void IfxCan_Node_setRxBuffersStartAddress(Ifx_CAN_N *node, uint16 address)
2217 {
2218 node->RX.BC.B.RBSA = address >> 2;
2219 }
2220
2221
2222 IFX_INLINE void IfxCan_Node_setRxFifo0AcknowledgeIndex(Ifx_CAN_N *node, IfxCan_RxBufferId RxBuf
2223 {
2224 node->RX.F0A.B.F0AI = RxBufferNumber;
2225 }
2226
2227
2228 IFX_INLINE void IfxCan_Node_setRxFifo0DataFieldSize(Ifx_CAN_N *node, IfxCan_DataFieldSize size)
2229 {
2230 node->RX.ESC.B.F0DS = size;
2231 }
2232
2233
2234 IFX_INLINE void IfxCan_Node_setRxFifo0OperatingMode(Ifx_CAN_N *node, IfxCan_RxFifoMode mode)
2235 {
2236 node->RX.F0C.B.F0OM = mode;
2237 }
2238
2239
2240 IFX_INLINE void IfxCan_Node_setRxFifo0Size(Ifx_CAN_N *node, uint8 size)
2241 {
2242 node->RX.F0C.B.F0S = size;
2243 }
2244
2245
2246 IFX_INLINE void IfxCan_Node_setRxFifo0StartAddress(Ifx_CAN_N *node, uint16 address)
2247 {
2248 node->RX.F0C.B.F0SA = address >> 2;
2249 }
2250
2251
2252 IFX_INLINE void IfxCan_Node_setRxFifo0WatermarkLevel(Ifx_CAN_N *node, uint8 level)
2253 {
2254 node->RX.F0C.B.F0WM = level;
2255 }
2256
2257
2258 IFX_INLINE void IfxCan_Node_setRxFifo1AcknowledgeIndex(Ifx_CAN_N *node, IfxCan_RxBufferId RxBuf
2259 {
2260 node->RX.F1A.B.F1AI = RxBufferNumber;
2261 }
2262
2263
2264 IFX_INLINE void IfxCan_Node_setRxFifo1DataFieldSize(Ifx_CAN_N *node, IfxCan_DataFieldSize size)
2265 {

2266 node->RX.ESC.B.F1DS = size;


2267 }

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 44/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
2268
2269
2270 IFX_INLINE void IfxCan_Node_setRxFifo1OperatingMode(Ifx_CAN_N *node, IfxCan_RxFifoMode mode)
2271 {
2272 node->RX.F1C.B.F1OM = mode;
2273 }
2274
2275
2276 IFX_INLINE void IfxCan_Node_setRxFifo1Size(Ifx_CAN_N *node, uint8 size)
2277 {
2278 node->RX.F1C.B.F1S = size;
2279 }
2280
2281
2282 IFX_INLINE void IfxCan_Node_setRxFifo1StartAddress(Ifx_CAN_N *node, uint16 address)
2283 {
2284 node->RX.F1C.B.F1SA = address >> 2;
2285 }
2286
2287
2288 IFX_INLINE void IfxCan_Node_setRxFifo1WatermarkLevel(Ifx_CAN_N *node, uint8 level)
2289 {
2290 node->RX.F1C.B.F1WM = level;
2291 }
2292
2293
2294 IFX_INLINE void IfxCan_Node_setStandardFilterConfiguration(Ifx_CAN_STDMSG *standardFilterElemen
2295 {
2296 standardFilterElement->S0.B.SFEC = filterElementConfiguration;
2297 }
2298
2299
2300 IFX_INLINE void IfxCan_Node_setStandardFilterId1(Ifx_CAN_STDMSG *standardFilterElement, uint32
2301 {
2302 standardFilterElement->S0.B.SFID1 = id;
2303 }
2304
2305
2306 IFX_INLINE void IfxCan_Node_setStandardFilterId2(Ifx_CAN_STDMSG *standardFilterElement, uint32
2307 {
2308 standardFilterElement->S0.B.SFID2 = id;
2309 }
2310
2311
2312 IFX_INLINE void IfxCan_Node_setStandardFilterListSize(Ifx_CAN_N *node, uint8 size)
2313 {
2314 node->SIDFC.B.LSS = size;
2315 }
2316
2317

2318 IFX_INLINE void IfxCan_Node_setStandardFilterListStartAddress(Ifx_CAN_N *node, uint16 address)


2319 {

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 45/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
2320 node->SIDFC.B.FLSSA = address >> 2;
2321 }
2322
2323
2324 IFX_INLINE void IfxCan_Node_setStandardFilterRxBufferOffset(Ifx_CAN_STDMSG *standardFilterEleme
2325 {
2326 standardFilterElement->S0.B.SFID2 = (uint8)rxBufferNumber;
2327 }
2328
2329
2330 IFX_INLINE void IfxCan_Node_setStandardFilterType(Ifx_CAN_STDMSG *standardFilterElement, IfxCan
2331 {
2332 standardFilterElement->S0.B.SFT = filterType;
2333 }
2334
2335
2336 IFX_INLINE void IfxCan_Node_setTransceiverDelayCompensationOffset(Ifx_CAN_N *node, uint8 delay)
2337 {
2338 /* enable Transceiver Delay Compensation */
2339 node->DBTP.B.TDC = 1;
2340 /* set Transceiver Delay Compensation offset */
2341 node->TDCR.B.TDCO = delay;
2342 }
2343
2344
2345 IFX_INLINE void IfxCan_Node_setTransmitFifoQueueMode(Ifx_CAN_N *node, IfxCan_TxMode mode)
2346 {
2347 if ((mode == IfxCan_TxMode_fifo) || (mode == IfxCan_TxMode_queue))
2348 {
2349 node->TX.BC.B.TFQM = mode;
2350 }
2351 else
2352 {
2353 IFX_ASSERT(IFX_VERBOSE_LEVEL_ERROR, FALSE); /* wrong selection */
2354 }
2355 }
2356
2357
2358 IFX_INLINE void IfxCan_Node_setTransmitFifoQueueSize(Ifx_CAN_N *node, uint8 number)
2359 {
2360 node->TX.BC.B.TFQS = number;
2361 }
2362
2363
2364 IFX_INLINE void IfxCan_Node_setTxBufferAddRequest(Ifx_CAN_N *node, IfxCan_TxBufferId txBufferId
2365 {
2366 uint32 mask = (1U << txBufferId);
2367 node->TX.BAR.U = node->TX.BAR.U | (mask);
2368 }
2369

2370
2371 IFX_INLINE void IfxCan_Node_setTxBufferCancellationRequest(Ifx_CAN_N *node, IfxCan_TxBufferId t

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 46/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
2372 {
2373 uint32 mask = (1U << txBufferId);
2374 node->TX.BCR.U = node->TX.BCR.U | (mask);
2375 }
2376
2377
2378 IFX_INLINE void IfxCan_Node_setTxBufferDataFieldSize(Ifx_CAN_N *node, IfxCan_DataFieldSize size
2379 {
2380 node->TX.ESC.B.TBDS = size;
2381 }
2382
2383
2384 IFX_INLINE void IfxCan_Node_setTxBuffersStartAddress(Ifx_CAN_N *node, uint16 address)
2385 {
2386 node->TX.BC.B.TBSA = address >> 2;
2387 }
2388
2389
2390 IFX_INLINE void IfxCan_Node_setTxEventFifoCtrl(Ifx_CAN_TXMSG *txBufferElement, boolean enable)
2391 {
2392 txBufferElement->T1.B.EFC = enable ? 1 : 0;
2393 }
2394
2395
2396 IFX_INLINE void IfxCan_Node_setTxEventFifoControl(Ifx_CAN_N *node, Ifx_CAN_TXMSG *txBufferEleme
2397 {
2398 IFX_UNUSED_PARAMETER(node);
2399 txBufferElement->T1.B.EFC = enable ? 1 : 0;
2400 }
2401
2402
2403 IFX_INLINE void IfxCan_Node_setTxEventFifoSize(Ifx_CAN_N *node, uint8 size)
2404 {
2405 node->TX.EFC.B.EFS = size;
2406 }
2407
2408
2409 IFX_INLINE void IfxCan_Node_setTxEventFifoStartAddress(Ifx_CAN_N *node, uint16 address)
2410 {
2411 node->TX.EFC.B.EFSA = address >> 2;
2412 }
2413
2414
2415 IFX_INLINE void IfxCan_Node_setTxEventFifoWatermarkLevel(Ifx_CAN_N *node, uint8 level)
2416 {
2417 node->TX.EFC.B.EFWM = level;
2418 }
2419
2420
2421 IFX_INLINE Ifx_CAN_N *IfxCan_getNodePointer(Ifx_CAN *can, IfxCan_NodeId nodeId)

2422 {
2423 return &(can->N[nodeId]);

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 47/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
2424 }
2425
2426
2427 IFX_INLINE boolean IfxCan_isModuleEnabled(Ifx_CAN *can)
2428 {
2429 return can->CLC.B.DISS == 0;
2430 }
2431
2432
2433 IFX_INLINE boolean IfxCan_isModuleSuspended(Ifx_CAN *can)
2434 {
2435 Ifx_CAN_OCS ocs;
2436
2437 // read the status
2438 ocs.U = can->OCS.U;
2439
2440 // return the status
2441 return ocs.B.SUSSTA;
2442 }
2443
2444
2445 IFX_INLINE void IfxCan_setSleepMode(Ifx_CAN *can, IfxCan_SleepMode mode)
2446 {
2447 uint16 passwd = IfxScuWdt_getCpuWatchdogPassword();
2448 IfxScuWdt_clearCpuEndinit(passwd);
2449 can->CLC.B.EDIS = mode;
2450 IfxScuWdt_setCpuEndinit(passwd);
2451 }
2452
2453
2454 IFX_INLINE void IfxCan_setSuspendMode(Ifx_CAN *can, IfxCan_SuspendMode mode)
2455 {
2456 Ifx_CAN_OCS ocs;
2457
2458 // remove protection and configure the suspend mode.
2459 ocs.B.SUS_P = 1;
2460 ocs.B.SUS = mode;
2461 can->OCS.U = ocs.U;
2462 }
2463
2464
2465 IFX_INLINE IfxCan_LastErrorCodeType IfxCan_Node_getLastErroCodeStatus(Ifx_CAN_N *node)
2466 {
2467 return (IfxCan_LastErrorCodeType)(node->PSR.B.LEC);
2468 }
2469
2470
2471 IFX_INLINE boolean IfxCan_Node_isErrorPassive(Ifx_CAN_N *node)
2472 {
2473 return node->PSR.B.EP;

2474 }
2475

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 48/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
2476
2477 IFX_INLINE IfxCan_CanNodeErrorWarningLimitStatus IfxCan_Node_getWarningStatus(Ifx_CAN_N *node)
2478 {
2479 return (IfxCan_CanNodeErrorWarningLimitStatus)(node->PSR.B.EW);
2480 }
2481
2482
2483 IFX_INLINE IfxCan_CanNodeBusOffErrorStatus IfxCan_Node_getBusOffStatus(Ifx_CAN_N *node)
2484 {
2485 return (IfxCan_CanNodeBusOffErrorStatus)(node->PSR.B.BO);
2486 }
2487
2488
2489 IFX_INLINE IfxCan_CanNodeCommunicationState IfxCan_Node_getActivityStatus(Ifx_CAN_N *node)
2490 {
2491 return (IfxCan_CanNodeCommunicationState)(node->PSR.B.ACT);
2492 }
2493
2494
2495 IFX_INLINE IfxCan_LastErrorCodeType IfxCan_Node_getDataPhaseLastErrorCode(Ifx_CAN_N *node)
2496 {
2497 return (IfxCan_LastErrorCodeType)(node->PSR.B.DLEC);
2498 }
2499
2500
2501 IFX_INLINE boolean IfxCan_Node_isProtocolExceptionEventOccured(Ifx_CAN_N *node)
2502 {
2503 return node->PSR.B.PXE;
2504 }
2505
2506
2507 IFX_INLINE boolean IfxCan_Node_isErrorStatusIndicatorEnabled(Ifx_CAN_N *node)
2508 {
2509 return node->PSR.B.RESI;
2510 }
2511
2512
2513 IFX_INLINE boolean IfxCan_Node_isBitRateSwitchFlagEnabled(Ifx_CAN_N *node)
2514 {
2515 return node->PSR.B.RBRS;
2516 }
2517
2518
2519 IFX_INLINE boolean IfxCan_Node_isCanFDMsgReceived(Ifx_CAN_N *node)
2520 {
2521 return node->PSR.B.RFDF;
2522 }
2523
2524
2525 IFX_INLINE IfxCan_DataLengthCode IfxCan_Node_getCodeFromDataLengthInBytes(uint32 dataLength)

2526 {
2527 uint32 code;

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 49/50
10/19/22, 4:33 PM AURIX_code_examples/IfxCan.h at master · Infineon/AURIX_code_examples · GitHub
2528
2529 if (dataLength <= 8)
2530 {
2531 code = dataLength;
2532 }
2533 else if (dataLength <= 24)
2534 {
2535 code = (dataLength >> 2) + 6;
2536 }
2537 else
2538 {
2539 code = (dataLength >> 4) + 11;
2540 }
2541
2542 return (IfxCan_DataLengthCode)code;
2543 }
2544
2545
2546 #endif /* IFXCAN_H */

https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/Blinky_LED_1_KIT_TC375_SB/Libraries/iLLD/TC37A/Tricore/… 50/50

You might also like