/*!
* @file     Mcu_SysCfgTypes.h
*
* @version  1.0.0
*
* @brief    Data Type Definition File for the MCU Module Based on SysCfg.
*
* @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 MCU_SYSCFGTYPES_H
#define MCU_SYSCFGTYPES_H

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

#include "StdRegMacros.h"
#include "Compiler_Cfg.h"
#include "Compiler.h"

/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @addtogroup MCU_Driver
  @{
*/

/** @defgroup MCU_Macros
  @{
*/
/*******************************************************************************
                        VENDOR ID & AUTOSAR VERSION INFO
*******************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define MCU_SYSCFG_TYPES_H_VENDOR_ID                               0x00C1U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */  
#define MCU_SYSCFG_TYPES_H_AR_RELEASE_MAJOR_VERSION                0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define MCU_SYSCFG_TYPES_H_AR_RELEASE_MINOR_VERSION                0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define MCU_SYSCFG_TYPES_H_AR_RELEASE_REVISION_VERSION             0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */  
#define MCU_SYSCFG_TYPES_H_SW_MAJOR_VERSION                        0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define MCU_SYSCFG_TYPES_H_SW_MINOR_VERSION                        0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define MCU_SYSCFG_TYPES_H_SW_PATCH_VERSION                        0x00U

/**@} end of group MCU_Macros */
/*******************************************************************************
                             VERSION CHECK
*******************************************************************************/
#ifdef ENABLE_INTERMODULE_MCAL_CHECK
    /* Make sure the AUTOSAR major version number is the same between Mcu_SysCfgTypes.h and Reg_eSys.h */
    #if (MCU_SYSCFG_TYPES_H_AR_RELEASE_MAJOR_VERSION != REG_ESYS_H_AR_RELEASE_MAJOR_VERSION)
        #error "AUTOSAR Major Version Number mismatch between Mcu_SysCfgTypes.h and Reg_eSys.h"
    #endif
    /* Make sure the AUTOSAR minor version number is the same between Mcu_SysCfgTypes.h and Reg_eSys.h */
    #if (MCU_SYSCFG_TYPES_H_AR_RELEASE_MINOR_VERSION != REG_ESYS_H_AR_RELEASE_MINOR_VERSION)
        #error "AUTOSAR Minor Version Number mismatch between Mcu_SysCfgTypes.h and Reg_eSys.h"
    #endif
#endif

/*******************************************************************************
                            ENUMERATION DEFINITION
*******************************************************************************/
/** @defgroup MCU_Enumerations
  @{
*/

/**
 * @brief   SYSCFG EINT Port Sources
 */
typedef enum
{
    SYSCFG_PORT_GPIOA   = ((uint8)0x00),   //!< Port Source GPIOA
    SYSCFG_PORT_GPIOB   = ((uint8)0x01),   //!< Port Source GPIOB
    SYSCFG_PORT_GPIOC   = ((uint8)0x02),   //!< Port Source GPIOC
    SYSCFG_PORT_GPIOD   = ((uint8)0x03),   //!< Port Source GPIOD
    SYSCFG_PORT_RETAIN  = ((uint8)0x04),   //!< Port retain value
    SYSCFG_PORT_GPIOF   = ((uint8)0x05)    //!< Port Source GPIOF
} Mcu_Sysc_PortType;

/**
 * @brief   SYSCFG EINT Pin Sources
 */
typedef enum
{
    SYSCFG_PIN_0    = ((uint8)0x00),    //!< Pin Source 0
    SYSCFG_PIN_1    = ((uint8)0x01),    //!< Pin Source 1
    SYSCFG_PIN_2    = ((uint8)0x02),    //!< Pin Source 2
    SYSCFG_PIN_3    = ((uint8)0x03),    //!< Pin Source 3
    
    SYSCFG_PIN_4    = ((uint8)0x04),    //!< Pin Source 4
    SYSCFG_PIN_5    = ((uint8)0x05),    //!< Pin Source 5
    SYSCFG_PIN_6    = ((uint8)0x06),    //!< Pin Source 6
    SYSCFG_PIN_7    = ((uint8)0x07),    //!< Pin Source 7
    
    SYSCFG_PIN_8    = ((uint8)0x08),    //!< Pin Source 8
    SYSCFG_PIN_9    = ((uint8)0x09),    //!< Pin Source 9
    SYSCFG_PIN_10   = ((uint8)0x0A),    //!< Pin Source 10
    SYSCFG_PIN_11   = ((uint8)0x0B),    //!< Pin Source 11
    
    SYSCFG_PIN_12   = ((uint8)0x0C),    //!< Pin Source 12
    SYSCFG_PIN_13   = ((uint8)0x0D),    //!< Pin Source 13
    SYSCFG_PIN_14   = ((uint8)0x0E),    //!< Pin Source 14
    SYSCFG_PIN_15   = ((uint8)0x0F)     //!< Pin Source 15
} Mcu_Sysc_PinType;

