/*
* @file    Dio_Lld.h
*==================================================================================================
*   Project              : YTMicro AUTOSAR 4.4.0 MCAL
*   Platform             : ARM
*   Peripheral           : Dio_Lld
*   Dependencies         : none
*
*   Autosar Version      : V4.4.0
*   Autosar Revision     : ASR_REL_4_4_REV_0000
*   SW Version           : V0.8.0
*
*   (c) Copyright 2020-2026 Yuntu Microelectronics co.,ltd.
*   All Rights Reserved.
==================================================================================================*/

#ifndef DIO_LLD_H
#define DIO_LLD_H

#ifdef __cplusplus
extern "C" {
#endif

/*==================================================================================================
                                              INCLUDE FILES
==================================================================================================*/

#include "Dio_Types.h"

/*==================================================================================================
                                      HEADER FILE VERSION INFORMATION
==================================================================================================*/
#define DIO_LLD_VENDOR_ID                      (180)
#define DIO_LLD_AR_RELEASE_MAJOR_VERSION       (4)
#define DIO_LLD_AR_RELEASE_MINOR_VERSION       (4)
#define DIO_LLD_AR_RELEASE_REVISION_VERSION    (0)
#define DIO_LLD_SW_MAJOR_VERSION               (0)
#define DIO_LLD_SW_MINOR_VERSION               (8)
#define DIO_LLD_SW_PATCH_VERSION               (0)

/*==================================================================================================
                                        FILE VERSION CHECKS
==================================================================================================*/
/* Check if LLD source file and DIO Types header file are of the same vendor */
#if (DIO_LLD_VENDOR_ID != DIO_TYPES_VENDOR_ID)
#error "Dio_Lld.h and Dio_Types.h have different vendor ids"
#endif

/* Check if LLD source file and DIO Types header file are of the same Autosar version */
#if ((DIO_LLD_AR_RELEASE_MAJOR_VERSION != DIO_TYPES_AR_RELEASE_MAJOR_VERSION) || \
     (DIO_LLD_AR_RELEASE_MINOR_VERSION != DIO_TYPES_AR_RELEASE_MINOR_VERSION) || \
     (DIO_LLD_AR_RELEASE_REVISION_VERSION != DIO_TYPES_AR_RELEASE_REVISION_VERSION))
#error "AutoSar Version Numbers of Dio_Lld.h and Dio_Types.h are different"
#endif

/* Check if LLD source file and DIO Types header file are of the same software version */
#if ((DIO_LLD_SW_MAJOR_VERSION != DIO_TYPES_SW_MAJOR_VERSION) || \
     (DIO_LLD_SW_MINOR_VERSION != DIO_TYPES_SW_MINOR_VERSION) || \
     (DIO_LLD_SW_PATCH_VERSION != DIO_TYPES_SW_PATCH_VERSION))
#error "Software Version Numbers of Dio_Lld.h and Dio_Types.h are different"
#endif
/*==================================================================================================
                                                DEFINES AND MACROS
==================================================================================================*/


/*==================================================================================================
                                                EXTERNAL CONSTANTS
==================================================================================================*/
/*==================================================================================================
                                                ENUMS
==================================================================================================*/
/*==================================================================================================
                                                FUNCTION PROTOTYPES
==================================================================================================*/

/**
 * @brief         Low-level driver function to write and set output GPIO port value
 * @autosar       N/A
 *
 * @details       Service ID: N/A (Internal Function)
 *                Sync/Async: Synchronous
 *                Reentrancy: Reentrant
 *                Available via: Dio_Lld.h
 *
 * @param[in] PortHwId: Hardware port identifier
 * @param[in] Level: Value to be written to the port
 * @return void
*/
void Dio_Lld_WriteSetOutGpioPort(Dio_PortType PortHwId, Dio_PortLevelType Level);

/**
 * @brief         Low-level driver function to write and clear output GPIO port value
 * @autosar       N/A
 *
 * @details       Service ID: N/A (Internal Function)
 *                Sync/Async: Synchronous
 *                Reentrancy: Reentrant
 *                Available via: Dio_Lld.h
 *
 * @param[in] PortHwId: Hardware port identifier
 * @param[in] Level: Value to be written to the port clear register
 * @return void
*/
void Dio_Lld_WriteClrOutGpioPort(Dio_PortType PortHwId, Dio_PortLevelType Level);

/**
 * @brief         Low-level driver function to write GPIO pin level
 * @autosar       N/A
 *
 * @details       Service ID: N/A (Internal Function)
 *                Sync/Async: Synchronous
 *                Reentrancy: Reentrant
 *                Available via: Dio_Lld.h
 *
 * @param[in] PortHwId: Hardware port identifier
 * @param[in] PinHwId: Hardware pin number
 * @param[in] Level: Pin level to be set (STD_LOW or STD_HIGH)
 * @return void
*/
void Dio_Lld_WriteGpioPin(Dio_PortType PortHwId, Dio_PinType PinHwId, Dio_LevelType Level);

/**
 * @brief         Low-level driver function to read GPIO pin level
 * @autosar       N/A
 *
 * @details       Service ID: N/A (Internal Function)
 *                Sync/Async: Synchronous
 *                Reentrancy: Reentrant
 *                Available via: Dio_Lld.h
 *
 * @param[in] PortHwId: Hardware port identifier
 * @param[in] PinHwId: Hardware pin number
 * @return Dio_LevelType Current pin level (STD_LOW or STD_HIGH)
*/
Dio_LevelType Dio_Lld_ReadGpioPin(Dio_PortType PortHwId, Dio_PinType PinHwId);

/**
 * @brief         Low-level driver function to write GPIO port output value
 * @autosar       N/A
 *
 * @details       Service ID: N/A (Internal Function)
 *                Sync/Async: Synchronous
 *                Reentrancy: Reentrant
 *                Available via: Dio_Lld.h
 *
 * @param[in] PortHwId: Hardware port identifier
 * @param[in] Level: Value to be written to the port data output register
 * @return void
*/
void Dio_Lld_WriteGpioPort(Dio_PortType PortHwId, Dio_PortLevelType Level);

/**
 * @brief         Low-level driver function to read GPIO port input value
 * @autosar       N/A
 *
 * @details       Service ID: N/A (Internal Function)
 *                Sync/Async: Synchronous
 *                Reentrancy: Reentrant
 *                Available via: Dio_Lld.h
 *
 * @param[in] PortHwId: Hardware port identifier
 * @return Dio_PortLevelType Current port input value
*/
Dio_PortLevelType Dio_Lld_ReadGpioPort(Dio_PortType PortHwId);

/**
 * @brief         Low-level driver function to toggle GPIO pin state and return new level
 * @autosar       N/A
 *
 * @details       Service ID: N/A (Internal Function)
 *                Sync/Async: Synchronous
 *                Reentrancy: Reentrant
 *                Available via: Dio_Lld.h
 *
 * @param[in] PortHwId: Hardware port identifier
 * @param[in] PinHwId: Hardware pin number
 * @return Dio_LevelType New pin level after toggle (STD_LOW or STD_HIGH)
*/
Dio_LevelType Dio_Lld_ToggleGpioPin(Dio_PortType PortHwId, Dio_PinType PinHwId);

#ifdef __cplusplus
}
#endif

#endif /* End of file Dio_Lld.h */

