Infineon MOTIX™ MCU TLE985x Device Family SDK
lin.h
Go to the documentation of this file.
1 /*
2  ***********************************************************************************************************************
3  *
4  * Copyright (c) 2018-2023, Infineon Technologies AG
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the
8  * following conditions are met:
9  *
10  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
11  * disclaimer.
12  *
13  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
14  * following disclaimer in the documentation and/or other materials provided with the distribution.
15  *
16  * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
17  * products derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  **********************************************************************************************************************/
39 /*******************************************************************************
40 ** Author(s) Identity **
41 ********************************************************************************
42 ** Initials Name **
43 ** ---------------------------------------------------------------------------**
44 ** TS T&S **
45 ** JO Julia Ott **
46 ** BG Blandine Guillot **
47 *******************************************************************************/
48 
49 /*******************************************************************************
50 ** Revision Control History **
51 ********************************************************************************
52 ** V0.2.0: 2018-02-13, TS: Initial version of revision history **
53 ** V0.2.1: 2019-01-28, TS: __STATIC_INLINE changed to INLINE **
54 ** Doxygen Update **
55 ** Revision history moved from lin.c to lin.h **
56 ** V0.2.2: 2019-06-27, JO: Added macro LIN_GET_MODE_DISABLED **
57 ** V0.2.3: 2020-03-02, BG: Updated revision history format **
58 ** V0.2.4: 2022-01-21, JO: EP-934: Updated copyright and branding **
59 ** V0.2.5: 2023-08-28, JO: EP-435: Removed ARMCC v6 compiler warnings **
60 *******************************************************************************/
61 
62 #ifndef LIN_H
63 #define LIN_H
64 
65 /*******************************************************************************
66 ** Includes **
67 *******************************************************************************/
68 #include "tle985x.h"
69 #include "types.h"
70 #include "sfr_access.h"
71 
72 /*******************************************************************************
73 ** Global Macro Definitions **
74 *******************************************************************************/
76 #define LIN_MODE_SLEEP (0u)
78 #define LIN_MODE_RCV_ONLY (1u)
80 #define LIN_MODE_NORMAL (3u)
81 
83 #define LIN_GET_MODE_DISABLED (0u)
85 #define LIN_GET_MODE_SLEEP (1u)
87 #define LIN_GET_MODE_RCV_ONLY (5u)
89 #define LIN_GET_MODE_NORMAL (7u)
90 
92 #define LIN_SLOPE_NORMAL (0u)
94 #define LIN_SLOPE_FAST (1u)
96 #define LIN_SLOPE_LOW (2u)
98 #define LIN_SLOPE_FLASH (3u)
99 
100 /*******************************************************************************
101 ** Global Function Declarations **
102 *******************************************************************************/
107 void LIN_Init(void);
108 
109 /*******************************************************************************
110 ** Inline Function Declarations **
111 *******************************************************************************/
126 INLINE void LIN_Set_Mode(uint8 Mode);
127 
145 
160 INLINE void LIN_Set_Slope(uint8 SlopeMode);
161 
174 INLINE void LIN_Break_Detect_En(void);
175 
188 INLINE void LIN_Break_Detect_Dis(void);
189 
205 
223 INLINE void LIN_Over_Curr_Int_Clr(void);
224 
242 INLINE void LIN_Over_Temp_Int_Clr(void);
243 
261 INLINE void LIN_Time_Out_Int_Clr(void);
262 
280 INLINE void LIN_Mode_Error_Int_Clr(void);
281 
300 
319 
332 INLINE void LIN_Break_Int_Clr(void);
333 
351 INLINE void LIN_Over_Curr_Int_En(void);
352 
371 INLINE void LIN_Over_Curr_Int_Dis(void);
372 
390 INLINE void LIN_Over_Temp_Int_En(void);
391 
410 INLINE void LIN_Over_Temp_Int_Dis(void);
411 
429 INLINE void LIN_Time_Out_Int_En(void);
430 
449 INLINE void LIN_Time_Out_Int_Dis(void);
450 
468 INLINE void LIN_M_SM_ERR_Int_En(void);
469 
488 INLINE void LIN_M_SM_ERR_Int_Dis(void);
489 
507 INLINE void LIN_Sync_Int_En(void);
508 
527 INLINE void LIN_Sync_Int_Dis(void);
528 
549 
570 
588 
589 /*******************************************************************************
590 ** Inline Function Definitions **
591 *******************************************************************************/
593 {
595 }
596 
598 {
600 }
601 
602 INLINE void LIN_Set_Slope(uint8 SlopeMode)
603 {
605  Field_Mod32(&LIN->CTRL.reg, (uint8)LIN_CTRL_SM_Pos, LIN_CTRL_SM_Msk, SlopeMode);
607 }
608 
610 {
612 }
613 
615 {
617 }
618 
620 {
622 }
623 
625 {
627 }
628 
630 {
632 }
633 
635 {
637 }
638 
640 {
642 }
643 
645 {
647 }
648 
650 {
652 }
653 
655 {
657 }
658 
660 {
662 }
663 
665 {
667 }
668 
670 {
672 }
673 
675 {
677 }
678 
680 {
682 }
683 
685 {
687 }
688 
690 {
692 }
693 
695 {
697 }
698 
700 {
702 }
703 
705 {
707 }
708 
710 {
712 }
713 
715 {
717 }
718 
720 {
722 }
723 
724 #endif
#define SCU
Definition: tle985x.h:6277
#define LIN
Definition: tle985x.h:6272
#define LIN_IRQEN_OC_IEN_Msk
Definition: tle985x.h:9043
#define SCU_LINSCLR_ERRSYNC_Pos
Definition: tle985x.h:10076
#define LIN_CTRL_SM_Msk
Definition: tle985x.h:9013
#define SCU_LINST_EOFSYN_Msk
Definition: tle985x.h:10088
#define LIN_IRQCLR_TXD_TMOUT_ISC_Pos
Definition: tle985x.h:9031
#define LIN_IRQEN_M_SM_ERR_IEN_Pos
Definition: tle985x.h:9046
#define LIN_IRQCLR_OC_ISC_Pos
Definition: tle985x.h:9033
#define SCU_LINSCLR_BRKC_Msk
Definition: tle985x.h:10081
#define LIN_IRQEN_OT_IEN_Pos
Definition: tle985x.h:9044
#define SCU_LINSCLR_EOFSYNC_Msk
Definition: tle985x.h:10079
#define SCU_LINST_SYNEN_Msk
Definition: tle985x.h:10084
#define SCU_LINST_BRK_Pos
Definition: tle985x.h:10089
#define LIN_IRQEN_TXD_TMOUT_IEN_Msk
Definition: tle985x.h:9041
#define LIN_CTRL_MODE_FB_Pos
Definition: tle985x.h:9018
#define LIN_CTRL_MODE_FB_Msk
Definition: tle985x.h:9019
#define SCU_LINST_ERRSYN_Msk
Definition: tle985x.h:10086
#define LIN_IRQEN_OC_IEN_Pos
Definition: tle985x.h:9042
#define LIN_IRQEN_TXD_TMOUT_IEN_Pos
Definition: tle985x.h:9040
#define LIN_CTRL_MODE_Msk
Definition: tle985x.h:9021
#define LIN_CTRL_SM_Pos
Definition: tle985x.h:9012
#define SCU_LINST_BRDIS_Pos
Definition: tle985x.h:10093
#define SCU_LINST_EOFSYN_Pos
Definition: tle985x.h:10087
#define SCU_LINST_BRDIS_Msk
Definition: tle985x.h:10094
#define SCU_LINSCLR_ERRSYNC_Msk
Definition: tle985x.h:10077
#define SCU_LINST_BGSEL_Pos
Definition: tle985x.h:10091
#define LIN_CTRL_MODE_Pos
Definition: tle985x.h:9020
#define SCU_LINST_SYNEN_Pos
Definition: tle985x.h:10083
#define LIN_IRQEN_OT_IEN_Msk
Definition: tle985x.h:9045
#define LIN_IRQCLR_OC_ISC_Msk
Definition: tle985x.h:9034
#define LIN_IRQCLR_OT_ISC_Pos
Definition: tle985x.h:9035
#define LIN_IRQCLR_M_SM_ERR_ISC_Msk
Definition: tle985x.h:9038
#define LIN_IRQCLR_M_SM_ERR_ISC_Pos
Definition: tle985x.h:9037
#define SCU_LINSCLR_BRKC_Pos
Definition: tle985x.h:10080
#define SCU_LINST_BGSEL_Msk
Definition: tle985x.h:10092
#define LIN_IRQCLR_OT_ISC_Msk
Definition: tle985x.h:9036
#define SCU_LINST_ERRSYN_Pos
Definition: tle985x.h:10085
#define SCU_LINST_BRK_Msk
Definition: tle985x.h:10090
#define LIN_IRQEN_M_SM_ERR_IEN_Msk
Definition: tle985x.h:9047
#define LIN_IRQCLR_TXD_TMOUT_ISC_Msk
Definition: tle985x.h:9032
#define SCU_LINSCLR_EOFSYNC_Pos
Definition: tle985x.h:10078
#define LIN_MODE_SLEEP
LIN MODE, SLEEP MODE.
Definition: lin.h:76
INLINE void LIN_Time_Out_Int_En(void)
Enables LIN Transceiver TxD-Timeout interrupt.
Definition: lin.h:679
INLINE void LIN_Err_In_Sync_Int_Clr(void)
Clears SYN Byte Error interrupt flag.
Definition: lin.h:649
INLINE uint8 LIN_Break_Sts(void)
Reads Break Field Status.
Definition: lin.h:719
INLINE void LIN_Mode_Error_Int_Clr(void)
Clears LIN Transceiver Mode Error - Slope Mode Error interrupt flag.
Definition: lin.h:639
INLINE void LIN_End_Of_Sync_Int_Clr(void)
Clears End of SYN Byte interrupt flag.
Definition: lin.h:644
INLINE void LIN_Sync_Int_Dis(void)
Disables End of SYN Byte and SYN Byte Error interrupt.
Definition: lin.h:704
INLINE void LIN_Over_Temp_Int_Dis(void)
Disables LIN Transceiver Overtemperature interrupt.
Definition: lin.h:674
INLINE void LIN_Over_Temp_Int_En(void)
Enables LIN Transceiver Overtemperature interrupt.
Definition: lin.h:669
INLINE uint8 LIN_Err_In_Sync_Sts(void)
Reads SYN Byte Error Interrupt Status.
Definition: lin.h:714
INLINE void LIN_Set_Mode(uint8 Mode)
Sets LIN Trx. Mode.
Definition: lin.h:592
INLINE uint8 LIN_End_Of_Sync_Sts(void)
Reads End of SYN Byte Interrupt Status.
Definition: lin.h:709
INLINE void LIN_Time_Out_Int_Clr(void)
Clears LIN TXD time-out interrupt flag.
Definition: lin.h:634
INLINE void LIN_Break_Int_Clr(void)
Clears Break Field flag.
Definition: lin.h:654
INLINE void LIN_Sync_Int_En(void)
Enables End of SYN Byte and SYN Byte Error interrupt.
Definition: lin.h:699
INLINE uint8 LIN_Get_Mode(void)
Gets LIN Trx. Mode.
Definition: lin.h:597
#define LIN_MODE_NORMAL
LIN MODE, NORMAL MODE.
Definition: lin.h:80
INLINE void LIN_Set_Slope(uint8 SlopeMode)
Sets LIN Trx. Slope Mode.
Definition: lin.h:602
INLINE void LIN_Over_Curr_Int_Dis(void)
Disables LIN Transceiver Overcurrent interrupt.
Definition: lin.h:664
INLINE void LIN_Break_Detect_En(void)
Enables Baud Rate Detection.
Definition: lin.h:609
INLINE void LIN_BaudRate_Range_Sel(uint8 value)
Selects Baud Rate Detection.
Definition: lin.h:619
void LIN_Init(void)
Initializes the LIN module.
INLINE void LIN_M_SM_ERR_Int_Dis(void)
Disables LIN Transceiver Mode Error - Slope Mode Error interrupt.
Definition: lin.h:694
INLINE void LIN_Over_Curr_Int_En(void)
Enables LIN Transceiver Overcurrent interrupt.
Definition: lin.h:659
INLINE void LIN_Break_Detect_Dis(void)
Disables Baud Rate Detection.
Definition: lin.h:614
INLINE void LIN_Time_Out_Int_Dis(void)
Disables LIN Transceiver TxD-Timeout interrupt.
Definition: lin.h:684
INLINE void LIN_M_SM_ERR_Int_En(void)
Enables LIN Transceiver Mode Error - Slope Mode Error interrupt.
Definition: lin.h:689
INLINE void LIN_Over_Temp_Int_Clr(void)
Clears LIN Receiver Overtemperature interrupt flag.
Definition: lin.h:629
INLINE void LIN_Over_Curr_Int_Clr(void)
Clears LIN Receiver Overcurrent interrupt flag.
Definition: lin.h:624
SFR low level access library.
INLINE uint8 u1_Field_Rd32(const volatile uint32 *reg, uint8 pos, uint32 msk)
This function reads a 1-bit field of a 32-bit register.
Definition: sfr_access.h:423
INLINE void Field_Wrt32(volatile uint32 *reg, uint8 pos, uint32 msk, uint32 val)
This function writes a bit field in a 32-bit register.
Definition: sfr_access.h:358
INLINE uint8 u8_Field_Rd32(const volatile uint32 *reg, uint8 pos, uint32 msk)
This function reads a 8-bit field of a 32-bit register.
Definition: sfr_access.h:438
INLINE void Field_Mod32(volatile uint32 *reg, uint8 pos, uint32 msk, uint32 val)
This function writes a bit field in a 32-bit register.
Definition: sfr_access.h:378
CMSIS register HeaderFile.
General type declarations.
#define INLINE
Definition: types.h:145
uint8_t uint8
8 bit unsigned value
Definition: types.h:153