/*!
* @file     Pdl_Dma.h
*
* @version  1.0.0
*
* @brief    Data Type Definition and function declaration File for the PDL Module Based on DMA IP.
*           
* @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 PDL_DMA_H
#define PDL_DMA_H

#ifdef __cplusplus
extern "C"{
#endif

#include "Pdl_DmaReg.h"
#include "Pdl_DmaTypes.h"

#if (STD_ON == CDD_PDL_DMA_GET_CH_ERR_STAT_API)
#if (STD_OFF == CDD_PDL_DEM_ERR_REP_DISABLE)
#include "Dem.h"
#endif
#endif
/** @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 PDL_DMA_H_VENDOR_ID                       0x00C1U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define PDL_DMA_H_AR_RELEASE_MAJOR_VERSION        0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define PDL_DMA_H_AR_RELEASE_MINOR_VERSION        0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define PDL_DMA_H_AR_RELEASE_REVISION_VERSION     0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define PDL_DMA_H_SW_MAJOR_VERSION                0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define PDL_DMA_H_SW_MINOR_VERSION                0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define PDL_DMA_H_SW_PATCH_VERSION                0x00U

/**@} end of group PDL_Macros */
/**********************************************************************************************************************
                                             FUNCTION DEFINITION
***********************************************************************************************************************/
/** @defgroup PDL_Fuctions
  @{
*/
#if (STD_ON == CDD_PDL_DMA_SUPPORT)
#define PDL_START_SEC_CODE
#include "Pdl_MemMap.h"

/** Reset and configuration */
FUNC(void, PDL_CODE) Pdl_Dma_ChConfig(VAR(Pdl_DmaChType, AUTOMATIC) ChId,
                P2CONST(Pdl_DmaChHwConfigType, AUTOMATIC, PDL_APPL_DATA) DmaChHwConfigPtr);
FUNC(void, PDL_CODE) Pdl_Dma_Enable(VAR(Pdl_DmaChType, AUTOMATIC) ChId);
FUNC(void, PDL_CODE) Pdl_Dma_Disable(VAR(Pdl_DmaChType, AUTOMATIC) ChId);
FUNC(void, PDL_CODE) Pdl_Dma_Init(P2CONST(Pdl_DmaConfigType, AUTOMATIC, PDL_APPL_CONST) DmaConfigPtr);

#if (STD_ON == CDD_PDL_DMA_GET_CH_ERR_STAT_API)
    FUNC(Pdl_DmaChErrStsType, PDL_CODE) Pdl_Dma_ChErrStsGet(VAR(Pdl_DmaChType, AUTOMATIC) DmaCh);
#endif

FUNC(void, PDL_CODE) Pdl_Dma_ChPrioSet(VAR(Pdl_DmaChType, AUTOMATIC) DmaCh, VAR(Pdl_DmaPrioType, AUTOMATIC) ChPrio);

FUNC(boolean, PDL_CODE) Pdl_Dma_TransDoneCheck(VAR(Pdl_ChType, AUTOMATIC) DmaCh);

#if ((STD_ON == CDD_PDL_DMA_NOTIFICATION_ENABLE) || (STD_ON == CDD_PDL_DMA_ERR_NOTIFICATION_SUPPORT))
    FUNC(void, PDL_CODE) Pdl_Dma_NotifEn(VAR(Pdl_ChType, AUTOMATIC) DmaCh, VAR(Pdl_DmaTranNotifType, AUTOMATIC) NotifiType);
    FUNC(void, PDL_CODE) Pdl_Dma_NotifDis(VAR(Pdl_ChType, AUTOMATIC) DmaCh, VAR(Pdl_DmaTranNotifType, AUTOMATIC) NotifiType);
#endif /* if ((STD_ON == CDD_PDL_DMA_NOTIFICATION_ENABLE) ||... */

FUNC(void, PDL_CODE) Pdl_Dma_PAddrRefresh(VAR(Pdl_ChType, AUTOMATIC) ChannelId, VAR(uint32, AUTOMATIC) Paddr);

FUNC(void, PDL_CODE) Pdl_Dma_MAddrRefresh(VAR(Pdl_ChType, AUTOMATIC) ChannelId, VAR(uint32, AUTOMATIC) Maddr);

#if (STD_ON == CDD_PDL_DEINIT_API)
    FUNC(void, PDL_CODE) Pdl_Dma_DeInit(P2CONST(Pdl_DmaConfigType, AUTOMATIC, PDL_APPL_CONST) DmaConfigPtr);
#endif /* {if (STD_ON == CDD_PDL_DEINIT_API)} */

FUNC(void, PDL_CODE) Pdl_Dma_IntAcknow(VAR(Pdl_ChType,AUTOMATIC) DmaCh);

/** Data number */
FUNC(void, PDL_CODE) Pdl_Dma_SetDataNumber(VAR(Pdl_DmaChType, AUTOMATIC) DmaCh, VAR(uint32, AUTOMATIC) DataNum);
FUNC(uint32, PDL_CODE) Pdl_Dma_ReadDataNumber(VAR(Pdl_DmaChType, AUTOMATIC) DmaCh);

/** Flag */
FUNC(uint8, PDL_CODE) Pdl_Dma_ReadStatusFlag(VAR(Pdl_DmaChFlagType, AUTOMATIC) Flag);
FUNC(void, PDL_CODE) Pdl_Dma_ClrStsFlag(VAR(uint32, AUTOMATIC) Flag);

FUNC(uint8, PDL_CODE) Pdl_Dma_ReadInitEn(VAR(Pdl_DmaChType, AUTOMATIC) DmaCh, Pdl_DmaIntType IntType);

void DMA_CH1_IRQHandler(void);
void DMA_CH2_3_IRQHandler(void);
void DMA_CH4_5_IRQHandler(void);

#define PDL_STOP_SEC_CODE
#include "Pdl_MemMap.h"

#endif

/**@} end of group PDL_Fuctions */
#ifdef __cplusplus
}
#endif //__cplusplus

#endif /* PDL_DMA_H */
/**@} end of group PDL_Driver */
/**@} end of group G32A10xx_StdPeriphDriver */
