1 /*
2  * Copyright 2020-2023 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /* Prevention from multiple including the same header */
8 #ifndef LCU_IP_TYPES_SOC_H_
9 #define LCU_IP_TYPES_SOC_H_
10 
11 #ifdef __cplusplus
12 extern "C"
13 {
14 #endif
15 
16 /**
17 *   @file    Lcu_Ip_Regs.h
18 *
19 *   @version 3.0.0
20 *
21 *   @brief   AUTOSAR Mcl - LCU IP driver header file.
22 *   @details
23 *
24 *   @addtogroup LCU_IP_DRIVER LCU IP Driver
25 *   @{
26 */
27 
28 #include "Lcu_Ip_Features.h"
29 
30 /*==================================================================================================
31                                SOURCE FILE VERSION INFORMATION
32 ==================================================================================================*/
33 #define LCU_IP_REGS_VENDOR_ID                       43
34 #define LCU_IP_REGS_AR_RELEASE_MAJOR_VERSION        4
35 #define LCU_IP_REGS_AR_RELEASE_MINOR_VERSION        7
36 #define LCU_IP_REGS_AR_RELEASE_REVISION_VERSION     0
37 #define LCU_IP_REGS_SW_MAJOR_VERSION                3
38 #define LCU_IP_REGS_SW_MINOR_VERSION                0
39 #define LCU_IP_REGS_SW_PATCH_VERSION                0
40 
41 /*==================================================================================================
42                                       FILE VERSION CHECKS
43 ==================================================================================================*/
44 /* Check if header file and Lcu_Ip_Features.h file are of the same vendor */
45 #if (LCU_IP_REGS_VENDOR_ID != LCU_IP_FEATURES_VENDOR_ID)
46     #error "Lcu_Ip_Regs.h and Lcu_Ip_Features.h have different vendor ids"
47 #endif
48 
49 /* Check if header file and Lcu_Ip_Features.h file are of the same Autosar version */
50 #if ((LCU_IP_REGS_AR_RELEASE_MAJOR_VERSION != LCU_IP_FEATURES_AR_RELEASE_MAJOR_VERSION) || \
51      (LCU_IP_REGS_AR_RELEASE_MINOR_VERSION != LCU_IP_FEATURES_AR_RELEASE_MINOR_VERSION) || \
52      (LCU_IP_REGS_AR_RELEASE_REVISION_VERSION != LCU_IP_FEATURES_AR_RELEASE_REVISION_VERSION) \
53     )
54     #error "AutoSar Version Numbers of Lcu_Ip_Regs.h and Lcu_Ip_Features.h are different"
55 #endif
56 
57 /* Check if header file and Lcu_Ip_Features.h file are of the same Software version */
58 #if ((LCU_IP_REGS_SW_MAJOR_VERSION != LCU_IP_FEATURES_SW_MAJOR_VERSION) || \
59      (LCU_IP_REGS_SW_MINOR_VERSION != LCU_IP_FEATURES_SW_MINOR_VERSION) || \
60      (LCU_IP_REGS_SW_PATCH_VERSION != LCU_IP_FEATURES_SW_PATCH_VERSION) \
61     )
62     #error "Software Version Numbers of Lcu_Ip_Regs.h and Lcu_Ip_Features.h are different"
63 #endif
64 
65 
66 /*==================================================================================================
67                                         LCU STRUCTURE
68 ==================================================================================================*/
69 
70 /*! @} */
71 
72 #define LCU_FCTRL_FORCE_SENSE_COMMON_MASK           (0xFU)
73 #define LCU_FCTRL_FORCE_MODE_COMMON_MASK            (0x30U)
74 #define LCU_FCTRL_SYNC_SEL_COMMON_MASK              (0xC0U)
75 
76 /*! @name FCTRL */
77 /*! @{ */
78 #define LCU_FCTRL_FORCE_SENSE_MASK(ID)              ((uint32_t)(LCU_FCTRL_FORCE_SENSE_COMMON_MASK) << ((uint32_t)(ID)*8U))
79 #define LCU_FCTRL_FORCE_SENSE_SHIFT(ID)             ((uint32_t)(ID)*8U)
80 #define LCU_FCTRL_FORCE_SENSE_WIDTH                 (4U)
81 #define LCU_FCTRL_FORCE_SENSE(ID,x)                 (((uint32_t)(((uint32_t)(x)) << (uint32_t)LCU_FCTRL_FORCE_SENSE_SHIFT(ID))) & (uint32_t)LCU_FCTRL_FORCE_SENSE_MASK(ID))
82 #define LCU_FCTRL_FORCE_MODE_MASK(ID)               ((uint32_t)(LCU_FCTRL_FORCE_MODE_COMMON_MASK) << ((uint32_t)(ID)*8U))
83 #define LCU_FCTRL_FORCE_MODE_SHIFT(ID)              (4U + ((uint32_t)(ID)*8U))
84 #define LCU_FCTRL_FORCE_MODE_WIDTH                  (2U)
85 #define LCU_FCTRL_FORCE_MODE(ID,x)                  (((uint32_t)(((uint32_t)(x)) << (uint32_t)LCU_FCTRL_FORCE_MODE_SHIFT(ID))) & (uint32_t)LCU_FCTRL_FORCE_MODE_MASK(ID))
86 #define LCU_FCTRL_SYNC_SEL_MASK(ID)                 ((uint32_t)(LCU_FCTRL_SYNC_SEL_COMMON_MASK) << ((uint32_t)(ID)*8U))
87 #define LCU_FCTRL_SYNC_SEL_SHIFT(ID)                (6U + ((uint32_t)(ID)*8U))
88 #define LCU_FCTRL_SYNC_SEL_WIDTH                    (2U)
89 #define LCU_FCTRL_SYNC_SEL(ID,x)                    (((uint32_t)(((uint32_t)(x)) << (uint32_t)LCU_FCTRL_SYNC_SEL_SHIFT(ID))) & (uint32_t)LCU_FCTRL_SYNC_SEL_MASK(ID))
90 
91 /* LCU mapping inputID to position in register */
92 #define LCU_IP_MAPPING_INPUT_TO_LC(HwLcInputId)         (uint8_t)((uint8_t)(HwLcInputId) / LCU_NUM_INPUT_PER_LC)
93 #define LCU_IP_MAPPING_OUTPUT_TO_LC(HwLcOutputId)       (uint8_t)((uint8_t)(HwLcOutputId) / LCU_NUM_OUTPUT_PER_LC)
94 /* LCU mapping outputID to position in register */
95 #define LCU_IP_MAPPING_INTPUT_ID_TO_HW_INPUT(HwLcInputId)              ((uint8_t)((uint8_t)(HwLcInputId) % LCU_NUM_INPUT_PER_LC))
96 #define LCU_IP_MAPPING_OUTPUT_ID_TO_HW_OUTPUT(HwLcOutputId)            ((uint8_t)((uint8_t)(HwLcOutputId) % LCU_NUM_OUTPUT_PER_LC))
97 /** @} */
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif  /* #ifndef LCU_IP_TYPES_SOC_H_ */
104 
105 /*==================================================================================================
106  *                                        END OF FILE
107 ==================================================================================================*/
108