// +FHDR------------------------------------------------------------
//                 Copyright (c) 2022 SmartLogic.
//                       ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename      : phy_init.c
// Author        : xianfeng.du
// Created On    : 2022-09-07
// Last Modified :
// -----------------------------------------------------------------
// Description:
// ape phy_init
//
// -FHDR------------------------------------------------------------

#include <typedef.h>
#include "ucp_printf.h"
#include "stc_timer.h"
#include "phy_para.h"
#include "ucp_utility.h"
#include "pet_sm_mgt.h"
#include "osp_init.h"

void soc_drv_init(void)
{
    int apeId = get_core_id();
    if (0 == apeId)
    {
        pet_sm_init();

        osp_var_init();

        SET_CLK_CFG_EMU();
        UCP_PRINT_EMPTY("sys clock init.\r\n");

        //phy_para_init(PROTOCOL_NULL, PROTO_OPTION_NULL);
#ifdef DISTRIBUTED_BS
        phy_para_init(PROTOCOL_CPRI, CPRI_OPTION_8);
#endif
#ifdef INTEGRATED_BS
        phy_para_init(PROTOCOL_JESD, PROTO_OPTION_NULL);
#endif
        UCP_PRINT_EMPTY("phy para init.\r\n");

        ape_stc_init();

        UCP_PRINT_EMPTY("stc timer init. \r\n");

    }
}

void tod_int_init(void)
{
    int apeId = get_core_id();
    if (0 == apeId)
    {
        stc_timer_todint_init();
        UCP_PRINT_EMPTY("stc tod int init. \r\n");
    }

    return;
}

#ifdef TEST_ENABLE
void ape_test_task_reg(void);
#endif

void phy_init(void)
{
#ifdef TEST_ENABLE
    ape_test_task_reg();
#endif
    return;
}

