iLLD_TC22x  1.0
IfxMultican.h
Go to the documentation of this file.
1 /**
2  * \file IfxMultican.h
3  * \brief MULTICAN basic functionality
4  * \ingroup IfxLld_Multican
5  *
6  * \version iLLD_1_0_0_11_0
7  * \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
8  *
9  *
10  * IMPORTANT NOTICE
11  *
12  *
13  * Infineon Technologies AG (Infineon) is supplying this file for use
14  * exclusively with Infineon's microcontroller products. This file can be freely
15  * distributed within development tools that are supporting such microcontroller
16  * products.
17  *
18  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21  * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
22  * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23  *
24  * \defgroup IfxLld_Multican_Std_Enum Enumerations
25  * \ingroup IfxLld_Multican_Std
26  * \defgroup IfxLld_Multican_Std_General General functions
27  * \ingroup IfxLld_Multican_Std
28  * \defgroup IfxLld_Multican_Std_Node CAN Nodes
29  * \ingroup IfxLld_Multican_Std
30  * \defgroup IfxLld_Multican_Std_Message Message
31  * \ingroup IfxLld_Multican_Std
32  * \defgroup IfxLld_Multican_Std_Message_Objects Message Objects
33  * \ingroup IfxLld_Multican_Std
34  * \defgroup IfxLld_Multican_Std_Interrupts Interrupts
35  * \ingroup IfxLld_Multican_Std
36  */
37 
38 #ifndef IFXMULTICAN_H
39 #define IFXMULTICAN_H 1
40 
41 /******************************************************************************/
42 /*----------------------------------Includes----------------------------------*/
43 /******************************************************************************/
44 
45 #include "_Impl/IfxMultican_cfg.h"
46 #include "Src/Std/IfxSrc.h"
49 #include "IfxCan_reg.h"
50 #include "IfxCan_bf.h"
51 #include "Scu/Std/IfxScuWdt.h"
52 
53 /******************************************************************************/
54 /*------------------------------Type Definitions------------------------------*/
55 /******************************************************************************/
56 
57 /** \brief Message object ID, 0 .. \ref IFXMULTICAN_NUM_MESSAGE_OBJECTS
58  */
60 
61 /******************************************************************************/
62 /*--------------------------------Enumerations--------------------------------*/
63 /******************************************************************************/
64 
65 /** \addtogroup IfxLld_Multican_Std_Enum
66  * \{ */
67 /** \brief CAN input clock selection
68  */
69 typedef enum
70 {
71  IfxMultican_ClockSelect_noClock = 0, /**< \brief No clock supplied */
72  IfxMultican_ClockSelect_fclc = 1, /**< \brief fMULTICAN */
73  IfxMultican_ClockSelect_fosc0 = 2 /**< \brief Oscillator Clock */
75 
76 /** \brief CAN frame data length code
77  * Definition in Ifx_CAN.MOFCRx.DLC
78  */
79 typedef enum
80 {
81  IfxMultican_DataLengthCode_0 = 0, /**< \brief 0 data bytes */
82  IfxMultican_DataLengthCode_1, /**< \brief 1 data bytes */
83  IfxMultican_DataLengthCode_2, /**< \brief 2 data bytes */
84  IfxMultican_DataLengthCode_3, /**< \brief 3 data bytes */
85  IfxMultican_DataLengthCode_4, /**< \brief 4 data bytes */
86  IfxMultican_DataLengthCode_5, /**< \brief 5 data bytes */
87  IfxMultican_DataLengthCode_6, /**< \brief 6 data bytes */
88  IfxMultican_DataLengthCode_7, /**< \brief 7 data bytes */
89  IfxMultican_DataLengthCode_8, /**< \brief 8 data bytes */
90  IfxMultican_DataLengthCode_12 = 9, /**< \brief 12 data bytes */
91  IfxMultican_DataLengthCode_16 = 10, /**< \brief 16 data bytes */
92  IfxMultican_DataLengthCode_20 = 11, /**< \brief 20 data bytes */
93  IfxMultican_DataLengthCode_24 = 12, /**< \brief 24 data bytes */
94  IfxMultican_DataLengthCode_32 = 13, /**< \brief 32 data bytes */
95  IfxMultican_DataLengthCode_48 = 14, /**< \brief 48 data bytes */
96  IfxMultican_DataLengthCode_64 = 15 /**< \brief 64 data bytes */
98 
99 /** \brief CAN frame type
100  */
101 typedef enum
102 {
103  IfxMultican_Frame_receive, /**< \brief Data frame is received */
104  IfxMultican_Frame_transmit, /**< \brief Data frame is generated */
105  IfxMultican_Frame_remoteRequest, /**< \brief Remote request frame is generated */
106  IfxMultican_Frame_remoteAnswer /**< \brief Answer frame is generated on reception of the corresponding remote request */
108 
109 /** \brief Determines the operation mode of the frame counter\n
110  * Definition in Ifx_CAN.NFCRx.B.CFMOD, (x= node Id)
111  */
112 typedef enum
113 {
114  IfxMultican_FrameCounterMode_frameCountMode = 0, /**< \brief The frame counter is incremented
115  * upon the reception and transmission of frames */
116  IfxMultican_FrameCounterMode_timeStampMode = 1, /**< \brief The frame counter is used to count
117  * bit times. */
118  IfxMultican_FrameCounterMode_bitTimingMode = 2, /**< \brief The frame counter is used for
119  * analysis of the bit timing. */
120  IfxMultican_FrameCounterMode_errorCountMode = 3 /**< \brief The frame counter is used for
121  * counting when an error frame is received or an error is
122  * detected by the node. */
124 
125 /** \brief CAN message object group\n
126  * Each group consists of 32 consecutive message objects
127  */
128 typedef enum
129 {
139 
140 /** \brief CAN Message Object Mode
141  */
142 typedef enum
143 {
144  IfxMultican_MsgObjMode_standard = 0, /**< \brief Standard Message Object */
145  IfxMultican_MsgObjMode_receiveFifoBase = 1, /**< \brief Receive FIFO Base Object */
146  IfxMultican_MsgObjMode_transmitFifoBase = 2, /**< \brief Transmit FIFO Base Object */
147  IfxMultican_MsgObjMode_transmitFifoSlave = 3, /**< \brief Transmit FIFO Slave Object */
148  IfxMultican_MsgObjMode_gatewaySource = 4, /**< \brief Gateway Source Object */
149  IfxMultican_MsgObjMode_canFD64 = 5 /**< \brief CANFD 64 bytes Message Mode */
151 
152 /** \brief CAN Message Object status flag
153  * Definition in Ifx_CAN.MOSTATx (x: 0 to max number of msg objs)
154  */
155 typedef enum
156 {
157  IfxMultican_MsgObjStatusFlag_receivePending = IFX_CAN_MO_STAT_RXPND_OFF, /**< \brief Receive pending status flag */
158  IfxMultican_MsgObjStatusFlag_transmitPending = IFX_CAN_MO_STAT_TXPND_OFF, /**< \brief Transmit pending status flag */
159  IfxMultican_MsgObjStatusFlag_receiveUpdating = IFX_CAN_MO_STAT_RXUPD_OFF, /**< \brief Receive updating status flag */
160  IfxMultican_MsgObjStatusFlag_newData = IFX_CAN_MO_STAT_NEWDAT_OFF, /**< \brief New data status flag */
161  IfxMultican_MsgObjStatusFlag_messageLost = IFX_CAN_MO_STAT_MSGLST_OFF, /**< \brief Message lost status flag */
162  IfxMultican_MsgObjStatusFlag_messageValid = IFX_CAN_MO_STAT_MSGVAL_OFF, /**< \brief Message valid status flag */
163  IfxMultican_MsgObjStatusFlag_receiveTransmitSelected = IFX_CAN_MO_STAT_RTSEL_OFF, /**< \brief Receive transmit selected status flag */
164  IfxMultican_MsgObjStatusFlag_receiveEnable = IFX_CAN_MO_STAT_RXEN_OFF, /**< \brief Receive enable status flag */
165  IfxMultican_MsgObjStatusFlag_transmitRequest = IFX_CAN_MO_STAT_TXRQ_OFF, /**< \brief Transmit request status flag */
166  IfxMultican_MsgObjStatusFlag_transmitEnable0 = IFX_CAN_MO_STAT_TXEN0_OFF, /**< \brief Transmit enable 0 status flag */
167  IfxMultican_MsgObjStatusFlag_transmitEnable1 = IFX_CAN_MO_STAT_TXEN1_OFF, /**< \brief Transmit enable 1 status flag */
168  IfxMultican_MsgObjStatusFlag_messageDirection = IFX_CAN_MO_STAT_DIR_OFF /**< \brief Message direction status flag */
170 
171 /** \brief CAN priorities
172  */
173 typedef enum
174 {
175  IfxMultican_Priority_ListOrder = 1, /**< \brief List order */
176  IfxMultican_Priority_CAN_ID = 2 /**< \brief CAN ID */
178 
179 /** \brief Enable/disable the sensitivity of the module to sleep signal\n
180  * Definition in Ifx_CAN.CLC.B.EDIS
181  */
182 typedef enum
183 {
184  IfxMultican_SleepMode_enable = 0, /**< \brief enables sleep mode */
185  IfxMultican_SleepMode_disable = 1 /**< \brief disables sleep mode */
187 
188 /** \brief CAN API status definition
189  */
190 typedef enum
191 {
192  IfxMultican_Status_ok = 0x00000000,
204 
205 /** \} */
206 
207 /******************************************************************************/
208 /*-----------------------------Data Structures--------------------------------*/
209 /******************************************************************************/
210 
211 /** \brief CAN message definition
212  */
213 typedef struct
214 {
215  uint32 id; /**< \brief CAN message ID */
216  IfxMultican_DataLengthCode lengthCode; /**< \brief CAN message data length code */
217  uint32 data[2]; /**< \brief CAN message data */
218  boolean fastBitRate; /**< \brief CAN FD fast bit rate enable/disable */
220 
221 /** \brief Message object status bit-fields
222  */
223 typedef union
224 {
225  Ifx_CAN_MO_STAT_Bits B;
226  unsigned int U;
228 
229 /** \addtogroup IfxLld_Multican_Std_General
230  * \{ */
231 
232 /******************************************************************************/
233 /*-------------------------Inline Function Prototypes-------------------------*/
234 /******************************************************************************/
235 
236 /** \brief clears the message pending interrupt notification of a given list
237  * \param mcan mcan Specifies the CAN module
238  * \return None
239  */
241 
242 /** \brief clears the message pending interrupt notification of a given list
243  * \param mcan mcan Specifies the CAN module
244  * \param list List number
245  * \return None
246  */
248 
249 /** \brief Disables the module (sets the disable request)
250  * \param mcan mcan Specifies the CAN module
251  * \return None
252  */
253 IFX_INLINE void IfxMultican_disableModule(Ifx_CAN *mcan);
254 
255 /** \brief Disregards the sleep mode of the module
256  * \param mcan mcan Specifies the CAN module
257  * \return None
258  */
259 IFX_INLINE void IfxMultican_disableSleepMode(Ifx_CAN *mcan);
260 
261 /** \brief Enables the module (clears the disable request)
262  * \param mcan mcan Specifies the CAN module
263  * \return None
264  */
265 IFX_INLINE void IfxMultican_enableModule(Ifx_CAN *mcan);
266 
267 /** \brief Enables the sleep mode of the module
268  * \param mcan mcan Specifies the CAN module
269  * \return None
270  */
271 IFX_INLINE void IfxMultican_enableSleepMode(Ifx_CAN *mcan);
272 
273 /** \brief Returns the selected fractional divider mode
274  * \param mcan mcan Specifies the CAN module
275  * \return Divider mode
276  */
278 
279 /** \brief Returns the reload or addition value for the result.
280  * \param mcan mcan Specifies the CAN module
281  * \return Step Value
282  */
284 
285 /** \brief Returns the selected input clock source
286  * \param mcan mcan Specifies the CAN module
287  * \return Clock selection
288  */
290 
291 /** \brief Returns the status of module enabled or disabled
292  * \param mcan mcan Specifies the CAN module
293  * \return Status (TRUE / FALSE)
294  */
295 IFX_INLINE boolean IfxMultican_isModuleEnabled(Ifx_CAN *mcan);
296 
297 /** \brief sets the fractional divider mode
298  * \param mcan mcan Specifies the CAN module
299  * \param mode Divider mode
300  * \return None
301  */
302 IFX_INLINE void IfxMultican_setFractionalDividerMode(Ifx_CAN *mcan, uint16 mode);
303 
304 /** \brief sets reload or addition value for the result.
305  * \param mcan mcan Specifies the CAN module
306  * \param stepValue Step Value
307  * \return None
308  */
309 IFX_INLINE void IfxMultican_setFractionalDividerStepValue(Ifx_CAN *mcan, uint16 stepValue);
310 
311 /** \brief Sets the input clock source
312  * \param mcan mcan Specifies the CAN module
313  * \param clockSelect Clock selection
314  * \return None
315  */
316 IFX_INLINE void IfxMultican_setInputClock(Ifx_CAN *mcan, IfxMultican_ClockSelect clockSelect);
317 
318 /** \brief clears the message pending interrupt notification of a given list
319  * \param mcan mcan Specifies the CAN module
320  * \param mask Message Index mask
321  * \return None
322  */
323 IFX_INLINE void IfxMultican_setMessageIndexMask(Ifx_CAN *mcan, uint32 mask);
324 
325 /** \brief Sets the sensitivity of the module to sleep signal
326  * \param can pointer to CAN registers
327  * \param mode mode selection (enable / disable)
328  * \return None
329  */
331 
332 /** \brief Wait until the list panel is ready
333  * \param mcan mcan Specifies the CAN module
334  * \return None
335  */
336 IFX_INLINE void IfxMultican_waitListReady(Ifx_CAN *mcan);
337 
338 /******************************************************************************/
339 /*-------------------------Global Function Prototypes-------------------------*/
340 /******************************************************************************/
341 
342 /** \brief Calculates the best posible values and configures FBTR register
343  * \param hwNode Pointer to CAN Node registers
344  * \param moduleFreq Specifies the CAN module frequency
345  * \param baudrate Specifies the node baud rate. Unit: baud
346  * \param samplePoint Specifies the sample point. Range = [0, 10000] resp. [0%, 100%] of the total bit time.
347  * \param synchJumpWidth synchJumpWidth Specifies the re-synchronization jump width.\n
348  * Range = [0, 10000] resp. [0%, 100%] of the total bit time.
349  * \return None
350  */
351 IFX_EXTERN void IfxMultican_Node_setFastBitTiming(Ifx_CAN_N *hwNode, float32 moduleFreq, uint32 baudrate, uint16 samplePoint, uint16 synchJumpWidth);
352 
353 /** \brief Calculates the best posible values and configures BTEVR register
354  * \param hwNode Pointer to CAN Node registers
355  * \param moduleFreq Specifies the CAN module frequency
356  * \param baudrate Specifies the node baud rate. Unit: baud
357  * \param samplePoint Specifies the sample point. Range = [0, 10000] resp. [0%, 100%] of the total bit time.
358  * \param synchJumpWidth synchJumpWidth Specifies the re-synchronization jump width.\n
359  * Range = [0, 10000] resp. [0%, 100%] of the total bit time.
360  * \return None
361  */
362 IFX_EXTERN void IfxMultican_Node_setNominalBitTiming(Ifx_CAN_N *hwNode, float32 moduleFreq, uint32 baudrate, uint16 samplePoint, uint16 synchJumpWidth);
363 
364 /** \brief Reset the CAN module\n
365  * Reset and disable the CAN module, inclusive message object and node registers.
366  * \param mcan Specifies the CAN module
367  * \return None
368  */
369 IFX_EXTERN void IfxMultican_deinit(Ifx_CAN *mcan);
370 
371 /** \brief resets Multican kernel
372  * \param can pointer to CAN registers
373  * \return None
374  */
375 IFX_EXTERN void IfxMultican_resetModule(Ifx_CAN *can);
376 
377 /** \brief Execute a command from the command panel
378  * \param mcan Specifies the CAN module
379  * \param cmd Specifies the command
380  * \param arg2 Specifies the second argument
381  * \param arg1 Specifies the first argument
382  * \return None
383  */
384 IFX_EXTERN void IfxMultican_setListCommand(Ifx_CAN *mcan, uint32 cmd, uint32 arg2, uint32 arg1);
385 
386 /** \} */
387 
388 /** \addtogroup IfxLld_Multican_Std_Node
389  * \{ */
390 
391 /******************************************************************************/
392 /*-------------------------Inline Function Prototypes-------------------------*/
393 /******************************************************************************/
394 
395 /** \brief Activate the CAN Node. Participate in the CAN bus activities
396  * \param hwNode Pointer to CAN Node registers
397  * \return None
398  */
399 IFX_INLINE void IfxMultican_Node_activate(Ifx_CAN_N *hwNode);
400 
401 /** \brief Deactivate the CAN Node. Take out from participation in the CAN bus activities
402  * \param hwNode Pointer to CAN Node registers
403  * \return None
404  */
405 IFX_INLINE void IfxMultican_Node_deactivate(Ifx_CAN_N *hwNode);
406 
407 /** \brief Disables the configuration changes for the Bit Timing Register, the Port Control Register, and the Error Counter Register of a CAN Node.
408  * \param hwNode Pointer to CAN Node registers
409  * \return None
410  */
412 
413 /** \brief Enables the configuration changes for the Bit Timing Register, the Port Control Register, and the Error Counter Register of a CAN Node.
414  * \param hwNode Pointer to CAN Node registers
415  * \return None
416  */
418 
419 /** \brief Returns the base address to a given CAN node number
420  * \param mcan Specifies the CAN module
421  * \param node Specifies the CAN node
422  * \return base pointer to CAN node
423  */
424 IFX_INLINE Ifx_CAN_N *IfxMultican_Node_getPointer(Ifx_CAN *mcan, IfxMultican_NodeId node);
425 
426 /** \brief Resets the control register of CAN Node x.
427  * \param hwNode Pointer to CAN Node registers
428  * \return None
429  */
430 IFX_INLINE void IfxMultican_Node_resetControlRegister(Ifx_CAN_N *hwNode);
431 
432 /** \brief Resets the error counters of CAN Node x.
433  * \param hwNode Pointer to CAN Node registers
434  * \return None
435  */
436 IFX_INLINE void IfxMultican_Node_resetErrorCounters(Ifx_CAN_N *hwNode);
437 
438 /** \brief Resets the interrupt pointers of CAN Node x.
439  * \param hwNode Pointer to CAN Node registers
440  * \return None
441  */
443 
444 /** \brief Enables / Disables the alert interrupt of CAN node x.
445  * \param hwNode Pointer to CAN Node registers
446  * \param enabled Enable / disable choice
447  * \return None
448  */
449 IFX_INLINE void IfxMultican_Node_setAlertInterrupt(Ifx_CAN_N *hwNode, boolean enabled);
450 
451 /** \brief Selects the interrupt output line INT_Om
452  * (m = 0-15) for an alert interrupt of CAN Node x.
453  * \param hwNode Pointer to CAN Node registers
454  * \param srcId Service request ID
455  * \return None
456  */
458 
459 /** \brief Enables / Disables the analyzer mode of CAN node x.
460  * \param hwNode Pointer to CAN Node registers
461  * \param mode Enable / disable choice
462  * \return None
463  */
464 IFX_INLINE void IfxMultican_Node_setAnalyzerMode(Ifx_CAN_N *hwNode, boolean mode);
465 
466 /** \brief Determines the threshold value (warning level, default 96) to be reached\n
467  * in order to set the corresponding error warning bit EWRN.
468  * \param hwNode Pointer to CAN Node registers
469  * \param level Error warning level
470  * \return None
471  */
472 IFX_INLINE void IfxMultican_Node_setErrorWarningLevel(Ifx_CAN_N *hwNode, uint8 level);
473 
474 /** \brief Enables / Disables the flexible data rate of CAN node x.
475  * \param hwNode Pointer to CAN Node registers
476  * \param enabled Enable / disable choice
477  * \return None
478  */
479 IFX_INLINE void IfxMultican_Node_setFastNode(Ifx_CAN_N *hwNode, boolean enabled);
480 
481 /** \brief Enables / Disables the CAN frame counter overflow interrupt of CAN node x.
482  * \param hwNode Pointer to CAN Node registers
483  * \param enabled Enable / disable choice
484  * \return None
485  */
486 IFX_INLINE void IfxMultican_Node_setFrameCounterInterrupt(Ifx_CAN_N *hwNode, boolean enabled);
487 
488 /** \brief Selects the interrupt output line INT_Om
489  * (m = 0-15) for a frame counter overflow interrupt of CAN Node x.
490  * \param hwNode Pointer to CAN Node registers
491  * \param srcId Service request ID
492  * \return None
493  */
495 
496 /** \brief Sets the operation mode of the frame counter of the CAN Node x
497  * \param hwNode Pointer to CAN Node registers
498  * \param mode Determines the operation mode of the frame counter
499  * \return None
500  */
502 
503 /** \brief Enables / Disables the last error code interrupt of CAN node x. \n
504  * This interrupt is generated with each hardware update of bit field NSRx.LEC with LEC > 0 (CAN protocol error).
505  * \param hwNode Pointer to CAN Node registers
506  * \param enabled Enable / disable choice
507  * \return None
508  */
509 IFX_INLINE void IfxMultican_Node_setLastErrorCodeInterrupt(Ifx_CAN_N *hwNode, boolean enabled);
510 
511 /** \brief Selects the interrupt output line INT_Om
512  * (m = 0-15) for an LEC interrupt of CAN Node x.
513  * \param hwNode Pointer to CAN Node registers
514  * \param srcId Service request ID
515  * \return None
516  */
518 
519 /** \brief Enables / Disables the loopback mode of CAN node x.
520  * \param hwNode Pointer to CAN Node registers
521  * \param mode Enable / disable choice
522  * \return None
523  */
524 IFX_INLINE void IfxMultican_Node_setLoopBackMode(Ifx_CAN_N *hwNode, boolean mode);
525 
526 /** \brief Sets the value of the receive error counter of CAN node x.
527  * \param hwNode Pointer to CAN Node registers
528  * \param value Receive error counter value
529  * \return None
530  */
531 IFX_INLINE void IfxMultican_Node_setReceiveErrorCounter(Ifx_CAN_N *hwNode, uint8 value);
532 
533 /** \brief Selects the interrupt output line INT_Om
534  * (m = 0-15) for a timer event interrupt of CAN Node x.
535  * \param hwNode Pointer to CAN Node registers
536  * \param srcId Service request ID
537  * \return None
538  */
540 
541 /** \brief Enables / Disables the transceiver delay compensation of CAN node x.
542  * \param hwNode Pointer to CAN Node registers
543  * \param enabled Enable / disable choice
544  * \return None
545  */
546 IFX_INLINE void IfxMultican_Node_setTransceiverDelayCompensation(Ifx_CAN_N *hwNode, boolean enabled);
547 
548 /** \brief Sets transceiver delay ompensation offset of CAN node x.
549  * \param hwNode Pointer to CAN Node registers
550  * \param value transceiver delay ompensation offset that is added to the measured transceiver delay. Range = [0, 15]
551  * \return None
552  */
554 
555 /** \brief Enables / Disables the transfer interrupt of CAN node x. \n
556  * This interrupt is generated after the successful reception or transmission of a CAN frame in node x
557  * \param hwNode Pointer to CAN Node registers
558  * \param enabled Enable / disable choice
559  * \return None
560  */
561 IFX_INLINE void IfxMultican_Node_setTransferInterrupt(Ifx_CAN_N *hwNode, boolean enabled);
562 
563 /** \brief Selects the interrupt output line INT_Om
564  * (m = 0-15) for a transfer OK interrupt of CAN Node x.
565  * \param hwNode Pointer to CAN Node registers
566  * \param srcId Service request ID
567  * \return None
568  */
570 
571 /** \brief Sets the value of the transmit error counter of CAN node x.
572  * \param hwNode Pointer to CAN Node registers
573  * \param value Transmit error counter value
574  * \return None
575  */
576 IFX_INLINE void IfxMultican_Node_setTransmitErrorCounter(Ifx_CAN_N *hwNode, uint8 value);
577 
578 /******************************************************************************/
579 /*-------------------------Global Function Prototypes-------------------------*/
580 /******************************************************************************/
581 
582 /** \brief Reset the CAN node
583  * \param hwNode Pointer to CAN Node registers
584  * \return None
585  */
586 IFX_EXTERN void IfxMultican_Node_deinit(Ifx_CAN_N *hwNode);
587 
588 /** \brief Select and initialise the CAN node receive pin
589  * \param hwNode Pointer to CAN Node registers
590  * \param rxd Rx pin
591  * \param mode Input mode
592  * \return TRUE: Returns TRUE if the operation was successful\n
593  * FALSE: Returns FALSE if the operation was errorneous
594  */
595 IFX_EXTERN boolean IfxMultican_Node_initRxPin(Ifx_CAN_N *hwNode, IfxMultican_Rxd_In *rxd, IfxPort_InputMode mode);
596 
597 /** \brief Select and initialise the CAN node transmit pin
598  * \param hwNode Pointer to CAN Node registers
599  * \param txd Tx pin
600  * \param mode Output mode
601  * \return TRUE: Returns TRUE if the operation was successful\n
602  * FALSE: Returns FALSE if the operation was errorneous
603  */
604 IFX_EXTERN boolean IfxMultican_Node_initTxPin(Ifx_CAN_N *hwNode, IfxMultican_Txd_Out *txd, IfxPort_OutputMode mode);
605 
606 /** \brief Recovers the CAN node from bus off
607  * \param hwNode Pointer to CAN Node registers
608  * \return Status
609  */
611 
612 /** \brief Calculates the best posible values and configures BTR register
613  * \param hwNode Pointer to CAN Node registers
614  * \param moduleFreq Specifies the CAN module frequency
615  * \param baudrate Specifies the node baud rate. Unit: baud
616  * \param samplePoint Specifies the sample point. Range = [0, 10000] resp. [0%, 100%] of the total bit time.
617  * \param synchJumpWidth synchJumpWidth Specifies the re-synchronization jump width.\n
618  * Range = [0, 10000] resp. [0%, 100%] of the total bit time.
619  * \return None
620  */
621 IFX_EXTERN void IfxMultican_Node_setBitTiming(Ifx_CAN_N *hwNode, float32 moduleFreq, uint32 baudrate, uint16 samplePoint, uint16 synchJumpWidth);
622 
623 /** \brief Returns the CAN node timing
624  * \param moduleFreq Specifies the CAN module frequency
625  * \param btr BTR
626  * \param baudrate Baudrate
627  * \param samplePoint Sample point
628  * \param synchJumpWidth Sync Jump Width
629  * \return None
630  */
631 IFX_EXTERN void IfxMultican_calcTimingFromBTR(float32 moduleFreq, uint32 btr, uint32 *baudrate, uint16 *samplePoint, uint16 *synchJumpWidth);
632 
633 /** \} */
634 
635 /** \addtogroup IfxLld_Multican_Std_Message
636  * \{ */
637 
638 /******************************************************************************/
639 /*-------------------------Inline Function Prototypes-------------------------*/
640 /******************************************************************************/
641 
642 /** \brief Initializes a CAN message
643  * \param msg The message which should be initialized
644  * \param id The message ID
645  * \param dataLow The lower part of the 64bit data value
646  * \param dataHigh The upper part of the 64bit data value
647  * \param lengthCode number of bytes (data length code) which should be transmitted (0..8)
648  * \return None
649  */
651 
652 /** \brief Initializes a CAN message long frame
653  * \param msg The message which should be initialized
654  * \param id The message ID
655  * \param lengthCode number of bytes (data length code) which should be transmitted (0..8)
656  * \param fastBitRate Fast bit rate (FCR.BRS) enable/ disable choice
657  * \return None
658  */
660 
661 /** \} */
662 
663 /** \addtogroup IfxLld_Multican_Std_Message_Objects
664  * \{ */
665 
666 /******************************************************************************/
667 /*-------------------------Inline Function Prototypes-------------------------*/
668 /******************************************************************************/
669 
670 /** \brief Sets priority class of message object
671  * \param hwObj Pointer to CAN message object registers
672  * \return None
673  */
674 IFX_INLINE void IfxMultican_MsgObj_clearDataRegisters(Ifx_CAN_MO *hwObj);
675 
676 /** \brief Clears the FIFO/GateWay pointers of a message object
677  * \param hwObj Pointer to CAN message object registers
678  * \return None
679  */
681 
682 /** \brief Clear the RX pending flag of a message object
683  * \param hwObj Pointer to CAN message object registers
684  * \return None
685  */
686 IFX_INLINE void IfxMultican_MsgObj_clearRxPending(Ifx_CAN_MO *hwObj);
687 
688 /** \brief Clear the TX pending flag of a message object
689  * \param hwObj Pointer to CAN message object registers
690  * \return None
691  */
692 IFX_INLINE void IfxMultican_MsgObj_clearTxPending(Ifx_CAN_MO *hwObj);
693 
694 /** \brief Gets bottom object pointer of the base message object
695  * \param hwObj Pointer to CAN message object registers
696  * \return Bottom message object number
697  */
699 
700 /** \brief Gets data length code of a message object
701  * \param hwObj Pointer to CAN message object registers
702  * \return CAN frame data length code
703  */
705 
706 /** \brief Gets message identifier of message object
707  * \param hwObj Pointer to CAN message object registers
708  * \return messageId
709  */
711 
712 /** \brief Returns next object pointer (PNEXT) of the current message object
713  * \param hwObj Pointer to CAN message object registers
714  * \return Next message object number
715  */
717 
718 /** \brief Get base address of a message object register
719  * \param mcan Specifies the CAN module
720  * \param msgObjId Specifies the message object index. Range = [0, \ref IFXMULTICAN_NUM_MESSAGE_OBJECTS - 1]
721  * \return Pointer to Message Object registers
722  */
723 IFX_INLINE Ifx_CAN_MO *IfxMultican_MsgObj_getPointer(Ifx_CAN *mcan, IfxMultican_MsgObjId msgObjId);
724 
725 /** \brief Get the message object status
726  * \param hwObj Pointer to CAN message object registers
727  * \return Extended frame: True
728  * Standard frame: False
729  */
730 IFX_INLINE boolean IfxMultican_MsgObj_isExtendedFrame(Ifx_CAN_MO *hwObj);
731 
732 /** \brief Returns the RX pending flag of a message object.
733  * \param hwObj Pointer to CAN message object registers
734  * \return TRUE of the RX pending flag of a message object is set
735  */
736 IFX_INLINE boolean IfxMultican_MsgObj_isRxPending(Ifx_CAN_MO *hwObj);
737 
738 /** \brief Returns the TX Request flag of a message object.
739  * \param hwObj Pointer to CAN message object registers
740  * \return TRUE of the TX Request flag of a message object is set
741  */
742 IFX_INLINE boolean IfxMultican_MsgObj_isTransmitRequested(Ifx_CAN_MO *hwObj);
743 
744 /** \brief Returns the TX pending flag of a message object.
745  * \param hwObj Pointer to CAN message object registers
746  * \return TRUE of the TX pending flag of a message object is set
747  */
748 IFX_INLINE boolean IfxMultican_MsgObj_isTxPending(Ifx_CAN_MO *hwObj);
749 
750 /** \brief Sets acceptance mask for the message identifier
751  * \param hwObj Pointer to CAN message object registers
752  * \param mask Acceptance Mask for the message identifier
753  * \param extendedFrame Extended frame enabled / disabled
754  * \return None
755  */
756 IFX_INLINE void IfxMultican_MsgObj_setAcceptanceMask(Ifx_CAN_MO *hwObj, uint32 mask, boolean extendedFrame);
757 
758 /** \brief Enable / Disable bit rate switch of a message object
759  * \param hwObj Pointer to CAN message object registers
760  * \param enabled Enable / disable choice
761  * \return None
762  */
763 IFX_INLINE void IfxMultican_MsgObj_setBitRateSwitch(Ifx_CAN_MO *hwObj, boolean enabled);
764 
765 /** \brief Sets bottom object pointer of the base message object
766  * \param hwObj Pointer to CAN message object registers
767  * \param objNumber Bottom message object number
768  * \return None
769  */
770 IFX_INLINE void IfxMultican_MsgObj_setBottomObjectPointer(Ifx_CAN_MO *hwObj, sint32 objNumber);
771 
772 /** \brief Sets bottom current pointer of the base message object
773  * \param hwObj Pointer to CAN message object registers
774  * \param objNumber Current message object number
775  * \return None
776  */
777 IFX_INLINE void IfxMultican_MsgObj_setCurrentObjectPointer(Ifx_CAN_MO *hwObj, sint32 objNumber);
778 
779 /** \brief Enable / Disable data copy of a gateway source message object
780  * \param hwObj Pointer to CAN message object registers
781  * \param enabled Enable / disable choice
782  * \return None
783  */
784 IFX_INLINE void IfxMultican_MsgObj_setDataCopy(Ifx_CAN_MO *hwObj, boolean enabled);
785 
786 /** \brief Sets data length code of a message object
787  * \param hwObj Pointer to CAN message object registers
788  * \param code CAN frame data length code
789  * \return None
790  */
792 
793 /** \brief Enable / Disable data length code copy of a gateway source message object
794  * \param hwObj Pointer to CAN message object registers
795  * \param enabled Enable / disable choice
796  * \return None
797  */
798 IFX_INLINE void IfxMultican_MsgObj_setDataLengthCodeCopy(Ifx_CAN_MO *hwObj, boolean enabled);
799 
800 /** \brief Enable / Disable extended data length of a message object
801  * \param hwObj Pointer to CAN message object registers
802  * \param enabled Enable / disable choice
803  * \return None
804  */
805 IFX_INLINE void IfxMultican_MsgObj_setExtendedDataLength(Ifx_CAN_MO *hwObj, boolean enabled);
806 
807 /** \brief Enable / Disable gateway data frame send of a gateway source message object
808  * which in turn sets the TXRQ of the gateway deatination object
809  * \param hwObj Pointer to CAN message object registers
810  * \param enabled Enable / disable choice
811  * \return None
812  */
813 IFX_INLINE void IfxMultican_MsgObj_setGatewayDataFrameSend(Ifx_CAN_MO *hwObj, boolean enabled);
814 
815 /** \brief Enable / Disable identifier copy of a gateway source message object
816  * \param hwObj Pointer to CAN message object registers
817  * \param enabled Enable / disable choice
818  * \return None
819  */
820 IFX_INLINE void IfxMultican_MsgObj_setIdentifierCopy(Ifx_CAN_MO *hwObj, boolean enabled);
821 
822 /** \brief Sets identifier extension of message object
823  * \param hwObj Pointer to CAN message object registers
824  * \param extension Acceptance Mask for the message IDE bit
825  * \return None
826  */
827 IFX_INLINE void IfxMultican_MsgObj_setIdentifierExtension(Ifx_CAN_MO *hwObj, boolean extension);
828 
829 /** \brief Sets acceptance mask for the message IDE bit
830  * \param hwObj Pointer to CAN message object registers
831  * \param matchingId Acceptance Mask for the message IDE bit
832  * \return None
833  */
834 IFX_INLINE void IfxMultican_MsgObj_setMatchingId(Ifx_CAN_MO *hwObj, boolean matchingId);
835 
836 /** \brief Sets message identifier of message object
837  * \param hwObj Pointer to CAN message object registers
838  * \param messageId CAN Identifier of message object
839  * \param extendedFrame Extended frame enabled / disabled
840  * \return None
841  */
842 IFX_INLINE void IfxMultican_MsgObj_setMessageId(Ifx_CAN_MO *hwObj, uint32 messageId, boolean extendedFrame);
843 
844 /** \brief Sets the message mode of a message object
845  * \param hwObj Pointer to CAN message object registers
846  * \param mode CAN Message Object Mode
847  * \return None
848  */
850 
851 /** \brief Sets message pending number that selects the bit position of the bit in the Message Pending Register\n
852  * that is set upon a message object n receive/transmit interrupt
853  * \param hwObj Pointer to CAN message object registers
854  * \param messageNumber Message pending number
855  * \return None
856  */
857 IFX_INLINE void IfxMultican_MsgObj_setMessagePendingNumber(Ifx_CAN_MO *hwObj, IfxMultican_MsgObjId messageNumber);
858 
859 /** \brief Enable / Disable overflow interrupt of a message object
860  * \param hwObj Pointer to CAN message object registers
861  * \param enabled Enable / disable choice
862  * \return None
863  */
864 IFX_INLINE void IfxMultican_MsgObj_setOverflowInterrupt(Ifx_CAN_MO *hwObj, boolean enabled);
865 
866 /** \brief Sets priority class of message object
867  * \param hwObj Pointer to CAN message object registers
868  * \param priority One of the priority classes 0, 1, 2, 3 to message object n
869  * \return None
870  */
872 
873 /** \brief Enable / Disable receive interrupt of a message object
874  * \param hwObj Pointer to CAN message object registers
875  * \param enabled Enable / disable choice
876  * \return None
877  */
878 IFX_INLINE void IfxMultican_MsgObj_setReceiveInterrupt(Ifx_CAN_MO *hwObj, boolean enabled);
879 
880 /** \brief Sets receive interrupt node pointer of message object
881  * \param hwObj Pointer to CAN message object registers
882  * \param srcId Service request ID
883  * \return None
884  */
886 
887 /** \brief Enable / Disable transmit object remote monitoring of a message object
888  * \param hwObj Pointer to CAN message object registers
889  * \param enabled Enable / disable choice
890  * \return None
891  */
892 IFX_INLINE void IfxMultican_MsgObj_setRemoteMonitoring(Ifx_CAN_MO *hwObj, boolean enabled);
893 
894 /** \brief Sets bottom object select pointer of the base message object
895  * \param hwObj Pointer to CAN message object registers
896  * \param objNumber Select message object number
897  * \return None
898  */
899 IFX_INLINE void IfxMultican_MsgObj_setSelectObjectPointer(Ifx_CAN_MO *hwObj, sint32 objNumber);
900 
901 /** \brief Enable / Disable single data transfer of a message object
902  * \param hwObj Pointer to CAN message object registers
903  * \param enabled Enable / disable choice
904  * \return None
905  */
906 IFX_INLINE void IfxMultican_MsgObj_setSingleDataTransfer(Ifx_CAN_MO *hwObj, boolean enabled);
907 
908 /** \brief Enable / Disable single transmit trial of a message object
909  * \param hwObj Pointer to CAN message object registers
910  * \param enabled Enable / disable choice
911  * \return None
912  */
913 IFX_INLINE void IfxMultican_MsgObj_setSingleTransmitTrial(Ifx_CAN_MO *hwObj, boolean enabled);
914 
915 /** \brief Sets top object pointer of the base message object
916  * \param hwObj Pointer to CAN message object registers
917  * \param objNumber Top message object number
918  * \return None
919  */
920 IFX_INLINE void IfxMultican_MsgObj_setTopObjectPointer(Ifx_CAN_MO *hwObj, sint32 objNumber);
921 
922 /** \brief Enable / Disable transmit interrupt of a message object
923  * \param hwObj Pointer to CAN message object registers
924  * \param enabled Enable / disable choice
925  * \return None
926  */
927 IFX_INLINE void IfxMultican_MsgObj_setTransmitInterrupt(Ifx_CAN_MO *hwObj, boolean enabled);
928 
929 /** \brief Sets transmit interrupt node pointer of message object
930  * \param hwObj Pointer to CAN message object registers
931  * \param srcId Service request ID
932  * \return None
933  */
935 
936 /******************************************************************************/
937 /*-------------------------Global Function Prototypes-------------------------*/
938 /******************************************************************************/
939 
940 /** \brief Cancel pending TX request by invalidating the request, only when frame transmission has not been started.
941  * \param hwObj Pointer to CAN message object registers
942  * \return TRUE if cancellation was successfully executed
943  */
944 IFX_EXTERN boolean IfxMultican_MsgObj_cancelSend(Ifx_CAN_MO *hwObj);
945 
946 /** \brief Clears the selected status flag of a message object
947  * \param hwObj Pointer to CAN message object registers
948  * \param flag Message Object status flag
949  * \return None
950  */
952 
953 /** \brief Reset the message object\n
954  * Append the message object to the end of idle list and reset message object registers
955  * \param mcan Specifies the CAN module
956  * \param msgObjId Specifies the message object index. Range = [0, \ref IFXMULTICAN_NUM_MESSAGE_OBJECTS - 1]
957  * \return None
958  */
959 IFX_EXTERN void IfxMultican_MsgObj_deinit(Ifx_CAN *mcan, IfxMultican_MsgObjId msgObjId);
960 
961 /** \brief Get message object ID which has TX/RX pending flag from a message object group
962  * \param mcan Specifies the CAN module
963  * \param msgObjGroup Message object group
964  * \return Message object index
965  */
967 
968 /** \brief Get the message object status
969  * \param hwObj Pointer to CAN message object registers
970  * \return \ref IfxMultican_MsgObjStat bitfield
971  */
973 
974 /** \brief Gets the status of the selected status flag of a message object
975  * \param hwObj Pointer to CAN message object registers
976  * \param flag Message Object status flag
977  * \return Status (TRUE / FALSE)
978  */
980 
981 /** \brief Read a received CAN long frame
982  * \param mcan Specifies the CAN module
983  * \param msgObjId Specifies the message object index. Range = [0, \ref IFXMULTICAN_NUM_MESSAGE_OBJECTS - 1]
984  * \param msg The message which should be initialized
985  * \param data Pointer to data (in words)
986  * \return IfxMultican_Status_newData: if the operation was successful\n
987  * IfxMultican_Status_newDataButMessageLost: if the one message lost and last new data is retrieved successfully\n
988  * IfxMultican_Status_messageLost: if the message lost and new data is not yet ready\n
989  * IfxMultican_Status_receiveEmpty: if no message is been received
990  */
992 
993 /** \brief Read a received CAN message
994  * \param hwObj Pointer to CAN message object registers
995  * \param msg This parameter is filled in by the function with the received message. Also when reading is not successful.
996  * \return IfxMultican_Status_newData: if the operation was successful\n
997  * IfxMultican_Status_newDataButMessageLost: if the one message lost and last new data is retrieved successfully\n
998  * IfxMultican_Status_messageLost: if the message lost and new data is not yet ready\n
999  * IfxMultican_Status_receiveEmpty: if no message is been received
1000  */
1002 
1003 /** \brief Send a CAN Long frame message
1004  * \param mcan Specifies the CAN module
1005  * \param msgObjId Specifies the message object index. Range = [0, \ref IFXMULTICAN_NUM_MESSAGE_OBJECTS - 1]
1006  * \param msg The message which should be initialized
1007  * \param data Pointer to data (in words)
1008  * \return IfxMultican_Status_ok: if the operation was successful
1009  * IfxMultican_Status_notSentBusy: if the operation was unsuccessful due to hardware is busy
1010  */
1012 
1013 /** \brief Send a CAN message
1014  * \param hwObj Pointer to CAN message object registers
1015  * \param msg Specifies the message to be send
1016  * \return IfxMultican_Status_ok: if the operation was successful
1017  * IfxMultican_Status_notSentBusy: if the operation was unsuccessful due to hardware is busy
1018  */
1020 
1021 /** \brief Set message object filter
1022  * \param hwObj Pointer to CAN message object registers
1023  * \param extend TRUE/FALSE : extended ID
1024  * \param id ID
1025  * \param accMask acceptance mask
1026  * \return None
1027  */
1028 IFX_EXTERN void IfxMultican_MsgObj_setFilter(Ifx_CAN_MO *hwObj, boolean extend, uint32 id, uint32 accMask);
1029 
1030 /** \brief Sets the selected status flag of a message object
1031  * \param hwObj Pointer to CAN message object registers
1032  * \param flag Message Object status flag
1033  * \return None
1034  */
1036 
1037 /** \} */
1038 
1039 /** \addtogroup IfxLld_Multican_Std_Interrupts
1040  * \{ */
1041 
1042 /******************************************************************************/
1043 /*-------------------------Global Function Prototypes-------------------------*/
1044 /******************************************************************************/
1045 
1046 /** \brief Get the interrupt source register
1047  * \param mcan Specifies the CAN module
1048  * \param srcId Specifies the service request ID
1049  * \return Address of the interrupt source register\n
1050  */
1051 IFX_EXTERN volatile Ifx_SRC_SRCR *IfxMultican_getSrcPointer(Ifx_CAN *mcan, IfxMultican_SrcId srcId);
1052 
1053 /** \} */
1054 
1055 /******************************************************************************/
1056 /*---------------------Inline Function Implementations------------------------*/
1057 /******************************************************************************/
1058 
1060 {
1061  msg->id = id;
1062  msg->data[0] = dataLow;
1063  msg->data[1] = dataHigh;
1064  msg->lengthCode = lengthCode;
1065 
1066  msg->fastBitRate = FALSE;
1067 }
1068 
1069 
1071 {
1072  msg->id = id;
1073  msg->data[0] = 0; /* not being used */
1074  msg->data[1] = 0; /* not being used */
1075  msg->lengthCode = lengthCode;
1076  msg->fastBitRate = fastBitRate;
1077 }
1078 
1079 
1081 {
1082  hwObj->DATAL.U = 0;
1083  hwObj->DATAH.U = 0;
1084 }
1085 
1086 
1088 {
1089  hwObj->FGPR.U = 0x0000000U;
1090 }
1091 
1092 
1094 {
1096 }
1097 
1098 
1100 {
1102 }
1103 
1104 
1106 {
1107  return (IfxMultican_MsgObjId)(hwObj->FGPR.B.BOT);
1108 }
1109 
1110 
1112 {
1113  return (IfxMultican_DataLengthCode)(hwObj->FCR.B.DLC);
1114 }
1115 
1116 
1118 {
1119  Ifx_CAN_MO_AR ar;
1120  ar.U = hwObj->AR.U;
1121  return ar.B.ID >> ((ar.B.IDE != 0) ? 0 : 18);
1122 }
1123 
1124 
1126 {
1127  return (IfxMultican_MsgObjId)(hwObj->STAT.B.PNEXT);
1128 }
1129 
1130 
1132 {
1133  return &(mcan->MO[msgObjId]);
1134 }
1135 
1136 
1138 {
1139  return hwObj->AR.B.IDE != 0;
1140 }
1141 
1142 
1143 IFX_INLINE boolean IfxMultican_MsgObj_isRxPending(Ifx_CAN_MO *hwObj)
1144 {
1146  return msgStatus.B.RXPND ? TRUE : FALSE;
1147 }
1148 
1149 
1151 {
1153  return msgStatus.B.TXRQ ? TRUE : FALSE;
1154 }
1155 
1156 
1157 IFX_INLINE boolean IfxMultican_MsgObj_isTxPending(Ifx_CAN_MO *hwObj)
1158 {
1160  return msgStatus.B.TXPND ? TRUE : FALSE;
1161 }
1162 
1163 
1164 IFX_INLINE void IfxMultican_MsgObj_setAcceptanceMask(Ifx_CAN_MO *hwObj, uint32 mask, boolean extendedFrame)
1165 {
1166  hwObj->AMR.B.AM = mask << ((extendedFrame != 0) ? 0 : 18);
1167 }
1168 
1169 
1170 IFX_INLINE void IfxMultican_MsgObj_setBitRateSwitch(Ifx_CAN_MO *hwObj, boolean enabled)
1171 {
1172  hwObj->FCR.B.BRS = enabled ? 1 : 0;
1173 }
1174 
1175 
1177 {
1178  hwObj->FGPR.B.BOT = objNumber;
1179 }
1180 
1181 
1183 {
1184  hwObj->FGPR.B.CUR = objNumber;
1185 }
1186 
1187 
1188 IFX_INLINE void IfxMultican_MsgObj_setDataCopy(Ifx_CAN_MO *hwObj, boolean enabled)
1189 {
1190  hwObj->FCR.B.DATC = enabled ? 1 : 0;
1191 }
1192 
1193 
1195 {
1196  hwObj->FCR.B.DLC = code;
1197 }
1198 
1199 
1200 IFX_INLINE void IfxMultican_MsgObj_setDataLengthCodeCopy(Ifx_CAN_MO *hwObj, boolean enabled)
1201 {
1202  hwObj->FCR.B.DLCC = enabled ? 1 : 0;
1203 }
1204 
1205 
1206 IFX_INLINE void IfxMultican_MsgObj_setExtendedDataLength(Ifx_CAN_MO *hwObj, boolean enabled)
1207 {
1208  hwObj->FCR.B.FDF = enabled ? 1 : 0;
1209 }
1210 
1211 
1212 IFX_INLINE void IfxMultican_MsgObj_setGatewayDataFrameSend(Ifx_CAN_MO *hwObj, boolean enabled)
1213 {
1214  hwObj->FCR.B.GDFS = enabled ? 1 : 0;
1215 }
1216 
1217 
1218 IFX_INLINE void IfxMultican_MsgObj_setIdentifierCopy(Ifx_CAN_MO *hwObj, boolean enabled)
1219 {
1220  hwObj->FCR.B.IDC = enabled ? 1 : 0;
1221 }
1222 
1223 
1224 IFX_INLINE void IfxMultican_MsgObj_setIdentifierExtension(Ifx_CAN_MO *hwObj, boolean extension)
1225 {
1226  hwObj->AR.B.IDE = extension;
1227 }
1228 
1229 
1230 IFX_INLINE void IfxMultican_MsgObj_setMatchingId(Ifx_CAN_MO *hwObj, boolean matchingId)
1231 {
1232  hwObj->AMR.B.MIDE = matchingId;
1233 }
1234 
1235 
1236 IFX_INLINE void IfxMultican_MsgObj_setMessageId(Ifx_CAN_MO *hwObj, uint32 messageId, boolean extendedFrame)
1237 {
1238  hwObj->AR.B.ID = messageId << ((extendedFrame != 0) ? 0 : 18);
1239 }
1240 
1241 
1243 {
1244  hwObj->FCR.B.MMC = mode;
1245 }
1246 
1247 
1249 {
1250  hwObj->IPR.B.MPN = messageNumber;
1251 }
1252 
1253 
1254 IFX_INLINE void IfxMultican_MsgObj_setOverflowInterrupt(Ifx_CAN_MO *hwObj, boolean enabled)
1255 {
1256  hwObj->FCR.B.OVIE = enabled ? 1 : 0;
1257 }
1258 
1259 
1261 {
1262  hwObj->AR.B.PRI = priority;
1263 }
1264 
1265 
1266 IFX_INLINE void IfxMultican_MsgObj_setReceiveInterrupt(Ifx_CAN_MO *hwObj, boolean enabled)
1267 {
1268  hwObj->FCR.B.RXIE = enabled ? 1 : 0;
1269 }
1270 
1271 
1273 {
1274  hwObj->IPR.B.RXINP = srcId;
1275 }
1276 
1277 
1278 IFX_INLINE void IfxMultican_MsgObj_setRemoteMonitoring(Ifx_CAN_MO *hwObj, boolean enabled)
1279 {
1280  hwObj->FCR.B.RMM = enabled ? 1 : 0;
1281 }
1282 
1283 
1285 {
1286  hwObj->FGPR.B.SEL = objNumber;
1287 }
1288 
1289 
1290 IFX_INLINE void IfxMultican_MsgObj_setSingleDataTransfer(Ifx_CAN_MO *hwObj, boolean enabled)
1291 {
1292  hwObj->FCR.B.SDT = enabled ? 1 : 0;
1293 }
1294 
1295 
1296 IFX_INLINE void IfxMultican_MsgObj_setSingleTransmitTrial(Ifx_CAN_MO *hwObj, boolean enabled)
1297 {
1298  hwObj->FCR.B.STT = enabled ? 1 : 0;
1299 }
1300 
1301 
1303 {
1304  hwObj->FGPR.B.TOP = objNumber;
1305 }
1306 
1307 
1308 IFX_INLINE void IfxMultican_MsgObj_setTransmitInterrupt(Ifx_CAN_MO *hwObj, boolean enabled)
1309 {
1310  hwObj->FCR.B.TXIE = enabled ? 1 : 0;
1311 }
1312 
1313 
1315 {
1316  hwObj->IPR.B.TXINP = srcId;
1317 }
1318 
1319 
1320 IFX_INLINE void IfxMultican_Node_activate(Ifx_CAN_N *hwNode)
1321 {
1322  hwNode->CR.B.INIT = 0;
1323 }
1324 
1325 
1327 {
1328  hwNode->CR.B.INIT = 1;
1329 }
1330 
1331 
1333 {
1334  hwNode->CR.B.CCE = 0U;
1335 }
1336 
1337 
1339 {
1340  hwNode->CR.B.CCE = 1U;
1341 }
1342 
1343 
1345 {
1346  return &(mcan->N[node]);
1347 }
1348 
1349 
1351 {
1352  hwNode->CR.U = 0x00000041U;
1353 }
1354 
1355 
1357 {
1358  hwNode->ECNT.U = 0x00600000U;
1359 }
1360 
1361 
1363 {
1364  hwNode->IPR.U = 0x00000000U;
1365 }
1366 
1367 
1368 IFX_INLINE void IfxMultican_Node_setAlertInterrupt(Ifx_CAN_N *hwNode, boolean enabled)
1369 {
1370  hwNode->CR.B.ALIE = enabled ? 1 : 0;
1371 }
1372 
1373 
1375 {
1376  hwNode->IPR.B.ALINP = srcId;
1377 }
1378 
1379 
1380 IFX_INLINE void IfxMultican_Node_setAnalyzerMode(Ifx_CAN_N *hwNode, boolean mode)
1381 {
1382  hwNode->CR.B.CALM = mode != FALSE;
1383 }
1384 
1385 
1387 {
1388  hwNode->ECNT.B.EWRNLVL = level;
1389 }
1390 
1391 
1392 IFX_INLINE void IfxMultican_Node_setFastNode(Ifx_CAN_N *hwNode, boolean enabled)
1393 {
1394  hwNode->CR.B.INIT = 1;
1395  hwNode->CR.B.FDEN = enabled ? 1 : 0;
1396  hwNode->CR.B.INIT = 0;
1397 }
1398 
1399 
1400 IFX_INLINE void IfxMultican_Node_setFrameCounterInterrupt(Ifx_CAN_N *hwNode, boolean enabled)
1401 {
1402  hwNode->FCR.B.CFCIE = enabled ? 1 : 0;
1403 }
1404 
1405 
1407 {
1408  hwNode->IPR.B.CFCINP = srcId;
1409 }
1410 
1411 
1413 {
1414  hwNode->FCR.B.CFMOD = mode;
1415 }
1416 
1417 
1418 IFX_INLINE void IfxMultican_Node_setLastErrorCodeInterrupt(Ifx_CAN_N *hwNode, boolean enabled)
1419 {
1420  hwNode->CR.B.LECIE = enabled ? 1 : 0;
1421 }
1422 
1423 
1425 {
1426  hwNode->IPR.B.LECINP = srcId;
1427 }
1428 
1429 
1430 IFX_INLINE void IfxMultican_Node_setLoopBackMode(Ifx_CAN_N *hwNode, boolean mode)
1431 {
1432  hwNode->PCR.B.LBM = mode != FALSE;
1433 }
1434 
1435 
1437 {
1438  hwNode->ECNT.B.REC = value;
1439 }
1440 
1441 
1443 {
1444  hwNode->IPR.B.TEINP = srcId;
1445 }
1446 
1447 
1448 IFX_INLINE void IfxMultican_Node_setTransceiverDelayCompensation(Ifx_CAN_N *hwNode, boolean enabled)
1449 {
1450  hwNode->TDCR.B.TDC = enabled ? 1 : 0;
1451 }
1452 
1453 
1455 {
1456  hwNode->TDCR.B.TDCO = value;
1457 }
1458 
1459 
1460 IFX_INLINE void IfxMultican_Node_setTransferInterrupt(Ifx_CAN_N *hwNode, boolean enabled)
1461 {
1462  hwNode->CR.B.TRIE = enabled ? 1 : 0;
1463 }
1464 
1465 
1467 {
1468  hwNode->IPR.B.TRINP = srcId;
1469 }
1470 
1471 
1473 {
1474  hwNode->ECNT.B.TEC = value;
1475 }
1476 
1477 
1479 {
1480  mcan->MCR.B.MPSEL = 0x0U;
1481 }
1482 
1483 
1485 {
1486  mcan->MSPND[list].U = 0x0;
1487 }
1488 
1489 
1491 {
1492  mcan->CLC.B.DISR = 1U;
1493 }
1494 
1495 
1497 {
1498  mcan->CLC.B.EDIS = 1U;
1499 }
1500 
1501 
1503 {
1504  mcan->CLC.B.DISR = 0U;
1505 }
1506 
1507 
1509 {
1510  mcan->CLC.B.EDIS = 0U;
1511 }
1512 
1513 
1515 {
1516  return mcan->FDR.B.DM;
1517 }
1518 
1519 
1521 {
1522  return mcan->FDR.B.STEP;
1523 }
1524 
1525 
1527 {
1528  return (IfxMultican_ClockSelect)mcan->MCR.B.CLKSEL;
1529 }
1530 
1531 
1533 {
1534  return mcan->CLC.B.DISS == 0;
1535 }
1536 
1537 
1539 {
1540  mcan->FDR.B.DM = mode;
1541 }
1542 
1543 
1545 {
1546  mcan->FDR.B.STEP = stepValue;
1547 }
1548 
1549 
1551 {
1552  mcan->MCR.B.CLKSEL = clockSelect;
1553 }
1554 
1555 
1557 {
1558  mcan->MSIMASK.U = mask;
1559 }
1560 
1561 
1563 {
1565  IfxScuWdt_clearCpuEndinit(passwd);
1566  can->CLC.B.EDIS = mode;
1567  IfxScuWdt_setCpuEndinit(passwd);
1568 }
1569 
1570 
1572 {
1573  while (mcan->PANCTR.B.BUSY != 0)
1574  {}
1575 }
1576 
1577 
1578 #endif /* IFXMULTICAN_H */