You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
257 lines
5.3 KiB
257 lines
5.3 KiB
/**
|
|
******************************************************************************
|
|
* @copyright Copyright (C), 2016-2022, ConvenientPower. Co., Ltd.
|
|
* @file customized.h
|
|
* @version 1.0
|
|
* @author qing.cheng
|
|
* @date 2023-01-04
|
|
* @brief Header file of CUSTOMIZED_H module.
|
|
******************************************************************************
|
|
*/
|
|
#ifndef _CUSTOMIZED_H_
|
|
#define _CUSTOMIZED_H_
|
|
|
|
#define PD_PWR_DEFAULT 1
|
|
#define PD_PWR_65W 2
|
|
#define PD_PWR_45W 3
|
|
#define PD_PWR_30W 4
|
|
#include "core_comm.h"
|
|
#include "drv_comm.h"
|
|
//#include "comp_sc8933_ctr.h"
|
|
#include "qc_scp_protocol.h"
|
|
#include "comp_primary_side.h"
|
|
#include "port0_customized.h"
|
|
#include "port1_customized.h"
|
|
extern i2c_slave_msg_s g_i2c;
|
|
extern const uint8_t SCP_REGISTER_VALUE[256];
|
|
|
|
#define BIG_ENDIAN(x)\
|
|
((x&0x000000ff)<<24)|((x&0x0000ff00)<<8)|((x&0x00ff0000)>>8)|((x&0xff000000)>>24)
|
|
|
|
|
|
#define DAFAULE_DPDN_INIT_CFG 0x1C0FE7//0x1C0FE7//0x1C0FE7//0x1C8FE7//0x1C0FE7
|
|
|
|
#define APPLEMODE_DPDN_ENABLE_CFG 0x001f0e01//0x001f0e01//0x1F0F81
|
|
|
|
#define RS7C\
|
|
SOFT_WARE_VERISION_H
|
|
|
|
#define RS7D\
|
|
SOFT_WARE_VERISION_L
|
|
|
|
|
|
typedef enum
|
|
{
|
|
NO_PORT_INSERT = 0,
|
|
SINGLE_PORT_INSERT,
|
|
SINGLE_PORT1_INSERT,
|
|
SINGLE_PORT2_INSERT,
|
|
DOUBLE_PORT_INSERT,
|
|
} ADAPTER_STATUS_e;
|
|
|
|
typedef struct
|
|
{
|
|
|
|
uint32_t derate_cnt;
|
|
uint32_t derate_cnt2;
|
|
bool derate_flag;
|
|
} double_derate_infos_s;
|
|
|
|
typedef struct
|
|
{
|
|
|
|
uint16_t state_change_debounce_cnt;
|
|
bool state_firs_chage;
|
|
bool state_has_chaged;
|
|
} double_port_insert_state_change_infos_s;
|
|
|
|
typedef struct
|
|
{
|
|
ADAPTER_STATUS_e adapter_state;
|
|
double_derate_infos_s double_derate_infos[2];
|
|
double_port_insert_state_change_infos_s double_port_insert_state_change_infos;
|
|
} adapter_info_s;
|
|
|
|
|
|
#if SCP_SUPPORT
|
|
/***********************SCP************************************/
|
|
|
|
/*
|
|
* @brief scp_register_attr_upgrade
|
|
* @param scp_param
|
|
* @param port
|
|
* @note SCP寄存器属性修改--SCP deposit area properties updated
|
|
* @retval null
|
|
*/
|
|
void scp_register_attr_upgrade(uint8_t port, scp_param_s *scp_param);
|
|
|
|
/*
|
|
* @brief scp_def_vol_init
|
|
* @param scp_param
|
|
* @param port
|
|
* @note
|
|
* @retval
|
|
*/
|
|
void scp_def_vol_init(uint8_t port, scp_param_s *scp_param);/*TODO CALL BACK?*/
|
|
|
|
|
|
/*
|
|
* @brief scp_reg_hook_register
|
|
* @param scp_param
|
|
* @param port
|
|
* @note
|
|
* @retval
|
|
*/
|
|
void scp_reg_hook_register(uint8_t port, scp_param_s *scp_param);/*TODO CALL BACK?*/
|
|
|
|
|
|
/*
|
|
* @brief 0xb8 b9 ba bb register reset.
|
|
* @param port
|
|
* @param scp_param
|
|
* @note 退出SCPA/B应该恢复其对应的功率参数和寄存器值
|
|
* @retval
|
|
*/
|
|
void path_scp_mode_exit_action(uint8_t port, scp_param_s *scp_param);
|
|
|
|
|
|
/*
|
|
* @brief capabiloties_features
|
|
* @param port
|
|
* @param scp_prl_passist
|
|
* @note register 0x2f
|
|
* @retval NULL
|
|
*/
|
|
void capabiloties_features(uint8_t port, scp_prl_s *scp_prl_passist);
|
|
|
|
/*
|
|
* @brief scp_scp_register_value_get
|
|
* @param port
|
|
* @retval NULL
|
|
*/
|
|
const uint8_t *scp_scp_register_value_get(uint8_t port);
|
|
|
|
/*
|
|
* @brief get_scp_powe_curve_cur
|
|
* @param port
|
|
* @retval NULL
|
|
*/
|
|
uint16_t get_scp_powe_curve_cur(uint8_t port, uint16_t vol);
|
|
|
|
#endif
|
|
|
|
#if UFCS_SUPPORT
|
|
|
|
/*********************UFCS************************************/
|
|
/*
|
|
* @brief ufcs_src_volt_test_func
|
|
* @param port
|
|
* @param test_req
|
|
* @note
|
|
* @retval NULL
|
|
*/
|
|
void ufcs_src_volt_test_func(uint8_t port, u_test_req *test_req);
|
|
|
|
/*
|
|
* @brief ufcs_src_cap_init
|
|
* @param port
|
|
* @param ufcs_param
|
|
* @note NULL
|
|
* @retval NULL
|
|
*/
|
|
void ufcs_src_cap_init(uint8_t port, ufcs_param_s *ufcs_param);
|
|
|
|
/*
|
|
* @brief ufcs_src_power_change_msg_assemble
|
|
* @param ufcs_param
|
|
* @note UFCS降额发送power change功率参数
|
|
* @retval NULL
|
|
*/
|
|
uint8_t ufcs_src_power_change_msg_assemble(uint8_t port, ufcs_param_s *ufcs_param);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
* @brief pe_src_cable_check_callback
|
|
* @param pd_param
|
|
* @note 解析meark信息---check emark information and update src_cap
|
|
* @retval null
|
|
*/
|
|
void pe_src_cable_check_callback(uint8_t port, pd_param_s* pd_param);
|
|
|
|
/*
|
|
* @brief pd_src_cap_init
|
|
* @param port
|
|
* @param pd_param
|
|
* @note
|
|
* @retval null
|
|
*/
|
|
void pd_src_cap_init(uint8_t port, pd_param_s*pd_param, uint8_t pwr_cnt);
|
|
|
|
/*
|
|
* @brief adapter_state_check
|
|
* @param NULL
|
|
* @param NULL
|
|
* @note
|
|
* @retval null
|
|
*/
|
|
void adapter_state_check(void);
|
|
|
|
/*
|
|
* @brief pd_src_cap_derating_update
|
|
* @param port
|
|
* @param pd_param
|
|
* @note
|
|
* @retval null
|
|
*/
|
|
void pd_src_cap_derating_update(uint8_t port, pd_param_s*pd_param);
|
|
|
|
/*
|
|
* @brief app_dpdn_init
|
|
* @param port
|
|
* @param value
|
|
* @note
|
|
* @retval 0:failed,1:sucess
|
|
*/
|
|
void app_dpdn_init(uint8_t port, uint32_t value);
|
|
|
|
/*****************************************************************************************************/
|
|
|
|
|
|
/*
|
|
* @brief system_init
|
|
* @param null
|
|
* @note
|
|
* @retval 0:failed,1:sucess
|
|
*/
|
|
uint8_t system_init(void);
|
|
|
|
/*
|
|
* @brief app_protocol_run
|
|
* @param null
|
|
* @note
|
|
* @retval null
|
|
*/
|
|
void app_protocol_run(uint8_t port);
|
|
|
|
extern const tfcp_only_read_command_s TFCP_ONLY_R_CMD[TYPEC_PORT_MAX];
|
|
extern const tfcp_wr_command_s TFCP_INIT_WR_CMD[TYPEC_PORT_MAX];
|
|
|
|
/*
|
|
* @brief app_cc_loop_auto_comp
|
|
* @param port
|
|
* @note
|
|
* @retval null
|
|
*/
|
|
void app_cc_loop_auto_comp(uint8_t port);
|
|
|
|
/*
|
|
* @brief app_double_dynamic_power_check
|
|
* @param null
|
|
* @note
|
|
* @retval null
|
|
*/
|
|
void app_double_dynamic_power_check(void);
|
|
#endif
|
|
|