TLE986x Device Family SDK
lin.h
Go to the documentation of this file.
1 /*
2  ***********************************************************************************************************************
3  *
4  * Copyright (c) 2015, 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  **********************************************************************************************************************/
37 /*******************************************************************************
38 ** Author(s) Identity **
39 ********************************************************************************
40 ** Initials Name **
41 ** ---------------------------------------------------------------------------**
42 ** DM Daniel Mysliwitz **
43 ** JO Julia Ott **
44 ** BG Blandine Guillot **
45 *******************************************************************************/
46 
47 /*******************************************************************************
48 ** Revision Control History **
49 ********************************************************************************
50 ** V0.1.0: 2014-06-02, DM: Initial version **
51 ** V0.1.1: 2014-06-17, DM: Adding functions to change Trx. Mode and Slope **
52 ** V0.1.2: 2014-09-22, DM: LIN_Get_Mode function added **
53 ** V0.1.3: 2015-02-10, DM: Individual header file added **
54 ** V0.1.4: 2016-07-07, DM: Init function corrected to be able to set **
55 ** corrected slope mode **
56 ** V0.1.5: 2016-10-12, DM: LINST initialization added **
57 ** V0.1.6: 2017-10-10, DM: MISRA 2012 compliance, the following PC-Lint **
58 ** rules are globally deactivated: **
59 ** - Info 793: ANSI/ISO limit of 6 'significant **
60 ** characters in an external identifier **
61 ** - Info 835: A zero has been given as right **
62 ** argument to operator **
63 ** - Info 845: The left argument to operator '&' **
64 ** is certain to be 0 **
65 ** Replaced macros by INLINE functions **
66 ** Replaced register accesses within functions by **
67 ** function calls **
68 ** Replaced __STATIC_INLINE by INLINE **
69 ** V0.1.7: 2018-11-27, JO: Doxygen update, moved revision history from **
70 ** lin.c to lin.h **
71 ** V0.1.8: 2020-02-28, BG: Updated revision history format **
72 *******************************************************************************/
73 
74 #ifndef LIN_H
75 #define LIN_H
76 
77 /*******************************************************************************
78 ** Includes **
79 *******************************************************************************/
80 #include "tle986x.h"
81 #include "types.h"
82 #include "sfr_access.h"
83 
84 /*******************************************************************************
85 ** Global Macro Definitions **
86 *******************************************************************************/
88 #define LIN_MODE_SLEEP (0u)
89 
90 #define LIN_MODE_RCV_ONLY (1u)
91 
92 #define LIN_MODE_NORMAL (3u)
93 
95 #define LIN_GET_MODE_SLEEP (1u)
96 
97 #define LIN_GET_MODE_RCV_ONLY (5u)
98 
99 #define LIN_GET_MODE_NORMAL (7u)
100 
102 #define LIN_SLOPE_NORMAL (0u)
103 
104 #define LIN_SLOPE_FAST (1u)
105 
106 #define LIN_SLOPE_LOW (2u)
107 
108 #define LIN_SLOPE_FLASH (3u)
109 
110 /*******************************************************************************
111 ** Global Inline Function Definitions **
112 *******************************************************************************/
133 {
135 }
136 
157 {
159 }
160 
178 {
179  return ( u1_Field_Rd8(&SCU->LINST.reg, (uint8)SCU_LINST_BRK_Pos, (uint8)SCU_LINST_BRK_Msk) );
180 }
181 
194 INLINE void LIN_Break_Detect_En(void)
195 {
197 }
198 
211 INLINE void LIN_Break_Detect_Dis(void)
212 {
214 }
215 
231 {
233 }
234 
252 INLINE void LIN_Over_Curr_Int_Clr(void)
253 {
255 }
256 
274 INLINE void LIN_Over_Temp_Int_Clr(void)
275 {
277 }
278 
296 INLINE void LIN_Time_Out_Int_Clr(void)
297 {
299 }
300 
319 {
321 }
322 
341 {
343 }
344 
357 INLINE void LIN_Break_Int_Clr(void)
358 {
360 }
361 
379 INLINE void LIN_Over_Curr_Int_En(void)
380 {
382 }
383 
402 INLINE void LIN_Over_Curr_Int_Dis(void)
403 {
405 }
406 
424 INLINE void LIN_Over_Temp_Int_En(void)
425 {
427 }
428 
447 INLINE void LIN_Over_Temp_Int_Dis(void)
448 {
450 }
451 
469 INLINE void LIN_Time_Out_Int_En(void)
470 {
472 }
473 
492 INLINE void LIN_Time_Out_Int_Dis(void)
493 {
495 }
496 
514 INLINE void LIN_Sync_Int_En(void)
515 {
517 }
518 
537 INLINE void LIN_Sync_Int_Dis(void)
538 {
540 }
541 
542 /*******************************************************************************
543 ** Global Function Declarations **
544 *******************************************************************************/
549 void LIN_Init(void);
550 
551 /*******************************************************************************
552 ** Global Inline Function Declarations **
553 *******************************************************************************/
554 INLINE void LIN_Set_Mode(uint8 Mode);
556 INLINE void LIN_Set_Slope(uint8 SlopeMode);
557 /*******************************************************************************
558 ** Global Inline Function Definitions **
559 *******************************************************************************/
574 INLINE void LIN_Set_Mode(uint8 Mode)
575 {
577 }
578 
579 
597 {
599 }
600 
615 INLINE void LIN_Set_Slope(uint8 SlopeMode)
616 {
618  Field_Mod32(&LIN->CTRL_STS.reg, LIN_CTRL_STS_SM_Pos, LIN_CTRL_STS_SM_Msk, SlopeMode);
620 }
621 #endif
SCU_LINST_BRDIS_Pos
#define SCU_LINST_BRDIS_Pos
Definition: tle986x.h:8945
LIN_Init
void LIN_Init(void)
Initializes the LIN module.
SCUPM_SYS_IRQ_CTRL_LIN_OT_IE_Pos
#define SCUPM_SYS_IRQ_CTRL_LIN_OT_IE_Pos
Definition: tle986x.h:9439
SCU_LINST_BRDIS_Msk
#define SCU_LINST_BRDIS_Msk
Definition: tle986x.h:8946
types.h
General type declarations.
SCU_LINST_SYNEN_Msk
#define SCU_LINST_SYNEN_Msk
Definition: tle986x.h:8956
LIN_End_Of_Sync_Int_Clr
INLINE void LIN_End_Of_Sync_Int_Clr(void)
clears End of SYN Byte interrupt flag.
Definition: lin.h:313
LIN_Sync_Int_Dis
INLINE void LIN_Sync_Int_Dis(void)
disables End of SYN Byte and SYN Byte Error interrupt.
Definition: lin.h:532
LIN_Break_Sts
INLINE uint8 LIN_Break_Sts(void)
reads Break Field Status.
Definition: lin.h:172
SCU_LINSCLR_ERRSYNC_Msk
#define SCU_LINSCLR_ERRSYNC_Msk
Definition: tle986x.h:8943
LIN_Sync_Int_En
INLINE void LIN_Sync_Int_En(void)
enables End of SYN Byte and SYN Byte Error interrupt.
Definition: lin.h:509
SCU_LINST_BGSEL_Pos
#define SCU_LINST_BGSEL_Pos
Definition: tle986x.h:8947
SCU_LINST_SYNEN_Pos
#define SCU_LINST_SYNEN_Pos
Definition: tle986x.h:8955
LIN_Err_In_Sync_Sts
INLINE uint8 LIN_Err_In_Sync_Sts(void)
reads SYN Byte Error Interrupt Status.
Definition: lin.h:151
sfr_access.h
SFR low level access library.
SCU_LINST_BRK_Pos
#define SCU_LINST_BRK_Pos
Definition: tle986x.h:8949
SCUPM
#define SCUPM
Definition: tle986x.h:6005
INLINE
#define INLINE
Definition: types.h:134
Field_Mod8
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:346
u1_Field_Rd8
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:391
Field_Mod32
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:356
SCUPM_SYS_ISCLR_LIN_TMOUT_ICLR_Pos
#define SCUPM_SYS_ISCLR_LIN_TMOUT_ICLR_Pos
Definition: tle986x.h:9499
SCU_LINSCLR_BRKC_Pos
#define SCU_LINSCLR_BRKC_Pos
Definition: tle986x.h:8938
SCUPM_SYS_ISCLR_LIN_TMOUT_ICLR_Msk
#define SCUPM_SYS_ISCLR_LIN_TMOUT_ICLR_Msk
Definition: tle986x.h:9500
u32_Field_Rd32
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:431
LIN_MODE_NORMAL
#define LIN_MODE_NORMAL
LIN MODE, NORMAL MODE.
Definition: lin.h:88
LIN_Over_Curr_Int_En
INLINE void LIN_Over_Curr_Int_En(void)
enables LIN Transceiver Overcurrent interrupt.
Definition: lin.h:374
LIN_Time_Out_Int_Dis
INLINE void LIN_Time_Out_Int_Dis(void)
disables LIN Transceiver TxD-Timeout interrupt.
Definition: lin.h:487
SCU_LINSCLR_EOFSYNC_Pos
#define SCU_LINSCLR_EOFSYNC_Pos
Definition: tle986x.h:8940
LIN_CTRL_STS_MODE_FB_Msk
#define LIN_CTRL_STS_MODE_FB_Msk
Definition: tle986x.h:8007
uint8
unsigned char uint8
8 bit unsigned value
Definition: types.h:139
SCUPM_SYS_IRQ_CTRL_LIN_TMOUT_IE_Pos
#define SCUPM_SYS_IRQ_CTRL_LIN_TMOUT_IE_Pos
Definition: tle986x.h:9437
Field_Wrt32
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:341
LIN_CTRL_STS_SM_Pos
#define LIN_CTRL_STS_SM_Pos
Definition: tle986x.h:8014
LIN_Break_Detect_Dis
INLINE void LIN_Break_Detect_Dis(void)
disables Baud Rate Detection.
Definition: lin.h:206
SCU_LINST_BGSEL_Msk
#define SCU_LINST_BGSEL_Msk
Definition: tle986x.h:8948
SCUPM_SYS_ISCLR_LIN_OC_ICLR_Msk
#define SCUPM_SYS_ISCLR_LIN_OC_ICLR_Msk
Definition: tle986x.h:9504
LIN_Over_Curr_Int_Dis
INLINE void LIN_Over_Curr_Int_Dis(void)
disables LIN Transceiver Overcurrent interrupt.
Definition: lin.h:397
uint32
unsigned int uint32
32 bit unsigned value
Definition: types.h:141
LIN_BaudRate_Range_Sel
INLINE void LIN_BaudRate_Range_Sel(uint8 a)
selects Baud Rate Detection.
Definition: lin.h:225
SCUPM_SYS_IRQ_CTRL_LIN_OT_IE_Msk
#define SCUPM_SYS_IRQ_CTRL_LIN_OT_IE_Msk
Definition: tle986x.h:9440
SCU_LINSCLR_ERRSYNC_Pos
#define SCU_LINSCLR_ERRSYNC_Pos
Definition: tle986x.h:8942
LIN_Time_Out_Int_En
INLINE void LIN_Time_Out_Int_En(void)
enables LIN Transceiver TxD-Timeout interrupt.
Definition: lin.h:464
SCU_LINST_EOFSYN_Pos
#define SCU_LINST_EOFSYN_Pos
Definition: tle986x.h:8951
LIN_CTRL_STS_MODE_Pos
#define LIN_CTRL_STS_MODE_Pos
Definition: tle986x.h:8028
LIN_Over_Temp_Int_Clr
INLINE void LIN_Over_Temp_Int_Clr(void)
clears LIN Receiver Overtemperature interrupt flag.
Definition: lin.h:269
LIN_Break_Int_Clr
INLINE void LIN_Break_Int_Clr(void)
clears Break Field flag.
Definition: lin.h:352
LIN_Over_Curr_Int_Clr
INLINE void LIN_Over_Curr_Int_Clr(void)
clears LIN Receiver Overcurrent interrupt flag.
Definition: lin.h:247
SCUPM_SYS_IRQ_CTRL_LIN_OC_IE_Msk
#define SCUPM_SYS_IRQ_CTRL_LIN_OC_IE_Msk
Definition: tle986x.h:9442
SCU_LINST_ERRSYN_Pos
#define SCU_LINST_ERRSYN_Pos
Definition: tle986x.h:8953
SCUPM_SYS_ISCLR_LIN_OT_ICLR_Msk
#define SCUPM_SYS_ISCLR_LIN_OT_ICLR_Msk
Definition: tle986x.h:9502
tle986x.h
CMSIS register HeaderFile.
SCU
#define SCU
Definition: tle986x.h:6004
LIN_CTRL_STS_MODE_Msk
#define LIN_CTRL_STS_MODE_Msk
Definition: tle986x.h:8029
SCUPM_SYS_ISCLR_LIN_OC_ICLR_Pos
#define SCUPM_SYS_ISCLR_LIN_OC_ICLR_Pos
Definition: tle986x.h:9503
LIN_Over_Temp_Int_En
INLINE void LIN_Over_Temp_Int_En(void)
enables LIN Transceiver Overtemperature interrupt.
Definition: lin.h:419
LIN_Set_Slope
INLINE void LIN_Set_Slope(uint8 SlopeMode)
Sets LIN Trx. Slope Mode.
Definition: lin.h:607
SCU_LINSCLR_EOFSYNC_Msk
#define SCU_LINSCLR_EOFSYNC_Msk
Definition: tle986x.h:8941
LIN_CTRL_STS_MODE_FB_Pos
#define LIN_CTRL_STS_MODE_FB_Pos
Definition: tle986x.h:8006
LIN_Set_Mode
INLINE void LIN_Set_Mode(uint8 Mode)
Sets LIN Trx. Mode.
Definition: lin.h:566
SCUPM_SYS_ISCLR_LIN_OT_ICLR_Pos
#define SCUPM_SYS_ISCLR_LIN_OT_ICLR_Pos
Definition: tle986x.h:9501
SCUPM_SYS_IRQ_CTRL_LIN_OC_IE_Pos
#define SCUPM_SYS_IRQ_CTRL_LIN_OC_IE_Pos
Definition: tle986x.h:9441
LIN_Over_Temp_Int_Dis
INLINE void LIN_Over_Temp_Int_Dis(void)
disables LIN Transceiver Overtemperature interrupt.
Definition: lin.h:442
LIN_Time_Out_Int_Clr
INLINE void LIN_Time_Out_Int_Clr(void)
clears LIN TXD time-out interrupt flag.
Definition: lin.h:291
SCU_LINST_EOFSYN_Msk
#define SCU_LINST_EOFSYN_Msk
Definition: tle986x.h:8952
LIN
#define LIN
Definition: tle986x.h:5999
LIN_Get_Mode
INLINE uint32 LIN_Get_Mode(void)
Gets LIN Trx. Mode.
Definition: lin.h:588
SCU_LINSCLR_BRKC_Msk
#define SCU_LINSCLR_BRKC_Msk
Definition: tle986x.h:8939
SCUPM_SYS_IRQ_CTRL_LIN_TMOUT_IE_Msk
#define SCUPM_SYS_IRQ_CTRL_LIN_TMOUT_IE_Msk
Definition: tle986x.h:9438
LIN_Err_In_Sync_Int_Clr
INLINE void LIN_Err_In_Sync_Int_Clr(void)
clears SYN Byte Error interrupt flag.
Definition: lin.h:335
LIN_MODE_SLEEP
#define LIN_MODE_SLEEP
LIN MODE, SLEEP MODE.
Definition: lin.h:84
Field_Wrt8
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:331
LIN_Break_Detect_En
INLINE void LIN_Break_Detect_En(void)
enables Baud Rate Detection.
Definition: lin.h:189
SCU_LINST_ERRSYN_Msk
#define SCU_LINST_ERRSYN_Msk
Definition: tle986x.h:8954
LIN_End_Of_Sync_Sts
INLINE uint8 LIN_End_Of_Sync_Sts(void)
reads End of SYN Byte Interrupt Status.
Definition: lin.h:127
LIN_CTRL_STS_SM_Msk
#define LIN_CTRL_STS_SM_Msk
Definition: tle986x.h:8015
SCU_LINST_BRK_Msk
#define SCU_LINST_BRK_Msk
Definition: tle986x.h:8950