MCUSW
Icu.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (C) 2024 Texas Instruments Incorporated
4 *
5 * All rights reserved not granted herein.
6 *
7 * Limited License.
8 *
9 * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10 * license under copyrights and patents it now or hereafter owns or controls to make,
11 * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12 * terms herein. With respect to the foregoing patent license, such license is granted
13 * solely to the extent that any such patent is necessary to Utilize the software alone.
14 * The patent license shall not apply to any combinations which include this software,
15 * other than combinations with devices manufactured by or for TI ("TI Devices").
16 * No hardware patent is licensed hereunder.
17 *
18 * Redistributions must preserve existing copyright notices and reproduce this license
19 * (including the above copyright notice and the disclaimer and (if applicable) source
20 * code license limitations below) in the documentation and/or other materials provided
21 * with the distribution
22 *
23 * Redistribution and use in binary form, without modification, are permitted provided
24 * that the following conditions are met:
25 *
26 * * No reverse engineering, decompilation, or disassembly of this software is
27 * permitted with respect to any software provided in binary form.
28 *
29 * * any redistribution and use are licensed by TI for use only with TI Devices.
30 *
31 * * Nothing shall obligate TI to provide you with source code for the software
32 * licensed and provided to you in object code.
33 *
34 * If software source code is provided to you, modification and redistribution of the
35 * source code are permitted provided that the following conditions are met:
36 *
37 * * any redistribution and use of the source code, including any resulting derivative
38 * works, are licensed by TI for use only with TI Devices.
39 *
40 * * any redistribution and use of any object code compiled from the source code
41 * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42 *
43 * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44 *
45 * may be used to endorse or promote products derived from this software without
46 * specific prior written permission.
47 *
48 * DISCLAIMER.
49 *
50 * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53 * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59 * OF THE POSSIBILITY OF SUCH DAMAGE.
60 *
61 */
62 
84  /*
85  * Below are the global requirements which are met by this PWM
86  * driver which can't be mapped to a particular source ID
87  */
88 /*
89 *Design: MCAL-7113,MCAL-7128,MCAL-7064,MCAL-7118,MCAL-6917,MCAL-6972,MCAL-7091,MCAL-6931,MCAL-7048,MCAL-6960
90 */
91 
92 /*
93  * Below are the PWM module's environment requirements which can't be mapped
94  * to this driver
95  */
96 /*
97 *Design: MCAL-7014,MCAL-7101,MCAL-6968,MCAL-7134,MCAL-7082,MCAL-7142,MCAL-7053,MCAL-7004,MCAL-7015,MCAL-7007,MCAL-6933,MCAL-7046,MCAL-6982,MCAL-7001,MCAL-7146,MCAL-6896,MCAL-7055,MCAL-7109,MCAL-7061,MCAL-6993,MCAL-7108,MCAL-7119,MCAL-6997,MCAL-7051,MCAL-6955,MCAL-7120,MCAL-6952,MCAL-7079
98 */
99 
100 #ifndef ICU_H_
101 #define ICU_H_
102 
103 /* ========================================================================== */
104 /* Include Files */
105 /* ========================================================================== */
106 /*
107 * Design: MCAL-7045,MCAL-7128,MCAL-7064,MCAL-7118,MCAL-6917,MCAL-6972,MCAL-7091,MCAL-6931,MCAL-7048,MCAL-6960
108 */
109 #include "Std_Types.h"
110 #include "Icu_Cfg.h"
111 #include "EcuM_Types.h"
112 
113 #ifdef __cplusplus
114 extern "C"
115 {
116 #endif
117 
118 /* ========================================================================== */
119 /* Macros & Typedefs */
120 /* ========================================================================== */
121 
127 #define ICU_VENDOR_ID ((uint16) 44U)
128 
129 #define ICU_MODULE_ID ((uint16) 122U)
130 
131 #define ICU_INSTANCE_ID ((uint8) 0U)
132 /* @} */
133 
141 #define ICU_SW_MAJOR_VERSION (9U)
142 
143 #define ICU_SW_MINOR_VERSION (0U)
144 
145 #define ICU_SW_PATCH_VERSION (1U)
146 /* @} */
147 
155 #define ICU_AR_RELEASE_MAJOR_VERSION (4U)
156 
157 #define ICU_AR_RELEASE_MINOR_VERSION (3U)
158 
159 #define ICU_AR_RELEASE_REVISION_VERSION (1U)
160 /* @} */
161 
170 #define ICU_INIT_ID ((uint8) 0x00U)
171 
172 #define ICU_DEINIT_ID ((uint8) 0x01U)
173 
174 #define ICU_SETMODE_ID ((uint8) 0x02U)
175 
176 #define ICU_SETACTIVATIONCONDITION_ID ((uint8) 0x05U)
177 
178 #define ICU_DISABLENOTIFICATION_ID ((uint8) 0x06U)
179 
180 #define ICU_ENABLENOTIFICATION_ID ((uint8) 0x07U)
181 
182 #define ICU_GETINPUTSTATE_ID ((uint8) 0x08U)
183 
184 #define ICU_STARTTIMESTAMP_ID ((uint8) 0x09U)
185 
186 #define ICU_STOPTIMESTAMP_ID ((uint8) 0x0AU)
187 
188 #define ICU_GETTIMESTAMPINDEX_ID ((uint8) 0x0BU)
189 
190 #define ICU_RESETEDGECOUNT_ID ((uint8) 0x0CU)
191 
192 #define ICU_ENABLEEDGECOUNT_ID ((uint8) 0x0DU)
193 
194 #define ICU_ENABLEEDGEDETECTION_ID ((uint8) 0x16U)
195 
196 #define ICU_DISABLEEDGEDETECTION_ID ((uint8) 0x17U)
197 
198 #define ICU_DISABLEEDGECOUNT_ID ((uint8) 0x0EU)
199 
200 #define ICU_GETEDGENUMBERS_ID ((uint8) 0x0FU)
201 
202 #define ICU_STARTSIGNALMEASUREMENT_ID ((uint8) 0x13U)
203 
204 #define ICU_STOPSIGNALMEASUREMENT_ID ((uint8) 0x14U)
205 
206 #define ICU_GETTIMEELAPSED_ID ((uint8) 0x10U)
207 
208 #define ICU_GETDUTYCYCLEVALUES_ID ((uint8) 0x11U)
209 
210 #define ICU_GETVERSIONINFO_ID ((uint8) 0x12U)
211 
212 #define ICU_SID_REGISTER_READBACK ((uint8) 0x18U)
213 /* @} */
214 
221 /*
222 *Design: MCAL-7045
223 */
225 #define ICU_E_PARAM_POINTER ((uint8) 0x0AU)
226 
230 #define ICU_E_PARAM_CHANNEL ((uint8) 0x0BU)
231 
232 #define ICU_E_PARAM_ACTIVATION ((uint8) 0x0CU)
233 
234 #define ICU_E_INIT_FAILED ((uint8) 0x0DU)
235 
236 #define ICU_E_PARAM_BUFFER_SIZE ((uint8) 0x0EU)
237 
238 #define ICU_E_PARAM_MODE ((uint8) 0x0FU)
239 
240 #define ICU_E_UNINIT ((uint8) 0x14U)
241 
242 #define ICU_E_NOT_STARTED ((uint8) 0x16U)
243 
244 #define ICU_E_BUSY_OPERATION ((uint8) 0x16U)
245 
246 #define ICU_E_ALREADY_INITIALIZED ((uint8) 0x17U)
247 
248 #define ICU_E_PARAM_NOTIFY_INTERVAL ((uint8) 0x18U)
249 
250 #define ICU_E_PARAM_VINFO ((uint8) 0x19U)
251 /* @} */
252 
259 /*
260 *Design: MCAL-7144
261 */
263 #define ICU_STATUS_UNINIT ((uint8)(0U))
264 
265 #define ICU_STATUS_INIT ((uint8)(1U))
266 /* @} */
267 
273 #define ICU_FALLING ((uint8)(0U))
274 
275 #define ICU_RISING ((uint8)(1U))
276 
277 /* ========================================================================== */
278 /* Structures and Enums */
279 /* ========================================================================== */
280 
289 typedef enum
290 {
295 } Icu_ModeType;
296 
300 typedef enum
301 {
307 
308 
312 typedef enum
313 {
321 
325 typedef uint32 Icu_ValueType;
326 
330 typedef struct
331 {
337 
341 typedef uint32 Icu_IndexType;
342 
346 typedef uint32 Icu_EdgeNumberType;
347 
351 typedef enum
352 {
362 
366 typedef enum
367 {
377 
381 typedef enum
382 {
388 
390 typedef void (*Icu_NotifyFuncType)(void);
391 
395 typedef uint8 Icu_ChannelType;
396 
401 
405 typedef struct
406 {
410 
414 typedef struct Icu_ConfigType_PC_s
415 {
419 
423 typedef struct {
436  uint32 prescaler;
439 
443 typedef struct Icu_ConfigType_s
444 {
450 
451 #if (STD_ON == ICU_SAFETY_DIAGNOSTIC_API)
452 
456 typedef struct
457 {
458  /*
459  * ECAP related registers
460  */
461  uint32 ECAP_CNTPHS;
462  uint32 ECAP_ECCTL;
464 
466 #endif /* #if (STD_ON == ICU_REGISTER_READBACK_API) */
467 /* @} */
468 
469 
470 
471 /* ========================================================================== */
472 /* Function Declarations */
473 /* ========================================================================== */
474 
475 
494 FUNC(void, ICU_CODE) Icu_Init(
495  P2CONST(Icu_ConfigType, AUTOMATIC, ICU_PBCFG) ConfigPtr);
496 
497 
498 
499 #if (STD_ON == ICU_DE_INIT_API)
500 
516 FUNC(void, ICU_CODE) Icu_DeInit( void );
517 #endif
518 
539 FUNC(void, ICU_CODE) Icu_SetActivationCondition( Icu_ChannelType Channel, Icu_ActivationType Activation );
540 
557 FUNC(void, ICU_CODE) Icu_DisableNotification( Icu_ChannelType Channel );
558 
575 FUNC(void, ICU_CODE) Icu_EnableNotification( Icu_ChannelType Channel );
576 
577 
578 #if (ICU_GET_INPUT_STATE_API == STD_ON)
579 
595 FUNC(Icu_InputStateType, ICU_CODE) Icu_GetInputState( Icu_ChannelType Channel );
596 #endif
597 
598 #if (ICU_TIMESTAMP_API == STD_ON)
599 
620 FUNC(void, ICU_CODE) Icu_StartTimestamp( Icu_ChannelType Channel, Icu_ValueType* BufferPtr, uint16 BufferSize, uint16 NotifyInterval );
621 
638 FUNC(void, ICU_CODE) Icu_StopTimestamp( Icu_ChannelType Channel );
639 
656 FUNC(Icu_IndexType, ICU_CODE) Icu_GetTimestampIndex( Icu_ChannelType Channel );
657 #endif
658 
659 #if (ICU_EDGE_COUNT_API == STD_ON)
660 
676 FUNC(void, ICU_CODE) Icu_ResetEdgeCount( Icu_ChannelType Channel );
677 
694 FUNC(void, ICU_CODE) Icu_EnableEdgeCount( Icu_ChannelType Channel );
695 
712 FUNC(void, ICU_CODE) Icu_DisableEdgeCount( Icu_ChannelType Channel );
713 
730 FUNC(Icu_EdgeNumberType, ICU_CODE) Icu_GetEdgeNumbers( Icu_ChannelType Channel );
731 #endif
732 
733 #if (ICU_EDGE_DETECT_API == STD_ON)
734 
750 FUNC(void, ICU_CODE) Icu_EnableEdgeDetection( Icu_ChannelType Channel );
751 
768 FUNC(void, ICU_CODE) Icu_DisableEdgeDetection( Icu_ChannelType Channel );
769 #endif
770 
771 #if (ICU_SIGNAL_MEASUREMENT_API == STD_ON)
772 
788 FUNC(void, ICU_CODE) Icu_StartSignalMeasurement( Icu_ChannelType Channel );
789 
806 FUNC(void, ICU_CODE) Icu_StopSignalMeasurement( Icu_ChannelType Channel );
807 #endif
808 
809 #if (ICU_GET_TIME_ELAPSED_API == STD_ON)
810 
826 FUNC (Icu_ValueType, ICU_CODE) Icu_GetTimeElapsed( Icu_ChannelType Channel );
827 #endif
828 
829 #if (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON)
830 
847 FUNC (void, ICU_CODE) Icu_GetDutyCycleValues( Icu_ChannelType Channel,
848  Icu_DutyCycleType* DutyCycleValues );
849 #endif
850 
851 #if (ICU_GET_VERSION_INFO_API)
852 
870 FUNC(void, ICU_CODE) Icu_GetVersionInfo(
871  P2VAR(Std_VersionInfoType, AUTOMATIC, sICU_APPL_DATA) VersionInfoPtr);
872 
873 #endif
874 
875 #if (ICU_WAKEUP_FUNCTIONALITY_API == STD_ON)
876 
897 FUNC(void, ICU_CODE) Icu_CheckWakeup(EcuM_WakeupSourceType WakeupSource);
898 #endif /* if(ICU_WAKEUP_FUNCTIONALITY_API == STD_ON) */
899 
900 #if (ICU_DISABLEWAKEUP_API == STD_ON)
901 
918 FUNC(void, ICU_CODE) Icu_DisableWakeup(Icu_ChannelType Channel);
919 #endif /* if(ICU_DISABLEWAKEUP_API == STD_ON) */
920 
921 #if (ICU_ENABLEWAKEUP_API == STD_ON)
922 
939 FUNC(void, ICU_CODE) Icu_EnableWakeup(Icu_ChannelType Channel);
940 #endif /* if(ICU_ENABLEWAKEUP_API == STD_ON) */
941 
942 #if (ICU_SETMODE_API == STD_ON)
943 
963 FUNC(void, ICU_CODE) Icu_SetMode(Icu_ModeType Mode);
964 #endif /* if (ICU_SETMODE_API == STD_ON) */
965 
966 #if (STD_ON == ICU_SAFETY_DIAGNOSTIC_API)
967 FUNC(Std_ReturnType, ICU_CODE) Icu_RegisterReadback(
968  Icu_ChannelType IcuChannel,
969  P2VAR(Icu_RegisterReadbackType, AUTOMATIC, ICU_APPL_DATA) RegRbPtr);
970 #endif
971 
972 FUNC(Icu_IndexType, ICU_CODE) Icu_GetTimeStampIndex(Icu_ChannelType Channel);
973 
974 
975 #ifdef __cplusplus
976 }
977 #endif
978 /* @} */
979 
980 #endif /* ICU_H_ */
981 
982 /* @} */
uint32 instanceClkMHz
Definition: Icu.h:434
Icu_TimestampBufferType bufferType
Definition: Icu.h:432
Definition: Icu.h:302
uint32 ECAP_CNTPHS
Definition: Icu.h:461
Icu_TimestampBufferType
This type defines TimeStamp Property range.
Definition: Icu.h:381
Definition: Icu.h:370
void Icu_StartSignalMeasurement(Icu_ChannelType Channel)
Service for starting the measurement of signals.
#define ICU_MAX_NUM_CHANNELS
Definition: Icu_Cfg.h:166
Definition: Icu.h:374
This type defines Duty Cycle struct.
Definition: Icu.h:330
Definition: Icu.h:359
Definition: Icu.h:355
uint32 ECAP_ECCTL
Definition: Icu.h:462
Definition: Icu.h:385
Icu_ModeType
This type defines a range of mode type.
Definition: Icu.h:289
void Icu_Init(const Icu_ConfigType *ConfigPtr)
Service for ICU initialization.
Icu_InputStateType Icu_GetInputState(Icu_ChannelType Channel)
Service for getting the ICU input status.
void Icu_StopSignalMeasurement(Icu_ChannelType Channel)
Service for stopping the measurement of signals.
ICU Channel Config Structure of Pre-Compile only.
Definition: Icu.h:405
Icu_ActivationType defaultStartEdge
Definition: Icu.h:424
uint32 Icu_EdgeNumberType
This type defines return value of Icu-Icu_GetEdgeNumbers.
Definition: Icu.h:346
Definition: Icu.h:368
Definition: Icu.h:383
Icu_EdgeNumberType Icu_GetEdgeNumbers(Icu_ChannelType Channel)
Service for reading the number of counted edges.
Icu_ChannelType channelId
Definition: Icu.h:407
ICU Channel Config Structure.
Definition: Icu.h:423
void Icu_CheckWakeup(EcuM_WakeupSourceType WakeupSource)
This function checks if a wakeup capable ICU channel is the source for a wakeup event and calls the E...
void Icu_DisableNotification(Icu_ChannelType Channel)
Service for disabling notification.
uint32 Icu_ValueType
This type defines Value type.
Definition: Icu.h:325
Definition: Icu.h:304
This file contains generated pre compile configuration file for ICU MCAL driver.
uint32 ECAP_ECINT_EN_FLG
Definition: Icu.h:463
Definition: Icu.h:318
Icu_ChannelType icuMaxChannel
Definition: Icu.h:445
Icu_NotifyFuncType notificationHandler
Definition: Icu.h:430
void Icu_DisableEdgeCount(Icu_ChannelType Channel)
Service for disabling the couting of edges of the given channel.
Icu_ValueType PeriodTime
Definition: Icu.h:334
void Icu_DisableWakeup(Icu_ChannelType Channel)
This function disables the wakeup capability of a single ICU channel.
ICU Config Structure.
Definition: Icu.h:443
void Icu_EnableNotification(Icu_ChannelType Channel)
Service for enabling notification.
uint32 prescaler
Definition: Icu.h:436
Icu_ValueType ActiveTime
Definition: Icu.h:332
void Icu_ResetEdgeCount(Icu_ChannelType Channel)
Service for resets the value of the counted edges to zero.
Icu_SignalMeasurementPropertyType signalMeasurementProperty
Definition: Icu.h:428
void(* Icu_NotifyFuncType)(void)
Notification callback function pointer.
Definition: Icu.h:390
Definition: Icu.h:372
Icu_InputStateType
This type defines a input state of ICU driver.
Definition: Icu.h:300
Icu_ValueType Icu_GetTimeElapsed(Icu_ChannelType Channel)
Service for reading the elasped time for the given channel.
Definition: Icu.h:291
uint32 Icu_ChannelPrescalerType
This type defines Prescaler type.
Definition: Icu.h:400
Icu_IndexType Icu_GetTimeStampIndex(Icu_ChannelType Channel)
void Icu_StartTimestamp(Icu_ChannelType Channel, Icu_ValueType *BufferPtr, uint16 BufferSize, uint16 NotifyInterval)
Service for starts the captuing of timer values on the edges.
ICU Config Structure of Pre-Compile only.
Definition: Icu.h:414
Icu_IndexType Icu_GetTimestampIndex(Icu_ChannelType Channel)
Service for reading the timestamp index of a givem channel.
Icu_ActivationType
This type defines Activation range.
Definition: Icu.h:312
Std_ReturnType Icu_RegisterReadback(Icu_ChannelType IcuChannel, Icu_RegisterReadbackType *RegRbPtr)
Definition: Icu.h:353
void Icu_EnableWakeup(Icu_ChannelType Channel)
This function (re-)enables the wakeup capability of the given ICU channel.
void Icu_SetMode(Icu_ModeType Mode)
This function sets the ICU mode.
Definition: Icu.h:293
Icu register readback structure.
Definition: Icu.h:456
void Icu_DeInit(void)
Service for ICU de-initialization.
uint8 Icu_ChannelType
This type defines Channel type.
Definition: Icu.h:395
void Icu_EnableEdgeDetection(Icu_ChannelType Channel)
Service for enabling/re-enabling the detection of edges of the given channel.
Definition: Icu.h:316
uint32 Icu_IndexType
This type defines return value Icu_GetTimeStampIndex.
Definition: Icu.h:341
void Icu_DisableEdgeDetection(Icu_ChannelType Channel)
Service for disabling the detection of edges of the given channel.
Icu_MeasurementModeType measurementMode
Definition: Icu.h:426
Definition: Icu.h:357
Icu_MeasurementModeType
This type defines available measurement modes.
Definition: Icu.h:351
Icu_SignalMeasurementPropertyType
This type defines Signal Measurement Property range.
Definition: Icu.h:366
void Icu_SetActivationCondition(Icu_ChannelType Channel, Icu_ActivationType Activation)
Service for setting Activation Condition.
Definition: Icu.h:314
void Icu_GetDutyCycleValues(Icu_ChannelType Channel, Icu_DutyCycleType *DutyCycleValues)
Service for reading the coherent active time and period time of given channel.
void Icu_StopTimestamp(Icu_ChannelType Channel)
Service for stopping the timestamp measurement.
void Icu_EnableEdgeCount(Icu_ChannelType Channel)
Service enabling the counting of edges of a given channel.