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  * 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 ** BG Blandine Guillot **
44 ** JO Julia Ott **
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 **
70 ** Moved revision history from lin.c to lin.h **
71 ** V0.1.8: 2020-04-15, BG: Updated revision history format **
72 ** V0.1.9: 2020-07-21, BG: EP-439: Formatted .h/.c files **
73 ** V0.2.0: 2022-02-28, JO: EP-936: Updated copyright and branding **
74 *******************************************************************************/
75 
76 #ifndef LIN_H
77 #define LIN_H
78 
79 /*******************************************************************************
80 ** Includes **
81 *******************************************************************************/
82 #include "tle987x.h"
83 #include "types.h"
84 #include "sfr_access.h"
85 
86 /*******************************************************************************
87 ** Global Macro Definitions **
88 *******************************************************************************/
90 #define LIN_MODE_SLEEP (0u)
92 #define LIN_MODE_RCV_ONLY (1u)
94 #define LIN_MODE_NORMAL (3u)
95 
97 #define LIN_GET_MODE_SLEEP (1u)
99 #define LIN_GET_MODE_RCV_ONLY (5u)
101 #define LIN_GET_MODE_NORMAL (7u)
102 
104 #define LIN_SLOPE_NORMAL (0u)
106 #define LIN_SLOPE_FAST (1u)
108 #define LIN_SLOPE_LOW (2u)
110 #define LIN_SLOPE_FLASH (3u)
111 
112 /*******************************************************************************
113 ** Global Inline Function Definitions **
114 *******************************************************************************/
135 {
137 }
138 
159 {
161 }
162 
180 {
181  return ( u1_Field_Rd8(&SCU->LINST.reg, (uint8)SCU_LINST_BRK_Pos, (uint8)SCU_LINST_BRK_Msk) );
182 }
183 
197 {
199 }
200 
214 {
216 }
217 
233 {
235 }
236 
255 {
257 }
258 
277 {
279 }
280 
299 {
301 }
302 
321 {
323 }
324 
343 {
345 }
346 
360 {
362 }
363 
382 {
384 }
385 
405 {
407 }
408 
427 {
429 }
430 
450 {
452 }
453 
472 {
474 }
475 
495 {
497 }
498 
517 {
519 }
520 
540 {
542 }
543 
544 /*******************************************************************************
545 ** Global Function Declarations **
546 *******************************************************************************/
551 void LIN_Init(void);
552 
553 /*******************************************************************************
554 ** Global Inline Function Declarations **
555 *******************************************************************************/
556 INLINE void LIN_Set_Mode(uint8 Mode);
558 INLINE void LIN_Set_Slope(uint8 SlopeMode);
559 
560 /*******************************************************************************
561 ** Global Inline Function Definitions **
562 *******************************************************************************/
578 {
580 }
581 
582 
600 {
602 }
603 
618 INLINE void LIN_Set_Slope(uint8 SlopeMode)
619 {
621  Field_Mod32(&LIN->CTRL_STS.reg, LIN_CTRL_STS_SM_Pos, LIN_CTRL_STS_SM_Msk, SlopeMode);
623 }
624 
625 #endif
#define SCUPM
Definition: tle987x.h:6098
#define SCU
Definition: tle987x.h:6097
#define LIN
Definition: tle987x.h:6092
#define LIN_CTRL_STS_SM_Msk
Definition: tle987x.h:8146
#define SCU_LINSCLR_ERRSYNC_Pos
Definition: tle987x.h:9097
#define SCU_LINST_EOFSYN_Msk
Definition: tle987x.h:9107
#define LIN_CTRL_STS_MODE_Pos
Definition: tle987x.h:8159
#define SCU_LINSCLR_BRKC_Msk
Definition: tle987x.h:9094
#define SCU_LINSCLR_EOFSYNC_Msk
Definition: tle987x.h:9096
#define SCU_LINST_SYNEN_Msk
Definition: tle987x.h:9111
#define LIN_CTRL_STS_MODE_FB_Msk
Definition: tle987x.h:8138
#define SCUPM_SYS_ISCLR_LIN_OT_ICLR_Pos
Definition: tle987x.h:9740
#define SCU_LINST_BRK_Pos
Definition: tle987x.h:9104
#define SCUPM_SYS_IRQ_CTRL_LIN_OC_IE_Msk
Definition: tle987x.h:9633
#define SCU_LINST_ERRSYN_Msk
Definition: tle987x.h:9109
#define LIN_CTRL_STS_SM_Pos
Definition: tle987x.h:8145
#define SCUPM_SYS_IRQ_CTRL_LIN_TMOUT_IE_Msk
Definition: tle987x.h:9629
#define SCUPM_SYS_IRQ_CTRL_LIN_OT_IE_Pos
Definition: tle987x.h:9630
#define SCU_LINST_BRDIS_Pos
Definition: tle987x.h:9100
#define SCU_LINST_EOFSYN_Pos
Definition: tle987x.h:9106
#define SCU_LINST_BRDIS_Msk
Definition: tle987x.h:9101
#define SCU_LINSCLR_ERRSYNC_Msk
Definition: tle987x.h:9098
#define SCU_LINST_BGSEL_Pos
Definition: tle987x.h:9102
#define LIN_CTRL_STS_MODE_Msk
Definition: tle987x.h:8160
#define SCUPM_SYS_ISCLR_LIN_OC_ICLR_Pos
Definition: tle987x.h:9742
#define SCUPM_SYS_ISCLR_LIN_TMOUT_ICLR_Pos
Definition: tle987x.h:9738
#define SCU_LINST_SYNEN_Pos
Definition: tle987x.h:9110
#define SCUPM_SYS_ISCLR_LIN_OC_ICLR_Msk
Definition: tle987x.h:9743
#define SCUPM_SYS_IRQ_CTRL_LIN_TMOUT_IE_Pos
Definition: tle987x.h:9628
#define SCU_LINSCLR_BRKC_Pos
Definition: tle987x.h:9093
#define SCU_LINST_BGSEL_Msk
Definition: tle987x.h:9103
#define SCUPM_SYS_ISCLR_LIN_TMOUT_ICLR_Msk
Definition: tle987x.h:9739
#define SCUPM_SYS_IRQ_CTRL_LIN_OT_IE_Msk
Definition: tle987x.h:9631
#define SCU_LINST_ERRSYN_Pos
Definition: tle987x.h:9108
#define SCU_LINST_BRK_Msk
Definition: tle987x.h:9105
#define LIN_CTRL_STS_MODE_FB_Pos
Definition: tle987x.h:8137
#define SCUPM_SYS_ISCLR_LIN_OT_ICLR_Msk
Definition: tle987x.h:9741
#define SCUPM_SYS_IRQ_CTRL_LIN_OC_IE_Pos
Definition: tle987x.h:9632
#define SCU_LINSCLR_EOFSYNC_Pos
Definition: tle987x.h:9095
#define LIN_MODE_SLEEP
LIN MODE, SLEEP MODE.
Definition: lin.h:90
INLINE void LIN_Time_Out_Int_En(void)
enables LIN Transceiver TxD-Timeout interrupt.
Definition: lin.h:471
INLINE void LIN_Err_In_Sync_Int_Clr(void)
clears SYN Byte Error interrupt flag.
Definition: lin.h:342
INLINE uint8 LIN_Break_Sts(void)
reads Break Field Status.
Definition: lin.h:179
INLINE void LIN_End_Of_Sync_Int_Clr(void)
clears End of SYN Byte interrupt flag.
Definition: lin.h:320
INLINE void LIN_Sync_Int_Dis(void)
disables End of SYN Byte and SYN Byte Error interrupt.
Definition: lin.h:539
INLINE void LIN_Over_Temp_Int_Dis(void)
disables LIN Transceiver Overtemperature interrupt.
Definition: lin.h:449
INLINE void LIN_Over_Temp_Int_En(void)
enables LIN Transceiver Overtemperature interrupt.
Definition: lin.h:426
INLINE void LIN_BaudRate_Range_Sel(uint8 a)
selects Baud Rate Detection.
Definition: lin.h:232
INLINE uint8 LIN_Err_In_Sync_Sts(void)
reads SYN Byte Error Interrupt Status.
Definition: lin.h:158
INLINE void LIN_Set_Mode(uint8 Mode)
Sets LIN Trx. Mode.
Definition: lin.h:577
INLINE uint8 LIN_End_Of_Sync_Sts(void)
reads End of SYN Byte Interrupt Status.
Definition: lin.h:134
INLINE void LIN_Time_Out_Int_Clr(void)
clears LIN TXD time-out interrupt flag.
Definition: lin.h:298
INLINE void LIN_Break_Int_Clr(void)
clears Break Field flag.
Definition: lin.h:359
INLINE void LIN_Sync_Int_En(void)
enables End of SYN Byte and SYN Byte Error interrupt.
Definition: lin.h:516
#define LIN_MODE_NORMAL
LIN MODE, NORMAL MODE.
Definition: lin.h:94
INLINE void LIN_Set_Slope(uint8 SlopeMode)
Sets LIN Trx. Slope Mode.
Definition: lin.h:618
INLINE void LIN_Over_Curr_Int_Dis(void)
disables LIN Transceiver Overcurrent interrupt.
Definition: lin.h:404
INLINE void LIN_Break_Detect_En(void)
enables Baud Rate Detection.
Definition: lin.h:196
INLINE uint32 LIN_Get_Mode(void)
Gets LIN Trx. Mode.
Definition: lin.h:599
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:381
INLINE void LIN_Break_Detect_Dis(void)
disables Baud Rate Detection.
Definition: lin.h:213
INLINE void LIN_Time_Out_Int_Dis(void)
disables LIN Transceiver TxD-Timeout interrupt.
Definition: lin.h:494
INLINE void LIN_Over_Temp_Int_Clr(void)
clears LIN Receiver Overtemperature interrupt flag.
Definition: lin.h:276
INLINE void LIN_Over_Curr_Int_Clr(void)
clears LIN Receiver Overcurrent interrupt flag.
Definition: lin.h:254
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:337
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:362
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:347
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:397
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:437
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:352
CMSIS register HeaderFile.
General type declarations.
#define INLINE
Definition: types.h:148
uint8_t uint8
8 bit unsigned value
Definition: types.h:153
uint32_t uint32
32 bit unsigned value
Definition: types.h:155