/**
 * @brief   SYSCFG Memory Remap Config
 */
typedef enum
{
    SYSCFG_MEMORY_REMAP_FMC     = ((uint8)0x00),    //!< SYSCFG MemoryRemap Flash
    SYSCFG_MEMORY_REMAP_SYSTEM  = ((uint8)0x01),    //!< SYSCFG MemoryRemap SystemMemory
    SYSCFG_MEMORY_REMAP_SRAM    = ((uint8)0x03)     //!< SYSCFG MemoryRemap SRAM
} Mcu_Sysc_MemoryRemapType;

/**
 * @brief   SYSCFG DMA Remap Config
 */
typedef enum
{
    SYSCFG_DAM_REMAP_ADC       = ((uint32)0x00000100),   //!< ADC DMA remap
    SYSCFG_DAM_REMAP_USART1TX  = ((uint32)0x00000200),   //!< USART1 TX DMA remap
    SYSCFG_DAM_REMAP_USART1RX  = ((uint32)0x00000400),   //!< USART1 RX DMA remap
    SYSCFG_DAM_REMAP_TMR4CH3   = ((uint32)0x00001000),   //!< Timer 4 channel 3 DMA remap
    SYSCFG_DAM_REMAP_TMR4UP    = ((uint32)0x00002000)    //!< Timer 4 up DMA remap
} Mcu_Sysc_DamRemapType;

/**
 * @brief   SYSCFG Lock Config
 */
typedef enum
{
    SYSCFG_LOCK         = ((uint32)0x00000001),  //!< Cortex-M0 LOCKUP bit enable
    SYSCFG_PVDLOCK      = ((uint32)0x00000004),  //!< PVD lock bit
    SYSCFG_LOCK_PVDLOCK = ((uint32)0x00000005)   //!< Cortex-M0 LOCKUP and PVD lock bit
} Mcu_Sysc_LockType;


/**
 * @brief   SYSCFG flag
 */
typedef enum
{
    REMAP_DISABLE = 0,
    REMAP_ENABLE = 1
} Mcu_Sysc_RemappingType;

/**@} end of group MCU_Enumerations */
/*******************************************************************************
                            STRUCT DEFINITION
*******************************************************************************/
/** @defgroup MCU_Structure
  @{
*/

/**
 * @brief   DMA remapping configuration
 */
typedef struct
{
    Mcu_Sysc_DamRemapType  module;    //!< dma module
    Mcu_Sysc_RemappingType enable;
} Mcu_Sysc_dmaTypes;

/**
 * @brief   External Interrupt Configuration
 */
typedef struct
{
    Mcu_Sysc_PinType  portPin;    //!< port pin select
    Mcu_Sysc_PortType port;    //!< port select
} Mcu_Sysc_EnitCfgTypes;


typedef struct
{
    const Mcu_Sysc_MemoryRemapType memSel;
    const Mcu_Sysc_dmaTypes * dmaRmpCfg;
    const Mcu_Sysc_EnitCfgTypes * enitCfg;
    const Mcu_Sysc_LockType lock;
} Mcu_Sysc_CfgTypes;

/**@} end of group MCU_Structure */
/*******************************************************************************
                            FUNCTION DECLARATION
*******************************************************************************/
#define MCU_START_SEC_CODE
#include "Mcu_MemMap.h"

/** @defgroup MCU_Fuctions
  @{
*/

FUNC(void, MCU_CODE) Mcu_Sysc_Init(const Mcu_Sysc_CfgTypes * syscConfig);
FUNC(void, MCU_CODE) Mcu_Sysc_EintConfig(Mcu_Sysc_PinType portPin, Mcu_Sysc_PortType port);

/**@} end of group MCU_Fuctions */

#define MCU_STOP_SEC_CODE
#include "Mcu_MemMap.h"

#ifdef __cplusplus
}
#endif  /* __cplusplus */

#endif  /* MCU_SYSCFG_TYPES_H */

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