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