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.
 
 
 
 

280 lines
4.2 KiB

#ifndef TASK_SCP_PHY_H
#define TASK_SCP_PHY_H
#include "drv_scp_phy.h"
#include "comp_dma.h"
/*
* @brief scp_phy_send_ping
* @param port
* @note null
* @retval null
*/
__forceinline void scp_phy_send_ping(uint8_t port)
{
if(port == 0)
{
drv_scp0_phy_send_ping();
}
else
{
drv_scp1_phy_send_ping();
}
}
/*
* @brief scp_phy_clr_tx_int_flag
* @param port
* @param flag
* @note null
* @retval null
*/
__forceinline void scp_phy_clr_tx_int_flag(uint8_t port, uint32_t flag)
{
if(port == 0)
{
drv_scp0_phy_get_tx_int_clr_flag(flag);
}
else
{
drv_scp1_phy_get_tx_int_clr_flag(flag);
}
}
/*
* @brief scp_phy_clr_rx_int_flag
* @param port
* @param flag
* @note null
* @retval null
*/
__forceinline void scp_phy_clr_rx_int_flag(uint8_t port, uint32_t flag)
{
if(port == 0)
{
drv_scp0_phy_get_rx_int_clr_flag(flag);
}
else
{
drv_scp1_phy_get_rx_int_clr_flag(flag);
}
}
/*
* @brief scp_phy_send_data_enable
* @param port
* @note null
* @retval null
*/
__forceinline void scp_phy_send_data_enable(uint8_t port)
{
if(port == 0)
{
drv_scp0_phy_send_data_enable();
}
else
{
drv_scp1_phy_send_data_enable();
}
}
/*
* @brief scp_phy_get_tx_int_flag
* @param port
* @note null
* @retval tx flag
*/
__forceinline uint16_t scp_phy_get_tx_int_flag(uint8_t port)
{
if(port == 0)
{
return drv_scp0_phy_get_tx_int_flag();
}
else
{
return drv_scp1_phy_get_tx_int_flag();
}
}
/*
* @brief scp_phy_get_rx_int_flag
* @param port
* @note null
* @retval tx flag
*/
__forceinline uint16_t scp_phy_get_rx_int_flag(uint8_t port)
{
if(port == 0)
{
return drv_scp0_phy_get_rx_int_flag();
}
else
{
return drv_scp1_phy_get_rx_int_flag();
}
}
/*
* @brief scp_phy_rx_data
* @param port
* @note null
* @retval scp rx data
*/
__forceinline uint8_t scp_phy_rx_data(uint8_t port)
{
if(port == 0)
{
return drv_scp0_phy_rx_data();
}
else
{
return drv_scp1_phy_rx_data();
}
}
/*
* @brief scp_phy_tx_data
* @param port
* @param data
* @note null
* @retval null
*/
__forceinline void scp_phy_tx_data(uint8_t port, uint8_t data)
{
if(port == 0)
{
drv_scp0_phy_send_data(data);
}
else
{
drv_scp1_phy_send_data(data);
}
}
/*
* @brief scp_dma_done_clr
* @param port
* @param chn_index
* @note null
* @retval null
*/
__forceinline void scp_dma_done_clr(uint8_t port, uint8_t chn_index)
{
if(port == 0)
{
drv_dma0_done_clr(chn_index);
}
else
{
drv_dma1_done_clr(chn_index);
}
}
/*
* @brief scp_dma_done_clr
* @param port
* @param en
* @note null
* @retval null
*/
__forceinline void scp_phy_afc_mode_set(uint8_t port, bool en)
{
if(port == 0)
{
REG_SCP_CFG->bf.afc_mode = en;
}
else
{
REG_SCP1_CFG->bf.afc_mode = en;
}
}
/*
* @brief scp_dma_done_clr
* @param port
* @note null
* @retval null
*/
void scp_phy_disable(uint8_t port);
/*
* @brief scp_phy_reg_init
* @param port
* @note null
* @retval null
*/
void scp_phy_reg_init(uint8_t port);
/*
* @brief scp_send_pkt
* @param port
* @note null
* @retval null
*/
void scp_send_pkt(uint8_t port, uint8_t *buffer, uint8_t len);
/*
* @brief scp_phy_logic_reset
* @param port
* @param en
* @note null
* @retval null
*/
void scp_phy_logic_reset(uint8_t port, bool en);
/*
* @brief scp_phy_is_crc_ok
* @param port
* @note null
* @retval 1:OK,0:fail
*/
uint8_t get_scp_phy_is_crc_ok(uint8_t port);
/*
* @brief scp_phy_afc_mode_get
* @param port
* @note null
* @retval 1:afc_mode 0:not
*/
bool scp_phy_afc_mode_get(uint8_t port);
/*
* @brief get_scp_rx_size
* @param port
* @note null
* @retval rcv num
*/
uint8_t get_scp_rx_size(uint8_t port);
/*
* @brief scp_phy_rx_int_all_mask
* @param port
* @note null
* @retval rcv num
*/
void scp_phy_rx_int_all_mask(uint8_t port);
/*
* @brief scp_phy_enable
* @param port
* @note null
* @retval null
*/
void scp_phy_enable(uint8_t port);
#endif