/*!
* @file     Icu_Irq.h
*
* @version  1.0.0
*
* @brief    Header file of Icu interrupt driver
*
* @attention
*
* Project Name      : AUTOSAR MCAL
*
* Platform          : Arm
*
* Autosar Standard  : Classic Platform 4.4.0
*
* Compiled Version  : G32A10xx_MCAL_1_0_0_01-Otc-25
*
* Copyright (C) 2026 Geehy Semiconductor
*
* You may not use this file except in compliance with the
* GEEHY COPYRIGHT NOTICE (Geehy Semiconductor Software License Agreement).
*
* The program is only for reference, which is distributed in the hope
* that it will be usefull and instructional for customers to develop
* their software. Unless required by applicable law or agreed to in
* writing, the program is distributed on an "AS IS" BASIS, WITHOUT
* ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
* See the Geehy Semiconductor Software License Agreement for the governing permissions
* and limitations under the License.
*/

#ifndef ICU_IRQ_H
#define ICU_IRQ_H

#ifdef __cplusplus
extern "C"{
#endif

/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup ICU_Driver
  * @brief ICU driver modules
  @{
*/

/** @defgroup ICU_Macros
  @{
*/
/**************************************************************************
                  VENDOR ID & AUTOSAR VERSION INFO
**************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define ICU_IRQ_H_VENDOR_ID                       0x00C1U
/** Module ID of this module, as defined in the BSW Module List. */
#define ICU_IRQ_H_MODULE_ID                       0x007AU
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define ICU_IRQ_H_AR_RELEASE_MAJOR_VERSION        0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define ICU_IRQ_H_AR_RELEASE_MINOR_VERSION        0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define ICU_IRQ_H_AR_RELEASE_REVISION_VERSION     0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define ICU_IRQ_H_SW_MAJOR_VERSION                0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define ICU_IRQ_H_SW_MINOR_VERSION                0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define ICU_IRQ_H_SW_PATCH_VERSION                0x00U

/**@} end of group ICU_Macros */

/**************************************************************************
                    FUNCTION DECLARATION
**************************************************************************/
#define ICU_START_SEC_CODE
#include "Icu_MemMap.h"

/** @defgroup ICU_Fuctions
  @{
*/

FUNC(void, ICU_CODE) Icu_PrepareCallNotification(VAR(Icu_ChannelType, AUTOMATIC) HWCh, VAR(boolean, AUTOMATIC) ovfFlag);

FUNC(void, ICU_CODE) Icu_CallWakeupAndOverflowNotification
                     (VAR(Icu_ChannelType, AUTOMATIC) HWCh, VAR(boolean, AUTOMATIC) ovfFlag);

#if (STD_ON == ICU_TIMESTAMP_API_ENABLE)
FUNC(void,ICU_CODE)  Icu_DealWithTimestamp(VAR(Icu_ChannelType, AUTOMATIC)HWCh, VAR(uint8, AUTOMATIC)captureCnt,
                     P2CONST(Icu_ValueType, AUTOMATIC, ICU_APPL_CONST) bufferAddrPtr, VAR(boolean, AUTOMATIC) ovfFlag);
#endif

#if (STD_ON == ICU_TIMESTAMP_USES_DMA_ENABLE)
FUNC(void,ICU_CODE) Icu_DealWithTimestampWithDma(VAR(Icu_ChannelType, AUTOMATIC) ch);
#endif

#if (STD_ON == ICU_SIGNAL_MEASUREMENT_API_ENABLE)
FUNC(void,ICU_CODE) Icu_DealWithSignalMeasurement(VAR(Icu_ChannelType, AUTOMATIC) HWCh,
                    VAR(Icu_ValueType, AUTOMATIC) activeLevelCount, VAR(Icu_ValueType, AUTOMATIC) periodCount,
                    VAR(boolean, AUTOMATIC) ovfFlag);
#endif

/**@} end of group ICU_Fuctions */

/**************************************************************************
                    MACRO DEFINITION
**************************************************************************/
/** @defgroup ICU_Macros
  @{
*/

#if (STD_ON == ICU_SIGNAL_MEASUREMENT_API_ENABLE)
#define Icu_Ipw_SignalMeasurement(ch, activePulseWidth, period, ovfFlag) \
        do { Icu_DealWithSignalMeasurement((Icu_ChannelType)(ch), (activePulseWidth), (period), (ovfFlag));} while(0)
#endif

#if (STD_ON == ICU_TIMESTAMP_API_ENABLE)
#define Icu_Ipw_Timestamp(ch,capturedWords,bufferPtr,ovfFlag) \
        do { Icu_DealWithTimestamp((Icu_ChannelType)(ch),(capturedWords),(bufferPtr),(ovfFlag));} while(0)
#endif

#define Icu_Ipw_ReportWakeupAndOverflow(ch, ovfFlag) \
        do { Icu_CallWakeupAndOverflowNotification((Icu_ChannelType)(ch), (ovfFlag));} while(0)

#define Icu_Ipw_ReportEvents(ch, ovfFlag) \
        do { Icu_PrepareCallNotification((Icu_ChannelType)(ch), (ovfFlag));} while(0)

/**@} end of group ICU_Macros */

#define ICU_STOP_SEC_CODE
#include "Icu_MemMap.h"

#ifdef __cplusplus
}
#endif

#endif

/**@} end of group ICU_Driver */
/**@} end of group G32A10xx_StdPeriphDriver */
