/** ****************************************************************************** * @copyright Copyright (C), 2016-2022, ConvenientPower. Co., Ltd. * @file ufcs_prl_func.h * @version 1.0 * @author qing.cheng * @date 2022-12-02 * @brief Header file of UFCS_PRL_FUNC_H module. ****************************************************************************** */ #ifndef __UFCS_PRL_FUNC_H__ #define __UFCS_PRL_FUNC_H__ #include "ufcs_app.h" #include "ufcs_phy.h" #include "ufcs_flag.h" typedef enum { UFCS_HDSK_SING0 = 0, UFCS_HDSK_SING1, UFCS_HDSK_SING2, UFCS_HDSK_SING3, UFCS_HDSK_MAX } ufcs_hdsk_cnt_e; typedef void (*f_ufcs_prl_action)(uint8_t port, ufcs_param_s* ufcs_param); __forceinline uint32_t Reverse32(uint32_t x) { return ((x & 0x000000ff) << 24) | ((x & 0x0000ff00) << 8) | ((x & 0x00ff0000) >> 8) | ((x & 0xff000000) >> 24); } __forceinline uint16_t byte_combine(uint8_t high_byte, uint8_t low_byte) { return (high_byte << 8) | low_byte; } /* * @brief ufcs_init_timer * @param timer * @param ufcs_param * @note * @retval NULL */ void ufcs_init_timer(uint8_t port, ufcs_timer_e timer, ufcs_param_s* ufcs_param); /* * @brief ufcs_reset_timer * @param timer * @param ufcs_param * @note * @retval NULL */ void ufcs_reset_timer(uint8_t port, ufcs_timer_e timer, ufcs_param_s* ufcs_param); /* * @brief ufcs_reset_all_timers * @param port * @param ufcs_assist * @note * @retval NULL */ void ufcs_reset_all_timers(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief ufcs_prl_reset * @param port * @param ufcs_param * @note * @retval NULL */ void ufcs_prl_reset(uint8_t port, ufcs_param_s* ufcs_param); /* * @brief ufcs_prl_run * @param port * @param ufcs_param * @note * @retval NULL */ void ufcs_prl_run(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief UFCS_HDSK_Pluse_interrupt£¨2/8/2/8 hdks interrupt£© * @param port * @param ufcs_param * @note * @retval NULL */ void UFCS_HDSK_Pluse_interrupt(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief UFCS_PRL_HDSK_Pulse_action * @param port * @param ufcs_param * @note * @retval NULL */ void UFCS_PRL_HDSK_Pulse_action(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief UFCS_PRL_HDSK_Wait_Ping_action * @param port * @param ufcs_param * @note * @retval NULL */ void UFCS_PRL_HDSK_Wait_Ping_action(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief UFCS_PRL_HDSK_RDY_action * @param port * @param ufcs_param * @note * @retval NULL */ void UFCS_PRL_HDSK_RDY_action(uint8_t port, ufcs_param_s *ufcs_param); ///* // * @brief UFCS_PRL_HR_RESET_LAYER_action // * @param ufcs_param // * @note // * @retval NULL //*/ //void UFCS_PRL_HR_RESET_LAYER_action(ufcs_param_s *ufcs_param); ///* // * @brief UFCS_PRL_HR_WAIT_HARD_RESET_COMPLETE_action // * @param ufcs_param // * @note // * @retval NULL //*/ //void UFCS_PRL_HR_WAIT_HARD_RESET_COMPLETE_action(ufcs_param_s *ufcs_param); /* * @brief ufcs_hardreset_run * @param ufcs_param * @note * @retval NULL */ void ufcs_hardreset_run(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief UFCS_PRL_Rx_Wait_for_PHY_Message_action * @param port * @param ufcs_param * @note * @retval NULL */ void UFCS_PRL_Rx_Wait_for_PHY_Message_action(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief Send_ACK_or_NCK * @param port * @param ufcs_param * @param Ctrl_comm * @param dev_type * @note * @retval NULL */ void Send_ACK_or_NCK(uint8_t port, ufcs_param_s *ufcs_param, uint8_t Ctrl_comm, uint8_t dev_type); /* * @brief UFCS_PRL_Rx_Check_CRC_action * @param port * @param ufcs_param * @note * @retval NULL */ void UFCS_PRL_Rx_Check_CRC_action(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief UFCS_PRL_Rx_Check_MsgNumber_action * @param port * @param ufcs_param * @note * @retval NULL */ void UFCS_PRL_Rx_Check_MsgNumber_action(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief ufcs_prl_analyze_header * @param port * @param ufcs_assist * @note * @retval NULL */ void ufcs_prl_analyze_header(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief UFCS_PRL_Tx_Reset_action * @param port * @param ufcs_param * @note * @retval NULL */ void UFCS_PRL_Tx_Reset_action(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief UFCS_PRL_Tx_Wait_for_Msg_Request_action * @param port * @param ufcs_param * @note * @retval NULL */ void UFCS_PRL_Tx_Wait_for_Msg_Request_action(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief UFCS_PRL_Tx_Send_Msg_action * @param port * @param ufcs_param * @note * @retval NULL */ void UFCS_PRL_Tx_Send_Msg_action(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief UFCS_PRL_Tx_Wait_Response_action * @param port * @param ufcs_param * @note * @retval NULL */ void UFCS_PRL_Tx_Wait_Response_action(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief UFCS_PRL_Tx_Check_RetryCounter_action * @param port * @param ufcs_param * @note * @retval NULL */ void UFCS_PRL_Tx_Check_RetryCounter_action(uint8_t port, ufcs_param_s *ufcs_param); //#define UFCS_RX_INT_PKT_END 0x01 //#define UFCS_RX_INT_PKT_CRC_PASS 0x02 //#define UFCS_RX_INT_PKT_CRC_FAIL 0x04 //#define UFCS_RX_INT_PKT_TYPE_ERROR 0x08 //#define UFCS_RX_INT_PKT_LEN_ERROR 0x10 //#define UFCS_RX_INT_TRANINING_ERROR 0x20 //#define UFCS_RX_INT_INFRM_TO 0x40 //#define UFCS_RX_INT_BTWFRM_TO 0x80 //#define UFCS_RX_INT_SRC_HW_RESET 0x100 /* * @brief ufcs_rx_interrupt * @param port * @param ufcs_param * @note * @retval NULL */ void ufcs_rx_interrupt(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief ufcs_tx_interrupt * @param port * @param ufcs_param * @note * @retval NULL */ void ufcs_tx_interrupt(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief ufcs_timeout_cnt_init * @param port * @param ufcs_param * @note * @retval NULL */ void ufcs_timeout_cnt_init(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief ufcs_timer_event_mgr * @param port * @param ufcs_param * @note * @retval NULL */ void ufcs_timer_event_mgr(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief ufcs_interrupt_handle * @param port * @param ufcs_param * @note * @retval NULL */ void ufcs_interrupt_handle(uint8_t port, ufcs_param_s *ufcs_param); /* * @brief ufcs_handshake_dn_hilevel_check * @param port * @param ufcs_param * @note * @retval NULL */ void ufcs_handshake_dn_hilevel_check(uint8_t port, ufcs_param_s *ufcs_param); #endif