/*
 * @file hv_drv_GpioSimSWire.h
 * @brief Header file of gpio simulate single wire module.
 *
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * (+) Use ()
 *
 * @endverbatim
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2023-12-16
 */

#ifndef _HV_DRV_GPIOSIMSWIRE_H
#define _HV_DRV_GPIOSIMSWIRE_H
#include "Common/hv_comm_DataType.h"

/** @defgroup DRV_GPIOSIMSWIRE DRV GPIO SIMULATE SINGLE WIRE
 *  drv gpio simulate single wire functions
 *  @{
 */

typedef enum _SWireID
{
    SIMSWIRE_ID_0,
    SIMSWIRE_ID_MAX,
}SWireID;

typedef struct _GpioSimSWire
{
    SWireID enBus;    /*Support Multi Channel*/
    UCHAR8  ucSdtPin; /*SDT Input Pin*/
    UCHAR8  ucSckPin; /*SCK Input Pin*/
    UCHAR8  ucTWHL;   /*Pulse duration of SCKI*/
    UCHAR8  ucTSU;    /*Setup time, SDTI - SCKI */
    UCHAR8  ucTHL;    /*Hold time, SDTI - SCKI */
}GpioSimSWire;

/** Swire start signal
 *@SCK and SDT keep low
 */
VOID Hv_GpioSimSWire_Start(UINT32 uiIndex);

/** Swire stop  signal
 *@SCK and SDT keep Low
 */
VOID Hv_GpioSimSWire_Stop(UINT32 uiIndex);

/** Initialize gpio simulation swire
 *  @param pstGpioSimI2c pointer to swire configuration parameters
 *  @return SUCCESS/FAILURE
 */
Status Hv_Drv_GpioSimSWire_Init(const GpioSimSWire *pstGpioSimSwire);

/** Send in master mode an amount of data
 *  @param pucData pointer to data buffer to be transmited
 *  @param usDataSize amount of data to be sent
 *  @retval Status SUCESS/FAILURE
*/
Status Hv_Drv_GpioSimSWire_SendData(SWireID enBus, UCHAR8 *pcData, UINT32 uiDatasize);

/** Receive in master mode an amount of data
*  @param pucData pointer to data buffer to be transmited
*  @param usDataSize amount of data to be receive
*  @retval Status SUCESS/FAILURE
*/
Status Hv_Drv_GpioSimSWire_RecvData(SWireID enBus, UCHAR8 *pucData, USHORT16 usDataSize);
/** @} */

#endif




