/**
 * @file  hv_drv_TypecDrpApp.h
 * @brief  Power Delivery DRP Application header file
 *       This header file contains user application specific functions and interfaces
 * @details This file provides the following functions: \n
 *          (1) \n
 *          (2) \n
 *          (3) \n
 *
 * 
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-08-25
 * @copyright Copyright(c),2022-8, Hiview Software. All rights reserved.
 * @par History:
 * <table>
 * <tr><th>Author                         <th>Date         <th>Change Description
 * <tr><td>Hiview SoC Software Team       <td>2022-08-25   <td>init
 * </table>
*/


#ifndef _HV_DRV_TYPECDRPAPP_H
#define _HV_DRV_TYPECDRPAPP_H


/* ************************************************************************** */
/* ************************************************************************** */
/* Section: Included Files                                                    */
/* ************************************************************************** */
/* ************************************************************************** */
#include <hv_drv_TypecApiHook.h>
#include "hv_drv_TypecStdInc.h"

/* Macro to indicate GPIO based DC-DC Controller MCP19119 */
#define PWRCTRL_GPIO_DC_DC_MCP19119     1

// *****************************************************************************
// *****************************************************************************
// Section: Interface Functions
// *****************************************************************************
// *****************************************************************************
/**
 * @brief Handle PSF's events.
 * @param[in] u8PortNum  Typec port numbuer.
 * @param[in] u8PDEvent  PSF events notification. 
 * @return void
 */
UINT8 App_HandlePSFEvents(UINT8 u8PortNum, eHV_PSF_NOTIFICATION u8PDEvent);

/**
 * @brief Initialize all the GPIO functionality pins in application layer.
 * @param[in] u8PortNum  Typec port numbuer.
 * @param[in] eGPIOFunc  GPIO Functionality enum. 
 * @return void
 */
void App_GPIOControl_Init(UINT8 u8PortNum, eHV_PSF_GPIO_FUNCTIONALITY eGPIOFunc);

/**
 * @brief Drive GPIOs assigned to GPIO functionality pins in application layer.
 * @param[in] u8PortNum  Typec port numbuer.
 * @param[in] eGPIOFunc  GPIO Functionality enum.
 * @param[in] eGPIODrive  GPIO  Drive enum.
 * @return void
 */
void App_GPIOControl_Drive(UINT8 u8PortNum, eHV_PSF_GPIO_FUNCTIONALITY eGPIOFunc,
                                    eHV_PSF_GPIO_DRIVE_VAL eGPIODrive);

/**
 * @brief Initializes all the hardware modules related to port power functionality.
 * @param[in] u8PortNum  Typec port numbuer.
 * @return HV_TRUE: succeed HV_FALSE: failed
 */
UINT8 App_PortPowerInit(UINT8 u8PortNum); 

/**
 * @brief Indicates the implicit/explicit current capability of attached source partner.
 * @param[in] u8PortNum  Typec port numbuer.
 * @param[in] u16DACData  Analog voltage to be driven on DAC_I pin. 
 * @return void
 */
void App_DriveDAC_I(UINT8 u8PortNum, UINT16 u16DACData);

/**
 * @brief Set DP Hot plug.
 * @param[in] u8PortNum  Typec port numbuer.
 * @param[in] bHpdEn  Set DP HPD high(true) or low(false). 
 * @return void
 */
void App_AMESetDpHpd(UINT8 u8PortNum, BOOL bHpdEn);

/**
 * @brief Set DP IRQ Hot plug.
 * @param[in] u8PortNum  Typec port numbuer.
 * @return void
 */
void App_AMESetDpIrqHpd(UINT8 u8PortNum);

/**
 * @brief Get status that if in DP ALT Mode.
 * @param[in] u8PortNum  Typec port numbuer.
 * @return HV_TRUE: entered DP ALT Mode HV_FALSE: exited DP ALT Mode
 */
BOOL App_AMEGetStatus(UINT8 u8PortNum);

/**
 * @brief Get Typec source capabilities.
 * @param[in] u8PortNum  Typec port numbuer.
 * @param[out] u8pSrcPDOCnt  return pointer that points to the counts of src PDOs.
 * @param[out] pu32DataObj  return pointer that points to data object of src PDOs.
 * @return void
 */
void App_GetSourceCapabilities(UINT8 u8PortNum, UINT8 *u8pSrcPDOCnt, UINT32 *pu32DataObj);

#endif /* _PSFDRP_APP_H */

/* *****************************************************************************
 End of File
 */
