Exemplo n.º 1
0
void cpuidle_idle_management(void)
{
     /* go deepsleep if it's registed, else enter idle*/
     unsigned int ret = 1;
     unsigned long flags = 0;
     unsigned int oldslice =0;
     unsigned int newslice =0;
	 
     /* coverity[lock_acquire] */
     local_irq_save(flags);
     
     /*获取进入低功耗的时间*/
     oldslice = bsp_get_slice_value();
    /*lint --e{18,718,746}*/
     if(0 == has_wake_lock(0)){
             if(idle_go_deepsleep)
                    ret = idle_go_deepsleep();/*lint !e732*/
             update_awake_time_stamp();
     }else {
              check_awake_time_limit();
     }
     if(ret)
              hi6930_enter_idle();
        
	 /*获取退出WFI的时间*/
     newslice = bsp_get_slice_value();

     g_ulDfsCcpuIdleTime  += get_timer_slice_delta(oldslice, newslice);
     g_ulDfsCcpuIdleTime_long += get_timer_slice_delta(oldslice, newslice);
	 
     local_irq_restore(flags);
     return;
}
Exemplo n.º 2
0
u32 nv_test_make_check_ddr_crc(void)
{
    u32 ret = 0;
    u32 startSlice = 0;
    u32 endSlice = 0;
    u32 i = 0;

    printf("*****************CRC mark = 0x%x******************\n",NV_CRC_CHECK_YES);
    startSlice = bsp_get_slice_value();
    for(i = 0; i < 100; i++)
    {
        printf("\n****************第%d次生成CRC开始**************************\n", i);
        ret = nv_make_ddr_crc();
        if(ret)
        {
            printf("[%s]: ret = 0x%x\n",__func__,ret);
            return ret;
        }
        ret = nv_check_ddr_crc();
        if(ret)
        {
            printf("[%s]: ret = 0x%x\n",__func__,ret);
            return ret;
        }
    }
    endSlice = bsp_get_slice_value();
    printf("*****************CRC mark = 0x%x******************\n",NV_CRC_CHECK_YES);
    printf("[%s]: Slice:0x%x\n",__func__,endSlice-startSlice);
    return NV_OK;
}
/*****************************************************************************
 函数    : bsp_rffe_cfg_in_power_on
 功能    : 开机时mipi和线控配置
 输入    : 无
 输出    : 无
 返回     : mipi配置是否成功,0为成功,1为失败
*****************************************************************************/
int bsp_rffe_cfg_on_power_up(PWC_COMM_MODE_E mode, PWC_COMM_MODEM_E modem, PWC_COMM_CHANNEL_E chn)
{
    unsigned int  vote_bit = 0;
    unsigned int  first_on = 0;
    int           ret      = 0;

    vote_bit = RF_PWR_MODE_NUM*modem + mode;

    /*依赖fem的供电,所以使用其信号量*/
    osl_sem_down(&rf_pwr_sem[SEM_FEM]);

    first_on = !rffe_cfg.vote[chn];
    rffe_cfg.vote[chn] |= (u64)1 << vote_bit;
    if(first_on){
        ret  = balong_rf_config_by_mipi_modem_on((u32)chn);
        ret |= balong_rf_config_anten_poweron((u32)chn);

        rffe_cfg.true_pwron_cnt[chn]++;
        rffe_cfg.true_pwron_time_stamp[chn] = bsp_get_slice_value();
    }
    rffe_cfg.pwron_cnt[chn]++;
    rffe_cfg.pwron_time_stamp[chn] = bsp_get_slice_value();

    osl_sem_up(&rf_pwr_sem[SEM_FEM]);

    return ret;
}
void hi_bbp_int_wakeup_tds_clear(void)
{
    unsigned long bbp_flag = 0;
    u32 reg_base = g_bbpinfo.part[BBP_TDRX].reg_base;
    u32 int_status;
    unsigned int    time_stamp;
    unsigned int    new_slice;

    /* IPC锁为归避bbp_on 连读问题,单号2013121200228*/
    bbp_ipc_spin_lock_irqsave(IPC_SEM_BBP,bbp_flag);
    /*清除wake up 中断*/
    /*hi_bbp_int_tdswp_clear();*/
    bbp_bit_set((reg_base + HI_BBP_TDSDRX_ARM_SLEEP_INT_CLEAR_OFFSET),(0x1 << 1));
    time_stamp = bsp_get_slice_value();
    do{
        /*int_status = hi_bbp_int_tdswp_status();*/
        int_status = bbp_bit_chk((reg_base + HI_BBP_TDSDRX_ARM_INT_STATE_OFFSET),(0x1 << 1));
        new_slice = bsp_get_slice_value();
        /*归避bbp_on 连读问题,单号2013121200228*/
        hi_bbp_drxbug_evade();
    }while((int_status != 0)&&(get_timer_slice_delta(time_stamp, new_slice) < WAKEUP_INT_CLEAR_TIMEOUT));
    if(int_status != 0){
        bbp_print_error("wakeup tds int cannot clear!\n");
    }
    bbp_ipc_spin_unlock_irqrestore(IPC_SEM_BBP,bbp_flag);

    return;
}
s32 bsp_ipc_spin_lock_timeout(u32 u32SignalNum, u32 TimeoutMs)
{
	u32 u32HsCtrl = 0;
	u32 start_time = 0, end_time = 0, elapsed = 0;
	IPC_CHECK_PARA(u32SignalNum,IPC_SEM_BUTTOM);

	start_time = bsp_get_slice_value();
	elapsed = TimeoutMs * bsp_get_slice_freq() / 1000; /*lint !e647 */

	/* coverity[no_escape] */
	for(;;)
	{
		u32HsCtrl = readl(ipc_ctrl.ipc_base[IPCM_NS] + BSP_IPC_HS_CTRL(ipc_ctrl.core_num, u32SignalNum));
		if (0 == u32HsCtrl)
		{
			ipc_debug.u32SemTakeTimes[u32SignalNum]++;
			ipc_debug.u32SemId = u32SignalNum;
			break;
		}

		end_time = bsp_get_slice_value();
		if(get_timer_slice_delta(start_time, end_time) > elapsed)
		{
			ipc_debug.u32SemCore = readl(ipc_ctrl.ipc_base[IPCM_NS] + BSP_IPC_HS_STAT(ipc_ctrl.core_num, u32SignalNum));
			return MDRV_ERROR;
		}
	}
	return MDRV_OK;
}
void socp_debug_CountStore(char* p,int len)
{
    /* [false alarm]:alarm */
    char path[128];
    /* [false alarm]:alarm */
    int fd = -1;
    /* [false alarm]:alarm */
    int ret;


    Socp_Memset(path,0,sizeof(path));

#if defined(__OS_RTOSCK__)
    (void)sprintf_s(path,128,"%s%s%d.bin",SOCP_ROOT_PATH,p,bsp_get_slice_value());
#else
    snprintf(path,128,"%s%s%d.bin",SOCP_ROOT_PATH,p,bsp_get_slice_value());
#endif
    /* [false alarm]:alarm */
    fd = bsp_open((s8*)path, RFILE_RDWR|RFILE_CREAT, 0660);
    /* [false alarm]:alarm */
    if(fd<0){
        socp_printf("create %s error,save failed!\n",path);
        return;
    }
    /* [false alarm]:alarm */
    ret = bsp_write((u32)fd,(s8*)&g_stSocpDebugInfo,sizeof(g_stSocpDebugInfo));
    /* [false alarm]:alarm */
    if(ret != (int)sizeof(g_stSocpDebugInfo)){
        socp_printf("write %s error,save failed!\n",path);
        (void)bsp_close((u32)fd);
        return;
    }
    (void)bsp_close((u32)fd);
    return;
}
int bsp_abb_tv230_init(u32 abb_version, u32 *is_supported)
{
    u32 value = 0;
    u32 is_timeout = 0;
    u32 start_stamp = 0;

    if (COMSTARTV230 != abb_version)
        return 0;

    if (is_supported)
        *is_supported = 1;

    /* reset VREF*/
    bsp_abb_write(0x88C, 0x02);
    udelay(1);
    bsp_abb_write(0x88C, 0x00);

    /* start ABB calibration */
    bsp_abb_write(0x88C, 0x00);
    bsp_abb_write(0x88C, 0x01);
    start_stamp = bsp_get_slice_value();
    do {
        bsp_abb_read(0x894, &value);
        if (get_timer_slice_delta(start_stamp, bsp_get_slice_value()) > 6) {
            is_timeout = 1;
            break;
        }
    }while (!(value & 0x10));

    if (is_timeout)
        value = 0x40;
    else
        bsp_abb_read(0x895, &value);

    bsp_abb_write(0xC5C, value);
    bsp_abb_write(0xCDC, value);
    bsp_abb_write(0xD5C, value);

    bsp_abb_tv230_init_later();

    if (!g_abb_inited) {
        spin_lock_init(&g_abb_tv230_spin_lock);
        g_abb_ops.abb_suspend       = bsp_abb_tv230_suspend;
        g_abb_ops.abb_resume        = bsp_abb_tv230_resume;
        g_abb_ops.abb_power_up      = bsp_abb_tv230_power_up;
        g_abb_ops.abb_power_down    = bsp_abb_tv230_power_down;
        g_abb_ops.abb_power_status  = bsp_abb_tv230_power_status;
        g_abb_ops.abb_pll_enable    = bsp_abb_tv230_pll_enable;
        g_abb_ops.abb_pll_disable   = bsp_abb_tv230_pll_disable;
        g_abb_ops.abb_pll_status    = bsp_abb_tv230_pll_status;
    }

    return 0;
}
Exemplo n.º 8
0
void DelayMs(u32 delay_ms, u32 flag)
{
    u32 oldtime = 0;
    u32 newtime = 0;

    oldtime = bsp_get_slice_value();
    newtime = bsp_get_slice_value();
    while((oldtime + delay_ms*32) >  newtime)
    {
        newtime = bsp_get_slice_value();
    }
}
int bsp_abb_resume(struct dpm_device *dev)
{
    int ret = 0;

    writel(bsp_get_slice_value(), (u32)&g_abb_ops.abb_om->resume_start_stamp);

    if (g_abb_inited)
        ret = g_abb_ops.abb_resume(dev);
    else
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ABB, "ABB init fail\n");

    writel(bsp_get_slice_value(), (u32)&g_abb_ops.abb_om->resume_end_stamp);

    return ret;
}
static void  pwrctrl_dfs_mgrmsg_task(void)
{
    int cur_profile = 0;
    unsigned int flowctrl_cpuload = 0;
    PWRCTRLFUNCPTR pRoutine = NULL;
    struct cpufreq_msg task_msg = {0,0,0,0};
	g_stDfsCpuControl.ulStartTime = bsp_get_slice_value();
	/* coverity[INFINITE_LOOP] */
	/* coverity[no_escape] */
    for (;;)
    {
		if (NULL != g_sem_calccpu_flag)
		{	
			semTake(g_sem_calccpu_flag, DFS_WAIT_FOREVER);
			 /*调用ttf回调函数*/
		    if ((NULL != FlowCtrlCallBack) && (g_flowctrl_in_interr_times >= 200))
		    {
		    	 flowctrl_cpuload = cpufreq_calccpu_cpuload();
		        pRoutine = FlowCtrlCallBack;
		        (void)(*pRoutine)(flowctrl_cpuload);
		    }
		}
		else
		{
			taskDelay((int)g_stDfsCpuConfigInfo.ulTimerLen);
			g_calccpu_load_result = cpufreq_calccpu_result(&g_next_freq);
		}
		if (!g_cpufreq_lock_status_flag)
		{
			continue;
		}
		
		cur_profile = pwrctrl_dfs_get_profile();
		cpufreq_assistant_regulate_ddr(cur_profile);
		if (DFS_PROFILE_NOCHANGE != g_calccpu_load_result)
		{
			if (g_icc_run_flag == 1)
			{
				task_msg.msg_type = CPUFREQ_ADJUST_FREQ;
				task_msg.source = CPUFREQ_CCORE;
				task_msg.content = g_calccpu_load_result;
				if (DFS_PROFILE_UP_TARGET == g_calccpu_load_result)
				{
					cur_profile = DC_RESV;
				}
				else if ((u32)cur_profile == CPUFREQ_MIN_PROFILE_LIMIT)
				{
					continue;
				}
				task_msg.profile = (unsigned int)cur_profile - 1;
				balong_cpufreq_icc_send(&task_msg);
			}
			else if (g_icc_run_flag == 2)
			{
				cpufreq_excute_result_cpu(g_calccpu_load_result, g_next_freq);
			}
        }

    }
}
Exemplo n.º 11
0
u32 nv_test_check_ddr_crc_once(void)
{
    u32 ret = 0;
    u32 startSlice = 0;
    u32 endSlice = 0;

    startSlice = bsp_get_slice_value();
    ret = nv_check_ddr_crc();
    endSlice = bsp_get_slice_value();
    if(ret)
    {
        printf("[%s]: ret = 0x%x\n",__func__,ret);
        return ret;
    }
    printf("[%s]: Slice:0x%x\n",__func__,endSlice-startSlice);
    return NV_OK;
}
Exemplo n.º 12
0
void timer_disable_stamp_dbg(u32 clkid)
{
	struct adp_timer_enable_dbg *pstEnable_dbg = &adp_timer_ctrl[clkid].stEnable;
	pstEnable_dbg->disable_slice[pstEnable_dbg->enable_cnt] = bsp_get_slice_value();
	pstEnable_dbg->enable_cnt++;
	if (pstEnable_dbg->enable_cnt >=ADP_TIMER_ENABLE_TIMES)
		 pstEnable_dbg->enable_cnt = 0;
}
static inline void wakelock_dump_log_record(enum lock_enum type,struct wake_lock *lock){
     record->stamp= bsp_get_slice_value();
     record->lock_id = lock->lockid - PWRCTRL_SLEEP_BEGIN;
     record->lock_type = (u32)type;
     record->cur_task_id= osl_task_self();
     record->lock_state = has_wakelock;
     (void)bsp_pm_log_type(PM_OM_WAKE,0,sizeof(struct wakelock_om_s),(void*)record);
}
Exemplo n.º 14
0
u32 nv_test_sem_func(void)
{
    u32 start = 0;
    u32 end = 0;
    if(0 == nv_sem_ctrl)
    {
        osl_sem_init(0,&nv_test_sem);
        nv_sem_ctrl = 1;
    }

    start = bsp_get_slice_value();
    if(osl_sem_downtimeout(&nv_test_sem, 10))
    {
        end = bsp_get_slice_value();
    }
    nv_printf("slice: 0x%x\n", end - start);
    return 0;
}
Exemplo n.º 15
0
void timer_callback_stamp_dbg(u32 clkid)
{
	struct adp_timer_callback_dbg *pstCallback_dbg = &adp_timer_ctrl[clkid].stCallback;
	pstCallback_dbg->callback_slice[pstCallback_dbg->callback_slice_cnt] = bsp_get_slice_value();
	pstCallback_dbg->callback_slice_cnt++;
	if (pstCallback_dbg->callback_slice_cnt >= ADP_TIMER_CALLBACK_TIMES)
	{
		pstCallback_dbg->callback_slice_cnt = 0;
	}
}
Exemplo n.º 16
0
void fem_io_debuginfo_add(void* caller,u32 para1,u32 para2,u32 para3,int ret)
{
    u32 i = para1%FEM_IO_CFG_MAX;
    g_femio_debug[i].caller_addr = (u32) caller;
    g_femio_debug[i].para1       = para1;
    g_femio_debug[i].para2       = para2;
    g_femio_debug[i].para3       = para3;
    g_femio_debug[i].timestamp   = bsp_get_slice_value();
    g_femio_debug[i].ret         = ret;
}
Exemplo n.º 17
0
static void timer_callback_stamp_dbg(struct adp_timer_control* pAdp_timer_ctrl)
{
	struct adp_timer_callback_dbg *pstCallback_dbg = &pAdp_timer_ctrl->stCallback;
	pstCallback_dbg->callback_slice[pstCallback_dbg->callback_slice_cnt] = bsp_get_slice_value();
	pstCallback_dbg->callback_slice_cnt++;
	if (pstCallback_dbg->callback_slice_cnt >= ADP_TIMER_CALLBACK_TIMES)
	{
		pstCallback_dbg->callback_slice_cnt = 0;
	}
}
u32 om_timer_tick_get(void)
{
    u32 omTimerValue;
    /*lint -save -e958*/
	u64 omTick;

	omTimerValue = bsp_get_slice_value();
	omTick=((unsigned long long)omTimerValue*100)>>(15);
    /*lint -restore*/
	return (UINT32)omTick;
}
Exemplo n.º 19
0
void timer_get_stamp_dbg(u32 clkid, u32 curtime)
{
	struct adp_timer_get_dbg *pstGet_dbg = &adp_timer_ctrl[clkid].stGet;
	pstGet_dbg->get_times[pstGet_dbg->get_cnt][0]= bsp_get_slice_value();
	pstGet_dbg->get_times[pstGet_dbg->get_cnt][1]= curtime;
	pstGet_dbg->get_cnt++;
	if (pstGet_dbg->get_cnt >= ADP_TIMER_GET_TIMES)
	{
	   	pstGet_dbg->get_cnt = 0;
	}
}
Exemplo n.º 20
0
u32 nv_function_test(void)
{
    u32 i;
    u32 ret;
    struct nv_ctrl_file_info_stru* ctrl_info = (struct nv_ctrl_file_info_stru*)NV_GLOBAL_CTRL_INFO_ADDR;
    struct nv_ref_data_info_stru* ref_info   = (struct nv_ref_data_info_stru*)(NV_GLOBAL_CTRL_INFO_ADDR+NV_GLOBAL_CTRL_INFO_SIZE\
        +NV_GLOBAL_FILE_ELEMENT_SIZE*ctrl_info->file_num);
    u8* pdata;
    u32 start,end;


    start = bsp_get_slice_value();

    pdata = (u8*)nv_malloc(3072);
    if(NULL == pdata)
    {
        return NV_ERROR;
    }
    for(i = 0;i<100;i++)
    {
        printf("*****************read & write 0x%x****************\n",ref_info->itemid);
        ret = bsp_nvm_read(ref_info->itemid,pdata,ref_info->nv_len);
        if(ret)
        {
            nv_free(pdata);
            return ret;
        }
        ret = bsp_nvm_write(ref_info->itemid,pdata,ref_info->nv_len);
        if(ret)
        {
            nv_free(pdata);
            return ret;
        }
        ref_info++;
    }
    end = bsp_get_slice_value();
    nv_free(pdata);

    printf("[%s]:slice 0x%x\n",__func__,end-start);
    return NV_OK;
}
/*resume*/
int bsp_rf_resume_early(struct dpm_device *dev)
{
    int ret = 0;

    ret  = balong_rf_power_resume();
    if(ret){
        rf_print_error("rffe power resume error!ret %d\n",ret);
    }

    rffe_cfg.resume_time_stamp = bsp_get_slice_value();
    return ret;
}
/*suspend*/
int bsp_rf_suspend_late(struct dpm_device *dev)
{
    int ret = 0;

    ret = balong_rf_power_suspend();
    if(ret){
        rf_print_error("rffe power suspend error!ret is %d\n",ret);
    }

    rffe_cfg.suspend_late_timestamp = bsp_get_slice_value();
    return ret;
}
Exemplo n.º 23
0
void debug_tcxo_function(PWC_COMM_MODEM_E  tcxoId, PWC_COMM_MODE_E enModeType)
{
    int ret = 0;/* [false alarm]:误报 */
    ret = bsp_tcxo_disable(tcxoId, enModeType);
    ret = bsp_tcxo_getstatus(tcxoId);
    adp_dpm_printf("tcxoID:%d,status = 0x%x\n", tcxoId, ret);/* [false alarm]:误报 */
    ret = bsp_tcxo_enable(tcxoId, enModeType);/* [false alarm]:误报 */
    ret = bsp_tcxo_timer_start(tcxoId, enModeType, (PWC_TCXO_FUNCPTR)debug_timer_callback, 0, 3);
    adp_dpm_printf("timer stamp 1 = %d\n", bsp_get_slice_value());
    ret = bsp_tcxo_getstatus(tcxoId);
    adp_dpm_printf("tcxoID:%d,status = 0x%x\n", tcxoId, ret);
}
OSL_IRQ_FUNC(static irqreturn_t,ipc_int_handler,irq,arg)
{
	u32 i = 0;
	u32 u32IntStat = 0,begin = 0,end = 0;
	u32 u32Date = 0x1;
	u32 u32BitValue = 0;
	u32 n = (u32)(unsigned long)arg;

	u32IntStat=readl(ipc_ctrl.ipc_base[n] + BSP_IPC_CPU_INT_STAT(ipc_ctrl.core_num));
	/*清中断*/
	writel(u32IntStat,ipc_ctrl.ipc_base[n] + BSP_IPC_CPU_INT_CLR(ipc_ctrl.core_num));
	/* 遍历32个中断 */
	for (i = n*INTSRC_NUM; i < INTSRC_NUM*(n+1) ; i++)
	{
		if(n*INTSRC_NUM!=i)
		{
			u32Date <<= 1;
		}
		u32BitValue = u32IntStat & u32Date;
		/* 如果有中断 ,则调用对应中断处理函数 */
		if (0 != u32BitValue)
		{
			/*调用注册的中断处理函数*/
			if (NULL !=  ipc_ctrl.ipc_int_table[i].routine)
			{
				begin = bsp_get_slice_value();
				ipc_ctrl.last_int_cb_addr = (unsigned long)(ipc_ctrl.ipc_int_table[i].routine);
				ipc_ctrl.ipc_int_table[i].routine(ipc_ctrl.ipc_int_table[i].arg);
				end = bsp_get_slice_value();
				ipc_debug.u32IntTimeDelta[i] = get_timer_slice_delta(begin,end);
			}
			else
			{
				bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"BSP_DRV_IpcIntHandler:No IntConnect,MDRV_ERROR!.int num =%d\n",i);
			}
			ipc_debug.u32IntHandleTimes[i]++;
		}
	}
	return IRQ_HANDLED;
}
int bsp_abb_tv230_pll_disable(PWC_COMM_MODE_E enCommMode, PWC_COMM_MODEM_E enModemId, PWC_COMM_CHANNEL_E enChannel)
{
    unsigned long flags = 0;

    spin_lock_irqsave(&g_abb_tv230_spin_lock, flags);

    if ((enCommMode == PWC_COMM_MODE_GSM) || (enCommMode == PWC_COMM_MODE_REMOTE_CLK_G)) {
        bsp_abb_tv230_g_pll_vote &= ~(0x01U << (u32)enModemId);

        if (!bsp_abb_tv230_g_pll_vote)
            bsp_abb_tv230_g_pll_ctrl(0);

        writel(bsp_abb_tv230_g_pll_vote, (u32)&g_abb_ops.abb_om->gpll_vote);

        writel(bsp_get_slice_value(), (u32)&g_abb_ops.abb_om->gpll_disable_stamp);
    } else if ((enCommMode == PWC_COMM_MODE_CDMA_1X) || (enCommMode == PWC_COMM_MODE_CDMA_HRPD)) {
        bsp_abb_tv230_sc_pll_vote[1] &= ~(0x01U << (u32)enCommMode);

        if (!bsp_abb_tv230_sc_pll_vote[1])
            bsp_abb_tv230_sc_pll_ctrl(1, 0);

        writel(bsp_abb_tv230_sc_pll_vote[0] | bsp_abb_tv230_sc_pll_vote[1] << 16U, (u32)&g_abb_ops.abb_om->scpll_vote);

        writel(bsp_get_slice_value(), (u32)&g_abb_ops.abb_om->scpll_disable_stamp);
    } else {
        bsp_abb_tv230_sc_pll_vote[0] &= ~(0x01U << (u32)enCommMode);

        if (!bsp_abb_tv230_sc_pll_vote[0])
            bsp_abb_tv230_sc_pll_ctrl(0, 0);

        writel(bsp_abb_tv230_sc_pll_vote[0] | bsp_abb_tv230_sc_pll_vote[1] << 16U, (u32)&g_abb_ops.abb_om->scpll_vote);

        writel(bsp_get_slice_value(), (u32)&g_abb_ops.abb_om->scpll_disable_stamp);
    }

    spin_unlock_irqrestore(&g_abb_tv230_spin_lock, flags);

    return 0;
}
void modem_reset_do_work(struct work_struct *work)
{
	reset_print_debug("\n");
	g_modem_reset_ctrl.exec_time = bsp_get_slice_value();
	if (1 == g_modem_reset_ctrl.in_suspend_state)
	{
		if (!wait_for_completion_timeout(&(g_modem_reset_ctrl.suspend_completion), HZ*10))
		{
			machine_restart("system halt"); /* 调systemError */
			return;
		}
	}
	reset_prepare(MODEM_RESET);
}
u32 bsp_get_elapse_ms(void)
{
	u64 tmp=0;
	unsigned long timer_get = 0;
	if(timeslice_ctrl.is_inited_flag ){
		timer_get = bsp_get_slice_value();
		tmp = (u64)(timer_get & 0xFFFFFFFF);
		tmp = tmp*1000;
		tmp = div_u64(tmp,timeslice_ctrl.slice_clock_freq);
		return (u32)tmp;
	}
	else
		return 0;
}
/*****************************************************************************
 函数    : bsp_rffe_cfg_on_power_down
 功能    : 开机时mipi和线控配置
 输入    : 无
 输出    : 无
 返回     : mipi配置是否成功,0为成功,1为失败
*****************************************************************************/
int bsp_rffe_cfg_on_power_down(PWC_COMM_MODE_E mode, PWC_COMM_MODEM_E modem, PWC_COMM_CHANNEL_E chn)
{
    u64  cur_state  = 0;
    u32  vote_bit   = 0;
    int  ret        = 0;
    int  power_flag = 0;

    vote_bit = RF_PWR_MODE_NUM * modem + mode;

    osl_sem_down(&rf_pwr_sem[SEM_FEM]);

    cur_state      = rffe_cfg.vote[chn];
    rffe_cfg.vote[chn] &= ~((u64)1 << vote_bit);

    if((0 == rffe_cfg.vote[chn]) && cur_state){
        ret = balong_rf_config_by_mipi_modem_off(chn);
        ret |= balong_rf_config_anten_poweroff(chn);

        rffe_cfg.true_pwroff_cnt[chn]++;
        rffe_cfg.true_pwroff_time_stamp[chn] = bsp_get_slice_value();
    }

    power_flag = balong_fem_power_status(mode,modem, chn);
    if(!power_flag){
        ret  = balong_rf_config_by_mipi_allmodem_off();
        ret |= balong_rf_config_anten_allpoweroff();
        rffe_cfg.true_alloff_cnt++;
        rffe_cfg.true_alloff_time_stamp = bsp_get_slice_value();
    }
    rffe_cfg.pwroff_cnt[chn]++;
    rffe_cfg.pwroff_time_stamp[chn] = bsp_get_slice_value();

    osl_sem_up(&rf_pwr_sem[SEM_FEM]);

    return ret;

}
void socp_debug_RegStore(void)
{
    /* [false alarm]:alarm */
    char path[128];
    /* [false alarm]:alarm */
    char p[] = "Reg_";
    /* [false alarm]:alarm */
    int fd = -1;
    /* [false alarm]:alarm */
    int ret;


    Socp_Memset(path,0,sizeof(path));

#if defined(__OS_RTOSCK__)
    (void)sprintf_s(path,128,"%s%s%d.bin",SOCP_ROOT_PATH,p,bsp_get_slice_value());
#else
    snprintf(path,128,"%s%s%d.bin",SOCP_ROOT_PATH,p,bsp_get_slice_value());
#endif
    /* [false alarm]:alarm */
    fd = bsp_open((s8*)path, RFILE_RDWR|RFILE_CREAT, 0660);
    /* [false alarm]:alarm */
    if(fd<0){
        socp_printf("create %s error,save failed!\n",path);
        return;
    }
    /* [false alarm]:alarm */
    ret = bsp_write((u32)fd,(s8*)g_strSocpStat.baseAddr,4096);
    /* [false alarm]:alarm */
    if(ret != (int)4096){
        socp_printf("write %s error | 0x%x,save failed!\n",path,ret);
        (void)bsp_close((u32)fd);
        return;
    }
    (void)bsp_close((u32)fd);
    return;
}
/*此函数用于使能pastar */
void pastar_resume_early(void)
{
	u32 *debug_mask_pastar = (u32 *)SRAM_PASTAR_DPM_INFO + PASTAR_DPM_SUSPEND_MASK_OFFSET;
	u32 *time_stamp = (u32 *)(SRAM_PASTAR_DPM_INFO + PASTAR_DPM_EN_TIMESTAMP_OFFSET);

	/*判断pastar是否关闭过smart star LVS5*/
	if(*debug_mask_pastar & 0x1){

		LSW_ENABLE(LSW53);
		
		/*记录smart star LVS5使能的时刻点*/
		*time_stamp = bsp_get_slice_value();
	}
	return;
}