Exemplo n.º 1
0
int bsp_i2c_debug(void)
{
	int i = 0;	
	int count = 0;
	unsigned int clk0 = 0;
	unsigned int clk1 = 0;

	bsp_i2c_initial();
#ifdef HI_I2C1_REGBASE_ADDR
	clk0 = get_hi_crg_clkstat1_i2c0_clk_status();
	clk1 = get_hi_crg_clkstat1_i2c1_clk_status();
	cprintf("i2c0_clk:%d  i2c1_clk:%d\n",clk0,clk1);
#endif
	bsp_i2c_slave_register(I2C_MASTER1,TEST_SLAVE_ID);

	/*µ¥×Ö½Ú²âÊÔ£¬05¼Ä´æÆ÷Á¬Ðø¶Áд50´Î*/
	count=0;
	for(i=0;i<50;i++){
		
		if(I2C_TEST_PASS!=debug_i2c_byte_data_send(0x05,0x8a))
		{
			count++;
			cprintf("register offset:0x05,send data:0x8a,times:%d\n\n",i);
		}
	}
	cprintf("test count:%d times,success %d times\n\n",i,i-count);

	/*µ¥×Ö½Ú²âÊÔ£¬02¼Ä´æÆ÷¶Áд50´Î*/
	count = 0;
	for(i=0;i<50;i++){
		if(I2C_TEST_PASS!=debug_i2c_byte_data_send(0x2,0x8a))
		{
			count++;
			cprintf("register offset:%x,send data:0x8a\n",i);
		}
	}

	cprintf("\ntest count:%d times,success %d times\n\n",i,i-count);


	/*Ë«×Ö½Ú²âÊÔ£¬05¼Ä´æÆ÷¶Áд50´Î*/
	count=0;
	for(i=0;i<50;i++){
		
		if(I2C_TEST_PASS!=debug_i2c_word_data_send(0x02,0x8a8a))
		{
			count++;
			cprintf("register offset:0x05,send data:0x8a,times:%d\n\n",i);
		}
	}
	cprintf("\ntest count:%d times,success %d times\n\n",i,i-count);

	/*Ë«×Ö½Ú²âÊÔ£¬02¼Ä´æÆ÷¶Áд50´Î*/
	count = 0;
	for(i=0;i<50;i++){
		if(I2C_TEST_PASS!=debug_i2c_word_data_send(0x05,0x8a8a))
		{
			count++;
			cprintf("register offset:0x02,send data:0x8a8a\n",i);
		}
	}
	cprintf("\ntest count:%d times,success %d times\n\n",i,i-count);

	return 0;
}
Exemplo n.º 2
0
void BSP_DRV_Init()
{
#ifdef CONFIG_MODULE_VIC
    s32 ret = 0;
#endif

/***********************基础模块初始化***************************/
#ifdef CONFIG_BALONG_CCLK
    hi6930_clock_init();
#endif
#ifdef CONFIG_CCORE_PM
		 bsp_dpm_init();
#endif
#ifdef K3_TIMER_FEATURE
	k3_timer_init();
#endif
    adp_timer_init();
    timer_dpm_init();

    if(0 != BSP_UDI_Init())
        logMsg("BSP_UDI_Init fail\n",0,0,0,0,0,0);

    bsp_ipc_init();

	bsp_icc_init();

#ifdef CONFIG_K3V3_CLK_CRG /*CONFIG_K3V3_CLK_CRG*/
    gps_refclk_icc_read_cb_init();
#endif
	/* Cshell init if magic number is set to PRT_FLAG_EN_MAGIC_M */
#ifdef CONFIG_CSHELL
    if(0 != cshell_init())
    {
            logMsg("cshell init fail\n",0,0,0,0,0,0);
    }
#endif

#ifdef CONFIG_NVIM
     if(0 != bsp_nvm_init())
        logMsg("nv init fail\n",0,0,0,0,0,0);
#endif

    /* axi monitor监控初始化 */
    (void)bsp_amon_init();

	/*此初始化必须放置在MSP/OAM/PS初始化之前,请不要随意改动顺序*/
    tcxo_init_configure();

    if(0 != bsp_rfile_init())
        logMsg("rfile init fail\n",0,0,0,0,0,0);

	/* version inits */
    bsp_productinfo_init();

    hwspinlock_init();

    bsp_hkadc_init();

    bsp_version_init();
    bsp_lowpower_mntn_init();

#ifdef CONFIG_MODULE_VIC
    ret = bsp_vic_init();
    if(ret != OK)
    {
        logMsg("bsp_vic_init error\n", 0, 0, 0, 0, 0, 0);
    }
#endif

	(void)bsp_softtimer_init();

#ifdef CONFIG_BALONG_EDMA
    if(0 != bsp_edma_init())
    {
        logMsg("edma init fail \n",0,0,0,0,0,0);
    }
#endif

    /*C core init ipc module*/
    if(0 != socp_init())
        logMsg("socp init fail\n",0,0,0,0,0,0);

     if(0 != bsp_om_server_init())
        logMsg("om init fail\n",0,0,0,0,0,0);
	 if(0 != bsp_dual_modem_init())
	     logMsg("dual modem uart init fail\n",0,0,0,0,0,0);

/***********************外设模块初始化***************************/
    bsp_dsp_init();

#ifdef CONFIG_BBP_INT
	bbp_int_init();/*此处需要放在dsp初始化之后,放在pastar/abb之前*/
#endif

    bsp_spi_init();
    bsp_pmu_init();
	regulator_init();

#if defined(CONFIG_PMIC_HI6559)
    if(bsp_pa_rf_init())   /* 依赖于regulator_init */
    {
        logMsg("bsp_pa_rf_init fail\n",0,0,0,0,0,0);
    }
#endif

	/*init mipi*/
#ifdef CONFIG_MIPI
	bsp_mipi_init();
#endif

#ifdef CONFIG_TUNER
    bsp_tuner_init();
#endif

#ifdef CONFIG_PASTAR
	/*此函数的位置不可以向后移动,为pastar上电后,提供足够的稳定时间*/
    pmu_hi6561_init_phase1();
#endif

     if(0 != hi6930_wdt_init())
        logMsg("wdt init fail\n",0,0,0,0,0,0);

#ifdef CONFIG_CCORE_I2C

	if(0!=bsp_i2c_initial())
		logMsg("i2c init fail\n",0,0,0,0,0,0);
#endif


    if(0 != bsp_gpio_init())
        logMsg("gpio init fail\n",0,0,0,0,0,0);
#ifdef CONFIG_EFUSE
	if(0 != efuse_init())
	{
		logMsg("efuse init fail \n",0,0,0,0,0,0);
    }
#endif

#ifdef CONFIG_LEDS_CCORE
    if(0 != bsp_led_init())
    {
        logMsg("led init fail\n",0,0,0,0,0,0);
    }
#endif

/***********************通信支撑模块初始化***************************/
#ifdef CONFIG_CIPHER
    if(0 != cipher_init())
    {
        logMsg("cipher init fail \n",0,0,0,0,0,0);
    }
	if(0 != bsp_acc_init())
	{
		logMsg("acc init fail \n",0,0,0,0,0,0);
	}
#endif

#ifdef CONFIG_IPF
    if(0 != ipf_init())
        logMsg("ipf init fail\n",0,0,0,0,0,0);
#endif

#ifdef CONFIG_MODULE_BUSSTRESS
	 ipf_ul_stress_test_start(10);
#endif

#ifdef FEATURE_TLPHY_MAILBOX
    bsp_mailbox_init();
#endif

    mailbox_init();

#ifdef CONFIG_ANTEN
    if(0 != bsp_anten_init())
        logMsg("anten init fail.\n",0,0,0,0,0,0);
#endif

	bsp_sci_cfg_init();

    bsp_abb_init();

    bsp_on_off_init();

	cpufreq_init();

    /*初始化醒来的时间戳*/
    update_awake_time_stamp();

#ifdef CONFIG_CCORE_BALONG_PM
    balong_pm_init();
#endif

#ifdef CONFIG_AUDIO
    audio_init();
#endif

#ifdef CONFIG_BALONG_MODEM_RESET
	bsp_reset_init();
#endif

    (void)bsp_rf_rse_init();
#ifdef CONFIG_PASTAR
	/*勿动!此处需要放置在该函数最后,确保pastar上电后稳定后,进行初始化配置*/
	pmu_hi6561_init_phase2();
#endif

	(void)bsp_antn_sw_init();

}