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