Infineon MOTIX™ MCU TLE987x Device Family SDK
lin.h
Go to the documentation of this file.
1 /*
2  ***********************************************************************************************************************
3  *
4  * Copyright (c) Infineon Technologies AG
5  * All rights reserved.
6  *
7  * The applicable license agreement can be found at this pack's installation directory in the file
8  * license/IFX_SW_Licence_MOTIX_LITIX.txt
9  *
10  **********************************************************************************************************************/
20 /*******************************************************************************
21 ** Author(s) Identity **
22 ********************************************************************************
23 ** Initials Name **
24 ** ---------------------------------------------------------------------------**
25 ** DM Daniel Mysliwitz **
26 ** BG Blandine Guillot **
27 ** JO Julia Ott **
28 *******************************************************************************/
29 
30 /*******************************************************************************
31 ** Revision Control History **
32 ********************************************************************************
33 ** V0.1.0: 2014-06-02, DM: Initial version **
34 ** V0.1.1: 2014-06-17, DM: Adding functions to change Trx. Mode and Slope **
35 ** V0.1.2: 2014-09-22, DM: LIN_Get_Mode function added **
36 ** V0.1.3: 2015-02-10, DM: Individual header file added **
37 ** V0.1.4: 2016-07-07, DM: Init function corrected to be able to set **
38 ** corrected slope mode **
39 ** V0.1.5: 2016-10-12, DM: LINST initialization added **
40 ** V0.1.6: 2017-10-10, DM: MISRA 2012 compliance, the following PC-Lint **
41 ** rules are globally deactivated: **
42 ** - Info 793: ANSI/ISO limit of 6 'significant **
43 ** characters in an external identifier **
44 ** - Info 835: A zero has been given as right **
45 ** argument to operator **
46 ** - Info 845: The left argument to operator '&' **
47 ** is certain to be 0 **
48 ** Replaced macros by INLINE functions **
49 ** Replaced register accesses within functions by **
50 ** function calls **
51 ** Replaced __STATIC_INLINE by INLINE **
52 ** V0.1.7: 2018-11-27, JO: Doxygen update **
53 ** Moved revision history from lin.c to lin.h **
54 ** V0.1.8: 2020-04-15, BG: Updated revision history format **
55 ** V0.1.9: 2020-07-21, BG: EP-439: Formatted .h/.c files **
56 ** V0.2.0: 2022-02-28, JO: EP-936: Updated copyright and branding **
57 ** V0.2.1: 2025-01-02, JO: EP-1493: Updated license **
58 *******************************************************************************/
59 
60 #ifndef LIN_H
61 #define LIN_H
62 
63 /*******************************************************************************
64 ** Includes **
65 *******************************************************************************/
66 #include "tle987x.h"
67 #include "types.h"
68 #include "sfr_access.h"
69 
70 /*******************************************************************************
71 ** Global Macro Definitions **
72 *******************************************************************************/
74 #define LIN_MODE_SLEEP (0u)
76 #define LIN_MODE_RCV_ONLY (1u)
78 #define LIN_MODE_NORMAL (3u)
79 
81 #define LIN_GET_MODE_SLEEP (1u)
83 #define LIN_GET_MODE_RCV_ONLY (5u)
85 #define LIN_GET_MODE_NORMAL (7u)
86 
88 #define LIN_SLOPE_NORMAL (0u)
90 #define LIN_SLOPE_FAST (1u)
92 #define LIN_SLOPE_LOW (2u)
94 #define LIN_SLOPE_FLASH (3u)
95 
96 /*******************************************************************************
97 ** Global Inline Function Definitions **
98 *******************************************************************************/
119 {
121 }
122 
143 {
145 }
146 
164 {
165  return ( u1_Field_Rd8(&SCU->LINST.reg, (uint8)SCU_LINST_BRK_Pos, (uint8)SCU_LINST_BRK_Msk) );
166 }
167 
181 {
183 }
184 
198 {
200 }
201 
217 {
219 }
220 
239 {
241 }
242 
261 {
263 }
264 
283 {
285 }
286 
305 {
307 }
308 
327 {
329 }
330 
344 {
346 }
347 
366 {
368 }
369 
389 {
391 }
392 
411 {
413 }
414 
434 {
436 }
437 
456 {
458 }
459 
479 {
481 }
482 
501 {
503 }
504 
524 {
526 }
527 
528 /*******************************************************************************
529 ** Global Function Declarations **
530 *******************************************************************************/
535 void LIN_Init(void);
536 
537 /*******************************************************************************
538 ** Global Inline Function Declarations **
539 *******************************************************************************/
540 INLINE void LIN_Set_Mode(uint8 Mode);
542 INLINE void LIN_Set_Slope(uint8 SlopeMode);
543 
544 /*******************************************************************************
545 ** Global Inline Function Definitions **
546 *******************************************************************************/
562 {
564 }
565 
566 
584 {
586 }
587 
602 INLINE void LIN_Set_Slope(uint8 SlopeMode)
603 {
605  Field_Mod32(&LIN->CTRL_STS.reg, LIN_CTRL_STS_SM_Pos, LIN_CTRL_STS_SM_Msk, SlopeMode);
607 }
608 
609 #endif
#define SCUPM
Definition: tle987x.h:6072
#define SCU
Definition: tle987x.h:6071
#define LIN
Definition: tle987x.h:6066
#define LIN_CTRL_STS_SM_Msk
Definition: tle987x.h:8120
#define SCU_LINSCLR_ERRSYNC_Pos
Definition: tle987x.h:9071
#define SCU_LINST_EOFSYN_Msk
Definition: tle987x.h:9081
#define LIN_CTRL_STS_MODE_Pos
Definition: tle987x.h:8133
#define SCU_LINSCLR_BRKC_Msk
Definition: tle987x.h:9068
#define SCU_LINSCLR_EOFSYNC_Msk
Definition: tle987x.h:9070
#define SCU_LINST_SYNEN_Msk
Definition: tle987x.h:9085
#define LIN_CTRL_STS_MODE_FB_Msk
Definition: tle987x.h:8112
#define SCUPM_SYS_ISCLR_LIN_OT_ICLR_Pos
Definition: tle987x.h:9714
#define SCU_LINST_BRK_Pos
Definition: tle987x.h:9078
#define SCUPM_SYS_IRQ_CTRL_LIN_OC_IE_Msk
Definition: tle987x.h:9607
#define SCU_LINST_ERRSYN_Msk
Definition: tle987x.h:9083
#define LIN_CTRL_STS_SM_Pos
Definition: tle987x.h:8119
#define SCUPM_SYS_IRQ_CTRL_LIN_TMOUT_IE_Msk
Definition: tle987x.h:9603
#define SCUPM_SYS_IRQ_CTRL_LIN_OT_IE_Pos
Definition: tle987x.h:9604
#define SCU_LINST_BRDIS_Pos
Definition: tle987x.h:9074
#define SCU_LINST_EOFSYN_Pos
Definition: tle987x.h:9080
#define SCU_LINST_BRDIS_Msk
Definition: tle987x.h:9075
#define SCU_LINSCLR_ERRSYNC_Msk
Definition: tle987x.h:9072
#define SCU_LINST_BGSEL_Pos
Definition: tle987x.h:9076
#define LIN_CTRL_STS_MODE_Msk
Definition: tle987x.h:8134
#define SCUPM_SYS_ISCLR_LIN_OC_ICLR_Pos
Definition: tle987x.h:9716
#define SCUPM_SYS_ISCLR_LIN_TMOUT_ICLR_Pos
Definition: tle987x.h:9712
#define SCU_LINST_SYNEN_Pos
Definition: tle987x.h:9084
#define SCUPM_SYS_ISCLR_LIN_OC_ICLR_Msk
Definition: tle987x.h:9717
#define SCUPM_SYS_IRQ_CTRL_LIN_TMOUT_IE_Pos
Definition: tle987x.h:9602
#define SCU_LINSCLR_BRKC_Pos
Definition: tle987x.h:9067
#define SCU_LINST_BGSEL_Msk
Definition: tle987x.h:9077
#define SCUPM_SYS_ISCLR_LIN_TMOUT_ICLR_Msk
Definition: tle987x.h:9713
#define SCUPM_SYS_IRQ_CTRL_LIN_OT_IE_Msk
Definition: tle987x.h:9605
#define SCU_LINST_ERRSYN_Pos
Definition: tle987x.h:9082
#define SCU_LINST_BRK_Msk
Definition: tle987x.h:9079
#define LIN_CTRL_STS_MODE_FB_Pos
Definition: tle987x.h:8111
#define SCUPM_SYS_ISCLR_LIN_OT_ICLR_Msk
Definition: tle987x.h:9715
#define SCUPM_SYS_IRQ_CTRL_LIN_OC_IE_Pos
Definition: tle987x.h:9606
#define SCU_LINSCLR_EOFSYNC_Pos
Definition: tle987x.h:9069
#define LIN_MODE_SLEEP
LIN MODE, SLEEP MODE.
Definition: lin.h:74
INLINE void LIN_Time_Out_Int_En(void)
enables LIN Transceiver TxD-Timeout interrupt.
Definition: lin.h:455
INLINE void LIN_Err_In_Sync_Int_Clr(void)
clears SYN Byte Error interrupt flag.
Definition: lin.h:326
INLINE uint8 LIN_Break_Sts(void)
reads Break Field Status.
Definition: lin.h:163
INLINE void LIN_End_Of_Sync_Int_Clr(void)
clears End of SYN Byte interrupt flag.
Definition: lin.h:304
INLINE void LIN_Sync_Int_Dis(void)
disables End of SYN Byte and SYN Byte Error interrupt.
Definition: lin.h:523
INLINE void LIN_Over_Temp_Int_Dis(void)
disables LIN Transceiver Overtemperature interrupt.
Definition: lin.h:433
INLINE void LIN_Over_Temp_Int_En(void)
enables LIN Transceiver Overtemperature interrupt.
Definition: lin.h:410
INLINE void LIN_BaudRate_Range_Sel(uint8 a)
selects Baud Rate Detection.
Definition: lin.h:216
INLINE uint8 LIN_Err_In_Sync_Sts(void)
reads SYN Byte Error Interrupt Status.
Definition: lin.h:142
INLINE void LIN_Set_Mode(uint8 Mode)
Sets LIN Trx. Mode.
Definition: lin.h:561
INLINE uint8 LIN_End_Of_Sync_Sts(void)
reads End of SYN Byte Interrupt Status.
Definition: lin.h:118
INLINE void LIN_Time_Out_Int_Clr(void)
clears LIN TXD time-out interrupt flag.
Definition: lin.h:282
INLINE void LIN_Break_Int_Clr(void)
clears Break Field flag.
Definition: lin.h:343
INLINE void LIN_Sync_Int_En(void)
enables End of SYN Byte and SYN Byte Error interrupt.
Definition: lin.h:500
#define LIN_MODE_NORMAL
LIN MODE, NORMAL MODE.
Definition: lin.h:78
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:388
INLINE void LIN_Break_Detect_En(void)
enables Baud Rate Detection.
Definition: lin.h:180
INLINE uint32 LIN_Get_Mode(void)
Gets LIN Trx. Mode.
Definition: lin.h:583
void LIN_Init(void)
Initializes the LIN based on the Config Wizard for MOTIX MCU configuration.
INLINE void LIN_Over_Curr_Int_En(void)
enables LIN Transceiver Overcurrent interrupt.
Definition: lin.h:365
INLINE void LIN_Break_Detect_Dis(void)
disables Baud Rate Detection.
Definition: lin.h:197
INLINE void LIN_Time_Out_Int_Dis(void)
disables LIN Transceiver TxD-Timeout interrupt.
Definition: lin.h:478
INLINE void LIN_Over_Temp_Int_Clr(void)
clears LIN Receiver Overtemperature interrupt flag.
Definition: lin.h:260
INLINE void LIN_Over_Curr_Int_Clr(void)
clears LIN Receiver Overcurrent interrupt flag.
Definition: lin.h:238
SFR low level access library.
INLINE void Field_Wrt8(volatile uint8 *reg, uint8 pos, uint8 msk, uint8 val)
This function writes a bit field in a 8-bit register.
Definition: sfr_access.h:322
INLINE void Field_Mod32(volatile uint32 *reg, uint32 pos, uint32 msk, uint32 val)
This function writes a bit field in a 32-bit register.
Definition: sfr_access.h:347
INLINE void Field_Wrt32(volatile uint32 *reg, uint32 pos, uint32 msk, uint32 val)
This function writes a bit field in a 32-bit register.
Definition: sfr_access.h:332
INLINE uint8 u1_Field_Rd8(const volatile uint8 *reg, uint8 pos, uint8 msk)
This function reads a 1-bit field of a 8-bit register.
Definition: sfr_access.h:382
INLINE uint32 u32_Field_Rd32(const volatile uint32 *reg, uint32 pos, uint32 msk)
This function reads a 32-bit field of a 32-bit register.
Definition: sfr_access.h:422
INLINE void Field_Mod8(volatile uint8 *reg, uint8 pos, uint8 msk, uint8 val)
This function writes a bit field in a 8-bit register.
Definition: sfr_access.h:337
CMSIS register HeaderFile.
General type declarations.
#define INLINE
Definition: types.h:132
uint8_t uint8
8 bit unsigned value
Definition: types.h:137
uint32_t uint32
32 bit unsigned value
Definition: types.h:139