/*!
* @file     CDD_Pdl.h
*
* @version  1.0.0
*
* @brief    The header of Pdl driver.
*           This header file includes the API specification and other variables of the PDL 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 CDD_PDL_H
#define CDD_PDL_H

#ifdef __cplusplus
extern "C"
{
#endif  /* ifdef __cplusplus */

#include "Std_Types.h"
#include "CDD_Pdl_Cfg.h"
#include "Pdl_Types.h"
#include "Pdl_Dma.h"
/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup PDL_Driver
  * @brief PDL driver modules
  @{
*/

/** @defgroup PDL_Macros
  @{
*/
/***********************************************************************************************************************
                                    VENDOR ID & AUTOSAR VERSION INFO
***********************************************************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define CDD_PDL_H_VENDOR_ID                                0x00C1U
/** Module ID of this module, as defined in the BSW Module List. */
#define CDD_PDL_H_MODULE_ID                                0x00FFU
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */ 
#define CDD_PDL_H_AR_RELEASE_MAJOR_VERSION                 0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CDD_PDL_H_AR_RELEASE_MINOR_VERSION                 0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CDD_PDL_H_AR_RELEASE_REVISION_VERSION              0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CDD_PDL_H_SW_MAJOR_VERSION                         0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CDD_PDL_H_SW_MINOR_VERSION                         0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CDD_PDL_H_SW_PATCH_VERSION                         0x00U

/**********************************************************************************************************************
                                  VERSION INFOMATION VERIFICATION
***********************************************************************************************************************/
/* Make sure the AUTOSAR version numbers are the same between CDD_Pdl.h and Std_Types.h */
#ifdef ENABLE_INTERMODULE_MCAL_CHECK
    /* Make sure the AUTOSAR major version number is the same between CDD_Pdl.h and Std_Types.h */
    #if (CDD_PDL_H_AR_RELEASE_MAJOR_VERSION != STD_TYPES_H_AR_RELEASE_MAJOR_VERSION)
        #error "AUTOSAR Major Version Number mismatch between CDD_Pdl.h and Std_Types.h"
    #endif
    /* Make sure the AUTOSAR minor version number is the same between CDD_Pdl.h and Std_Types.h */
    #if (CDD_PDL_H_AR_RELEASE_MINOR_VERSION != STD_TYPES_H_AR_RELEASE_MINOR_VERSION)
        #error "AUTOSAR Minor Version Number mismatch between CDD_Pdl.h and Std_Types.h"
    #endif
#endif  

/* Make sure the vendor ids are the same between CDD_Pdl.h and CDD_Pdl_Cfg.h */
#if (CDD_PDL_H_VENDOR_ID != PDL_CFG_H_VENDOR_ID)
    #error "Vendor ids mismatch between CDD_Pdl.h and CDD_Pdl_Cfg.h"
#endif  /* {if (CDD_PDL_H_VENDOR_ID != PDL_CFG_H_VENDOR_ID)} */

/* Make sure the AUTOSAR major version number is the same between CDD_Pdl.h and CDD_Pdl_Cfg.h */
#if (CDD_PDL_H_AR_RELEASE_MAJOR_VERSION != PDL_CFG_H_AR_RELEASE_MAJOR_VERSION)
    #error "AUTOSAR Major Version Number mismatch between CDD_Pdl.h and CDD_Pdl_Cfg.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between CDD_Pdl.h and CDD_Pdl_Cfg.h */
#if (CDD_PDL_H_AR_RELEASE_MINOR_VERSION != PDL_CFG_H_AR_RELEASE_MINOR_VERSION)
    #error "AUTOSAR Minor Version Number mismatch between CDD_Pdl.h and CDD_Pdl_Cfg.h"
#endif
/* Make sure the AUTOSAR revision version number is the same between CDD_Pdl.h and CDD_Pdl_Cfg.h */
#if (CDD_PDL_H_AR_RELEASE_REVISION_VERSION != PDL_CFG_H_AR_RELEASE_REVISION_VERSION)
    #error "AUTOSAR Revision Version Number mismatch between CDD_Pdl.h and CDD_Pdl_Cfg.h"
#endif

/* Make sure the software major version number is the same between CDD_Pdl.h and CDD_Pdl_Cfg.h */
#if (CDD_PDL_H_SW_MAJOR_VERSION != PDL_CFG_H_SW_MAJOR_VERSION)
    #error "Software Major Version Number mismatch between CDD_Pdl.h and CDD_Pdl_Cfg.h"
#endif
/* Make sure the software minor version number is the same between CDD_Pdl.h and CDD_Pdl_Cfg.h */
#if (CDD_PDL_H_SW_MINOR_VERSION != PDL_CFG_H_SW_MINOR_VERSION)
    #error "Software Minor Version Number mismatch between CDD_Pdl.h and CDD_Pdl_Cfg.h"
#endif
/* Make sure the software patch version number is the same between CDD_Pdl.h and CDD_Pdl_Cfg.h */
#if (CDD_PDL_H_SW_PATCH_VERSION != PDL_CFG_H_SW_PATCH_VERSION)
    #error "Software Patch Version Number mismatch between CDD_Pdl.h and CDD_Pdl_Cfg.h"
#endif

/* Make sure the vendor ids are the same between CDD_Pdl.h and Pdl_Types.h */
#if (CDD_PDL_H_VENDOR_ID != PDL_TYPES_H_VENDOR_ID)
    #error "Vendor ids mismatch between CDD_Pdl.h and Pdl_Types.h"
#endif  /* {if (CDD_PDL_H_VENDOR_ID != PDL_TYPES_H_VENDOR_ID)} */
 
/* Make sure the AUTOSAR major version number is the same between CDD_Pdl.h and Pdl_Types.h */
#if (CDD_PDL_H_AR_RELEASE_MAJOR_VERSION != PDL_TYPES_H_AR_RELEASE_MAJOR_VERSION)
    #error "AUTOSAR Major Version Number mismatch between CDD_Pdl.h and Pdl_Types.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between CDD_Pdl.h and Pdl_Types.h */
#if (CDD_PDL_H_AR_RELEASE_MINOR_VERSION != PDL_TYPES_H_AR_RELEASE_MINOR_VERSION)
    #error "AUTOSAR Minor Version Number mismatch between CDD_Pdl.h and Pdl_Types.h"
#endif
/* Make sure the AUTOSAR revision version number is the same between CDD_Pdl.h and Pdl_Types.h */
#if (CDD_PDL_H_AR_RELEASE_REVISION_VERSION != PDL_TYPES_H_AR_RELEASE_REVISION_VERSION)
    #error "AUTOSAR Revision Version Number mismatch between CDD_Pdl.h and Pdl_Types.h"
#endif

/* Make sure the software major version number is the same between CDD_Pdl.h and Pdl_Types.h */
#if (CDD_PDL_H_SW_MAJOR_VERSION != PDL_TYPES_H_SW_MAJOR_VERSION)
    #error "Software Major Version Number mismatch between CDD_Pdl.h and Pdl_Types.h"
#endif
/* Make sure the software minor version number is the same between CDD_Pdl.h and Pdl_Types.h */
#if (CDD_PDL_H_SW_MINOR_VERSION != PDL_TYPES_H_SW_MINOR_VERSION)
    #error "Software Minor Version Number mismatch between CDD_Pdl.h and Pdl_Types.h"
#endif
/* Make sure the software patch version number is the same between CDD_Pdl.h and Pdl_Types.h */
#if (CDD_PDL_H_SW_PATCH_VERSION != PDL_TYPES_H_SW_PATCH_VERSION)
    #error "Software Patch Version Number mismatch between CDD_Pdl.h and Pdl_Types.h"
#endif

/**********************************************************************************************************************
                                            MACRO DEFINITION
***********************************************************************************************************************/
#if(STD_ON == CDD_PDL_DEV_ERR_DETECT_ENABLE)
/** This macro is used to end the validation of the global call */
#define PDL_END_VALIDATE_GLOBAL_CALL()
/** This macro is used to end the execution of a API impacting the configuration of a driver channel. */
#define PDL_END_VALIDATE_CH_CONFIG_CALL(ChannelId)
#endif  /* {if(STD_ON == CDD_PDL_DEV_ERR_DETECT_ENABLE)} */

#if (STD_ON == CDD_PDL_DMA_SUPPORT)
#if (STD_ON == CDD_PDL_DMA_NOTIFICATION_ENABLE)
#define PDL_DMA_CH_NOTIFI(Ch) (Pdl_NotifiCallbackFunc(Ch))
#endif /* {if (STD_ON == CDD_PDL_DMA_NOTIFICATION_ENABLE)} */

#if (STD_ON == CDD_PDL_DMA_ERR_NOTIFICATION_SUPPORT)
#define Pdl_HW_ERR_NOTIFI(DmaCh, Error) (Pdl_ErrNotifiCallbackFunc(DmaCh))

#endif /* {if (STD_ON == CDD_PDL_DMA_ERR_NOTIFICATION_SUPPORT)} */
#endif /* {if (STD_ON == CDD_PDL_DMA_SUPPORT)} */
/**@} end of group PDL_Macros */
/**********************************************************************************************************************
                                             GLOBAL VARIABLE
***********************************************************************************************************************/
/** @defgroup PDL_Variable
  @{
*/
#if (STD_ON == CDD_PDL_DMA_SUPPORT)
#if (STD_OFF == CDD_PDL_DEM_ERR_REP_DISABLE)

#define PDL_START_SEC_VAR_INIT_UNSPECIFIED
#include "Pdl_MemMap.h"

extern P2CONST( Pdl_DemConfigType, PDL_VAR, PDL_APPL_CONST) g_pdlDemConfigPtr;

#define PDL_STOP_SEC_VAR_INIT_UNSPECIFIED
#include "Pdl_MemMap.h"

#endif  /* {if (STD_OFF == CDD_PDL_DEM_ERR_REP_DISABLE)} */
#endif  /* {if (STD_ON == CDD_PDL_DMA_SUPPORT)} */

#define PDL_START_SEC_CONFIG_DATA_UNSPECIFIED
#include "Pdl_MemMap.h"

PDL_CONFIGURATION_POSTBUILD

#define PDL_STOP_SEC_CONFIG_DATA_UNSPECIFIED
#include "Pdl_MemMap.h"
    
#define PDL_START_SEC_VAR_INIT_UNSPECIFIED
#include "Pdl_MemMap.h"

extern P2CONST(Pdl_ConfigType, PDL_VAR,  PDL_APPL_CONST)  g_pdlConfigPtr;

#define PDL_STOP_SEC_VAR_INIT_UNSPECIFIED
#include "Pdl_MemMap.h"
/**@} end of group PDL_Variable */

/**********************************************************************************************************************
                                              FUNCTION DECLARATION
***********************************************************************************************************************/
/** @defgroup PDL_Fuctions
  @{
*/
#define PDL_START_SEC_CODE
#include "Pdl_MemMap.h"

FUNC(void, PDL_CODE) Pdl_Init(P2CONST( Pdl_ConfigType, AUTOMATIC, PDL_APPL_CONST) PdlConfigPtr);

#if (STD_ON == CDD_PDL_DMA_SUPPORT)
FUNC(void, PDL_CODE) Pdl_TopDmaChConfig(VAR(Pdl_ChType, AUTOMATIC) PdlDmaChannel,
                   P2CONST(Pdl_DmaChHwConfigType, AUTOMATIC, PDL_APPL_DATA) DmaChHwConfigPtr);

FUNC(void, PDL_CODE) Pdl_TopDmaChEn(VAR(Pdl_ChType, AUTOMATIC) ChannelId);

FUNC(void, PDL_CODE) Pdl_TopDmaChDis(VAR(Pdl_ChType, AUTOMATIC) ChannelId);

FUNC(Pdl_DmaChErrStsType, PDL_CODE) Pdl_TopDmaChErrStsGet(VAR(Pdl_ChType, AUTOMATIC) PdlDmaChannel);

FUNC(void, PDL_CODE) Pdl_TopDmaChPrioSet(VAR(Pdl_ChType, AUTOMATIC) PdlDmaChannel,
                    VAR(Pdl_DmaPrioType, AUTOMATIC) DmaChannelPrio);

FUNC(boolean, PDL_CODE) Pdl_TopDmaIsTransComp(VAR(Pdl_ChType, AUTOMATIC) PdlDmaChannel);

#if ((STD_ON == CDD_PDL_DMA_NOTIFICATION_ENABLE) || (STD_ON == CDD_PDL_DMA_ERR_NOTIFICATION_SUPPORT))
    FUNC(void, PDL_CODE) Pdl_TopDmaNotifiEn(VAR(Pdl_ChType, AUTOMATIC) PdlDmaChannel,
                   VAR(Pdl_DmaTranNotifType, AUTOMATIC) NotificationType);

    FUNC(void, PDL_CODE) Pdl_TopDmaNotifiDis(VAR(Pdl_ChType,AUTOMATIC) PdlDmaChannel,
                   VAR(Pdl_DmaTranNotifType, AUTOMATIC)  NotificationType);

    FUNC(void, PDL_CODE) Pdl_TopDmaAcknowlInt(VAR(Pdl_ChType, AUTOMATIC) PdlDmaChannel);
#endif  /* {if ((STD_ON == CDD_PDL_DMA_NOTIFICATION_ENABLE) ||... */

FUNC(void, PDL_CODE) Pdl_TopDmaChDataNumSet(VAR(Pdl_ChType, AUTOMATIC) PdlDmaChannel, VAR(uint32, AUTOMATIC) DataNum);

FUNC(uint32, PDL_CODE) Pdl_TopDmaChDataNumRead(VAR(Pdl_ChType, AUTOMATIC) PdlDmaChannel);

FUNC(uint8, PDL_CODE) Pdl_TopDmaChStsFlagRead(VAR(Pdl_DmaChFlagType, AUTOMATIC) Flag);

FUNC(void, PDL_CODE) Pdl_TopDmaChStsFlagClr(VAR(Pdl_DmaChFlagType, AUTOMATIC) Flag);

FUNC(void, PDL_CODE) Pdl_TopDmaPAddrRefresh(VAR(Pdl_ChType, AUTOMATIC) ChannelId,\
    VAR(uint32, AUTOMATIC) Paddr);
FUNC(void, PDL_CODE) Pdl_TopDmaMAddrRefresh(VAR(Pdl_ChType, AUTOMATIC) ChannelId,\
    VAR(uint32, AUTOMATIC) Maddr);

#if (STD_ON == CDD_PDL_DMA_ERR_NOTIFICATION_SUPPORT)
    FUNC (void, PDL_CODE) Pdl_ErrNotifiCallbackFunc(VAR(Pdl_DmaModType, AUTOMATIC) DmaCh);
#endif /* {if (STD_ON == CDD_PDL_DMA_ERR_NOTIFICATION_SUPPORT)} */

#if (STD_ON == CDD_PDL_DMA_NOTIFICATION_ENABLE)
    FUNC (void, PDL_CODE) Pdl_NotifiCallbackFunc(VAR(Pdl_ChType, AUTOMATIC) ChId);
#endif /* {if (STD_ON == CDD_PDL_DMA_NOTIFICATION_ENABLE)} */

#endif /* {if (STD_ON == CDD_PDL_DMA_SUPPORT)} */

#if (STD_ON == CDD_PDL_DEINIT_API)
    FUNC(void, PDL_CODE) Pdl_DeInit(void);
#endif  /* {if (STD_ON == CDD_PDL_DEINIT_API)} */

#if (STD_ON == CDD_PDL_VERSION_INFO_API)
    FUNC(void, PDL_CODE) Pdl_TopGetVersionInfo(P2VAR(Std_VersionInfoType, AUTOMATIC, PDL_APPL_DATA) PdlVersionInfoPtr);
#endif

#define PDL_STOP_SEC_CODE
#include "Pdl_MemMap.h"

/**@} end of group PDL_Fuctions */
#ifdef __cplusplus
}
#endif  /* ifdef __cplusplus */
#endif  /* define CDD_PDL_H */
/**@} end of group PDL_Driver */
/**@} end of group G32A10xx_StdPeriphDriver */
