/**
 * @file TypecConfig.h
 * @brief Header file of Type-c Config.
 * 
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * 
 * 
 @ endverbatim 
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2023-09-01
 */
#ifndef __TYPECCONFIG_H__
#define __TYPECCONFIG_H__

#include "BoardConfig.h"
#include "ProjectConfig.h"

/*************************************************
   Type-c Option Definition
*************************************************/   
#define TYPEC_MODE_SINK                                        (0)
#define TYPEC_MODE_SRC                                         (1)
#define TYPEC_MODE_DRP                                         (2)

#define TYPEC_LEVEL_LOW                                        (0)
#define TYPEC_LEVEL_HIGH                                       (1)

#define TYPEC_FUNCTION_OFF                                     (0)
#define TYPEC_FUNCTION_ON                                      (1)

/*************************************************
   Type-c GPIO config
*************************************************/
#define HV_TYPEC_CONFIG_GPIO_VCONN_CC2_SW_OFF                  TYPEC_LEVEL_LOW
#define HV_TYPEC_CONFIG_GPIO_GP_PD_PW_S_OFF                    TYPEC_LEVEL_HIGH

#define HV_TYPEC_CONFIG_GPIO_VBUS_PMU_EN_DEFAULT               TYPEC_LEVEL_LOW
#define HV_TYPEC_CONFIG_GPIO_GP_PD_PW_S_DEFAULT                TYPEC_LEVEL_HIGH
#define HV_TYPEC_CONFIG_GPIO_VBUS_DISCHA_DEFAULT               TYPEC_LEVEL_LOW
#define HV_TYPEC_CONFIG_GPIO_VCONN_CC2_SW_DEFAULT              TYPEC_LEVEL_LOW
#define HV_TYPEC_CONFIG_GPIO_VCONN_CC1_SW_DEFAULT              TYPEC_LEVEL_HIGH
#define HV_TYPEC_CONFIG_GPIO_RX_AP_EN_DEFAULT                  TYPEC_LEVEL_LOW
#define HV_TYPEC_CONFIG_GPIO_CC_RD_CTL_DEFAULT                 TYPEC_LEVEL_HIGH

#define HV_TYPEC_CONFIG_GPIO_VSEL1_DEFAULT                     TYPEC_LEVEL_LOW
#define HV_TYPEC_CONFIG_GPIO_VSEL2_DEFAULT                     TYPEC_LEVEL_LOW
#define HV_TYPEC_CONFIG_GPIO_VSEL1_1_2VCC_DEFAULT              TYPEC_LEVEL_LOW

/*************************************************
   Type-c VBUS config
*************************************************/
#define HV_TYPEC_CONFIG_VBUS_THR_MIN_0V                        (0)
#define HV_TYPEC_CONFIG_VBUS_THR_MAX_0V                        (200)
#define HV_TYPEC_CONFIG_VBUS_THR_MIN_5V                        (400)
#define HV_TYPEC_CONFIG_VBUS_THR_MAX_5V                        (800)
#define HV_TYPEC_CONFIG_VBUS_THR_MIN_9V                        (890)
#define HV_TYPEC_CONFIG_VBUS_THR_MAX_9V                        (1200)
#define HV_TYPEC_CONFIG_VBUS_THR_MIN_12V                       (1250)
#define HV_TYPEC_CONFIG_VBUS_THR_MAX_12V                       (1450)
#define HV_TYPEC_CONFIG_VBUS_THR_MIN_15V                       (2450)
#define HV_TYPEC_CONFIG_VBUS_THR_MAX_15V                       (2850)
#define HV_TYPEC_CONFIG_VBUS_THR_MIN_20V                       (3350)
#define HV_TYPEC_CONFIG_VBUS_THR_MAX_20V                       (3750)

/*************************************************
   Type-c Function config
*************************************************/
#define HV_TYPEC_CONFIG_TYPEC_MODE                             TYPEC_MODE_DRP
#define HV_TYPEC_SUPPORT_NS_DEVICE

#define HV_TYPEC_CONFIG_CC_RD_CTL_EN                           TYPEC_FUNCTION_OFF
#define HV_TYPEC_CONFIG_SSPWD_EN                               TYPEC_FUNCTION_OFF  

#define HV_TYPEC_CONFIG_PM51_SSPWD_EN                          TYPEC_FUNCTION_OFF  /* For samsung phone waterdrop */
#define HV_TYPEC_CONFIG_PM51_SSPWD_USE_GPIO_INDEX              1                   /* Standby GPIO1 */

/*************************************************
   Type-c Config 这里配置以后会影响到hv_drv_TypecDrpBootConfig.h
*************************************************/
#define CFG_PORT_0_SOURCE_NUM_OF_PDOS        2U

#endif
