/**
 * @file hv_drv_Physical.c
 * @brief Phy模块提供的驱动层
 * @details 该模块接口提供给Hiview-Middle-Ware及其他上层应用使用。
 * @author HiView SoC Software Team
 * @version 0.0.1
 * @date 20220822
 * @copyright Copyright(c),2022-8, Hiview Software. All rights reserved.
 * @par History: 
 * <table>
 * <tr><th>作者                       <th>日期              <th>描述
 * <tr><td>HiView SoC Software Team <td>20220822        <td>Create and first Version.
 * </table>
**/
#include "hv_comm_Assert.h"
#include "hv_comm_Define.h"
#include "hv_drv_Physical.h"
#include "hv_cal_Physical.h"
#include "hv_cal_PLL.h"

#define RX_PHY_MAPPING 36

Status Hv_Drv_Phy_SetRxMapping(UCHAR8 ucPortIndex)
{
    return Hv_Cal_Phy_SetRxMapping(ucPortIndex, RX_PHY_MAPPING);
}

Status Hv_Drv_Phy_Init(VOID)
{
#ifdef CONFIG_USER_DOUBLE_CHANNEL_ON
    UCHAR8 ucChannelNum = 2;
#else
    UCHAR8 ucChannelNum = 1;
#endif
    for (UCHAR8 ucChannelType = 0; ucChannelType < ucChannelNum; ucChannelType++)
    {
        HV_ASSERT_SUCCESS(Hv_Cal_Phy_HsrxInit(ucChannelType));
        HV_ASSERT_SUCCESS(Hv_Cal_Phy_DisableRxMapping(ucChannelType));
    }

    HV_ASSERT_SUCCESS(Hv_Cal_Phy_AnalogInit());
    HV_ASSERT_SUCCESS(Hv_Cal_Phy_DigitalInit());

    return HV_SUCCESS;
}
