Exemplo n.º 1
0
int vibrator_init(void)
{
	int ret = 0;
    struct ftm_module *mod, *mod_autotest;
    struct mVibrator *mvibrator_autotest;

	LOGD("%s\n", __FUNCTION__);

	mod = ftm_alloc(ITEM_VIBRATOR, sizeof(struct ftm_module));
	if (!mod)
		return -ENOMEM;

	ret = ftm_register(mod, vibrator_entry, (void*)mod);

#ifdef VIBRATOR_AUTOTEST
    mod_autotest = ftm_alloc(ITEM_VIBRATOR_PHONE, sizeof(struct mVibrator));
    mvibrator_autotest = mod_to_mVibrator(mod_autotest);
    mvibrator_autotest->mod = mod_autotest;
    if (!mod_autotest)
        return -ENOMEM;
    ret = ftm_register(mod_autotest, vibrator_autotest_entry, (void*)mvibrator_autotest);
#endif

	return ret;
}
Exemplo n.º 2
0
int headset_init(void)
{
    int ret = 0;
    struct ftm_module *mod, *mod_phone;
    struct headset *hds, *hds_phone;

    LOGD(TAG "%s\n", __FUNCTION__);

    mod = ftm_alloc(ITEM_HEADSET, sizeof(struct headset));
    hds = mod_to_headset(mod);

    hds->mod    = mod;
	  hds->avail	= false;
	  hds->isPhoneTest = false;

    if (!mod)
        return -ENOMEM;

    ret = ftm_register(mod, headset_entry, (void*)hds);

#ifdef RECEIVER_HEADSET_AUTOTEST
    //---- Phone Level Test
    mod_phone= ftm_alloc(ITEM_HEADSET_PHONE, sizeof(struct headset));
    hds_phone= mod_to_headset(mod_phone);
    hds_phone->mod    = mod_phone;
	hds_phone->avail	= false;
	hds_phone->isPhoneTest = true;
    if (!mod_phone)
        return -ENOMEM;
    ret = ftm_register(mod_phone, headset_PhoneTest_entry, (void*)hds_phone);
	//----
#endif
    return ret;
}
Exemplo n.º 3
0
int MATV_init(void)
{
    int ret = 0;

    struct ftm_module *modNormal, *modScan;
    struct mMATV *mMATVNormal, *mMATVScan;

    LOGD(TAG "%s\n", __FUNCTION__);
    LOGD(TAG "-------mATV_init new------------------\n");

    //Auto-test
    modScan = ftm_alloc(ITEM_MATV_AUTOSCAN, sizeof(struct mMATV));

    if (!modScan)
    {
        LOGD(TAG "modInit = NULL");
        return -ENOMEM;
    }

    mMATVScan = mod_to_mMTAV(modScan);
    mMATVScan->mod = modScan;

    ret = ftm_register(modScan, mMATV_scan_entry, (void *)mMATVScan);

    if (ret != 0)
    {
        LOGD(TAG "ftm_register MATV_init fail!");
    }

    return ret;
}
Exemplo n.º 4
0
int lcd_init(void)
{
	int r;
	struct ftm_module *mod;
	lcd_module *lcd;

	write_int(BRIGHTNESS_FILE, 255);

	mod = ftm_alloc(ITEM_LCD, sizeof(lcd_module));
	if (!mod)
		return -ENOMEM;

	lcd = mod_to_lcd(mod);

	lcd->module = mod;
	lcd->itm_view = ui_new_itemview();
	if (!lcd->itm_view)
		return -ENOMEM;

	r = ftm_register(mod, lcd_entry, (void*)lcd);
	if (r) {
		LOGD(TAG "register LCD failed (%d)\n", r);
		return r;
	}

	return 0;
}
Exemplo n.º 5
0
/*---------------------------------------------------------------------------*/
int pscali_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct lps_data *dat;

    FLPLOGD(TAG "%s\n", __FUNCTION__);

    //mod = ftm_alloc(ITEM_PSCALI, sizeof(struct lps_data));
    mod = ftm_alloc(ITEM_PSCALI, sizeof(struct lps_data));
    dat  = mod_to_lps_data(mod);

    memset(dat, 0x00, sizeof(*dat));
    ps_cali_init_priv(&dat->lps);

    /*NOTE: the assignment MUST be done, or exception happens when tester press Test Pass/Test Fail*/
    dat->mod = mod;

    if (!mod)
        return -ENOMEM;

    ret = ftm_register(mod, ps_cali_entry, (void*)dat);

    return ret;
}
Exemplo n.º 6
0
struct ftm_module* sigtest_init(void)
{
    int ret;
    struct ftm_module *mod;
    struct sigtest *st;

    LOGD(TAG "%s\n", __FUNCTION__);
    
    mod = ftm_alloc(ITEM_SIGNALTEST, sizeof(struct sigtest));
    st  = mod_to_sigtest(mod);

    st->mod = mod;
    
    if (!mod)
        return NULL;

    ret = ftm_register(mod, sigtest_entry, (void*)st);

    if(ret == 0) {
        LOGD(TAG "ftm_register success!\n");
        return mod;
    }
    else {
        LOGD(TAG "ftm_register fail!\n");
        return NULL;
    }
            
}
Exemplo n.º 7
0
int irtx_led_init(void)
{
    int ret = 0;
    int e = 0;
    struct ftm_module *mod;
    struct irtx_led_stu *irtxledstru;

    LOGD(TAG "%s: Start\n", __FUNCTION__);
    e = system("setenforce 0");
    LOGD(TAG "%s: setenforce 0. ret:%d\n", __FUNCTION__, e);

    mod = ftm_alloc(ITEM_IRTX_LED_TEST, sizeof(struct irtx_led_stu));
    if (!mod) {
        LOGE(TAG "%s - ftm_alloc error! err:%d\n", __FUNCTION__, errno);
        return -ENOMEM;
    }

    irtxledstru = mod_to_irtx_led_stu(mod);

    /* init */
    irtxledstru->mod = mod;    

    ret = ftm_register(mod, irtx_led_entry, (void*)irtxledstru);

    if (ret) {
        LOGE(TAG "%s -register irtx_led_entry fail!! ret:%d\n", __FUNCTION__, ret);
    }

    return ret;
}
Exemplo n.º 8
0
int hotknot_init(void)
{
	int r;
	struct ftm_module *mod = {NULL};
	struct hotknot *hotknot = {NULL};
	DEBUG("%s, %d\n", __FUNCTION__, __LINE__);

	mod = ftm_alloc(ITEM_HOTKNOT, sizeof(struct hotknot));
	if (!mod)
		return -ENOMEM;

	hotknot = mod_to_hotknot(mod);
	hotknot->mod = mod;
	/*keys->iv = ui_new_itemview();
	if (!keys->iv)
		return -ENOMEM;*/
    DEBUG("%s, %d\n", __FUNCTION__, __LINE__);

	r = ftm_register(mod, hotknot_entry, (void*)hotknot);
	if (r) {
		LOGD(TAG "register hotknot failed (%d)\n", r);
		return r;
	}
    DEBUG("%s, %d\n", __FUNCTION__, __LINE__);
	return 0;
}
Exemplo n.º 9
0
int tvout_init(void)
{
	int r;
	struct ftm_module *mod;
	tvout_module *tvout;

	mod = ftm_alloc(ITEM_TVOUT, sizeof(tvout_module));
	if (!mod)
		return -ENOMEM;

	tvout = mod_to_tvout(mod);

	tvout->module = mod;
	tvout->itm_view = ui_new_itemview();
	if (!tvout->itm_view)
		return -ENOMEM;

	r = ftm_register(mod, tvout_entry, (void*)tvout);
	if (r) {
		LOGD(TAG "register TVOUT failed (%d)\n", r);
		return r;
	}

	return 0;
}
Exemplo n.º 10
0
int nfc_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct nfc_desc *nfc;

    LOGD(TAG "%s\n", __FUNCTION__);
    
    mod = ftm_alloc(ITEM_NFC, sizeof(struct nfc_desc));
    nfc  = mod_to_nfc(mod);

    nfc->mod      = mod;
    
    i4TestItem = 0;
    i4TestItem_Wait=0;

    if (!mod)
    {
        return -ENOMEM;
    }

    ret = ftm_register(mod, nfc_entry, (void*)nfc);

    return ret;
}
Exemplo n.º 11
0
int flash_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct nand_info *flash;

    LOGD(TAG "%s\n", __FUNCTION__);
    
    /* Alloc memory and register the test module */
    mod = ftm_alloc(ITEM_FLASH, sizeof(struct nand_info));

    if (!mod)
        return -ENOMEM;

    /* set the private data structure pointer to ftm_module's extra space */

    /* ---------------------------------------- *
     * |    ftm_module     |    nand_info     | *
     * ---------------------------------------- */
    flash = mod_to_flash(mod);

    flash->mod = mod;

    /* register the entry function to ftm_module */
    ret = ftm_register(mod, flash_entry, (void*)flash);

    return ret;
}
Exemplo n.º 12
0
int hdmi_init(void)
{
    int ret = 0;

    struct ftm_module *mod;
	hdmi_module *hdmi;

    LOGD(TAG "hdmi_init\n");

    mod = ftm_alloc(ITEM_HDMI, sizeof(hdmi_module));
    if (!mod)
    {
        LOGD(TAG "hdmi_init failed\n");
        return -ENOMEM;
    }

	hdmi = mod_to_hdmi(mod);
    hdmi->module = mod;

    ret = ftm_register(mod, hdmi_entry, (void*)hdmi);
    if (ret)
    {
		LOGE(TAG "register HDMI failed (%d)\n", ret);
    }

    return ret;
}
Exemplo n.º 13
0
int clear_emmc_init(void)
{
    int ret = 0;
    int index = 0;
    struct ftm_module *mod;
    struct emmc *mmc = NULL;
	    
    mod = ftm_alloc(ITEM_CLREMMC, sizeof(struct emmc));
    if (!mod)
        return -ENOMEM;
    mmc = mod_to_emmc(mod);
 
    ret = ftm_register(mod, (ftm_entry_fn)clear_emmc_entry, (void*)mmc);
    return ret;
}
Exemplo n.º 14
0
int idle_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    
    mod = ftm_alloc(ITEM_IDLE, 0);
    
    if (!mod)
        return -ENOMEM;
    
    LOGD(TAG "idle_init\n");
    
    ret = ftm_register(mod, idle_entry, (void*)mod);
    
    return ret;
}
Exemplo n.º 15
0
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
extern "C" int strobe_init(void)
{
	FTM_CAMERA_DBG("strobe_init %d\n",__LINE__);
    int ret = 0;
    struct ftm_module *mod;
    struct camera *cam;

    mod = ftm_alloc(ITEM_STROBE, sizeof(struct camera));
    cam  = mod_to_camera(mod);
    memset(cam, 0x0, sizeof(struct camera));
    /*NOTE: the assignment MUST be done, or exception happens when tester press Test Pass/Test Fail*/
    cam->mod = mod;
    if (!mod)
        return -ENOMEM;
    ret = ftm_register(mod, strobe_entry, (void*)cam);
    return ret;
}
Exemplo n.º 16
0
int wifi_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct wifi_factory *wififm;

    LOGD(TAG "%s\n", __FUNCTION__);

    mod = ftm_alloc(ITEM_WIFI, sizeof(struct wifi_factory));
    if (!mod)
        return -ENOMEM;

    wififm  = mod_to_wifi(mod);
    wififm->mod     = mod;

    ret = ftm_register(mod, wifi_entry, (void*)wififm);

    return ret;
}
Exemplo n.º 17
0
int fmtx_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct fmtx_factory *fmtx;

    LOGD("%s\n", __FUNCTION__);

    mod = ftm_alloc(ITEM_FMTX, sizeof(struct fmtx_factory));
    if (!mod)
        return -ENOMEM;

    fmtx  = mod_to_fmtx(mod);
    fmtx->mod = mod;

    ret = ftm_register(mod, fmtx_entry, (void*)fmtx);

    return ret;
}
Exemplo n.º 18
0
int bt_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct bt_factory *bf;

    LOGD(TAG "%s\n", __FUNCTION__);

    mod = ftm_alloc(ITEM_BT, sizeof(struct bt_factory));
    if (!mod)
        return -ENOMEM;

    bf  = mod_to_bf(mod);
    bf->mod     = mod;

    ret = ftm_register(mod, bt_entry, (void*)bf);

    return ret;
}
Exemplo n.º 19
0
int touch_auto_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct touch *tpd;

    LOGD(TAG "%s\n", __FUNCTION__);
    //calibration_init();
    mod = ftm_alloc(ITEM_TOUCH_AUTO, sizeof(struct touch));
    tpd  = mod_to_touch(mod);
    memset(tpd, 0x00, sizeof(*tpd));
    tpd->mod = mod; 
    //tpd->event_fd = -1;
    tpd->width = ui_fb_width();
    tpd->height = ui_fb_height();
    if (!mod) return -ENOMEM;
    ret = ftm_register(mod, touch_auto_entry, (void*)tpd);
    return 0;
}
Exemplo n.º 20
0
int clear_flash_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct nand_info *flash;

    LOGD(TAG "%s\n", __FUNCTION__);
    
    mod = ftm_alloc(ITEM_CLRFLASH, sizeof(struct nand_info));

    if (!mod)
        return -ENOMEM;

    flash = mod_to_flash(mod);

    flash->mod = mod;

    ret = ftm_register(mod, clear_flash_entry, (void*)flash);

    return ret;
}
Exemplo n.º 21
0
int otg_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct otg *hds;

    LOGD(TAG "%s\n", __FUNCTION__);

    mod = ftm_alloc(ITEM_OTG, sizeof(struct otg));
    hds = mod_to_otg(mod);

    hds->mod    = mod;
		hds->avail	= false;

    if (!mod)
        return -ENOMEM;

    ret = ftm_register(mod, otg_entry, (void*)hds);

    return ret;
}
Exemplo n.º 22
0
int gps_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct gps_desc *gps;

    LOGD(TAG "%s\n", __FUNCTION__);
    
    mod = ftm_alloc(ITEM_GPS, sizeof(struct gps_desc));
    gps  = mod_to_gps(mod);

    gps->mod      = mod;

    if (!mod)
    {
        return -ENOMEM;
    }

    ret = ftm_register(mod, gps_entry, (void*)gps);

    return ret;
}
Exemplo n.º 23
0
int idle_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct ftm_idle *idle;

    LOGD(TAG "idle_init\n");

    mod = ftm_alloc(ITEM_IDLE, sizeof(struct ftm_idle));
    if (!mod)
        return -ENOMEM;

    idle = mod_to_idle(mod);
    idle->mod = mod;

    ret = ftm_register(mod, idle_entry, (void*) idle);
    if (ret) {
        LOGD(TAG "register IDLE failed (%d)\n", ret);
        return ret;
    }

    return 0;
}
Exemplo n.º 24
0
int rf_test_init(void)
{
  int ret = 0;
  struct ftm_module *mod;
  struct rf_factory *rf;

  LOGD(TAG "%s: Start\n", __FUNCTION__);

  mod = ftm_alloc(ITEM_RF_TEST, sizeof(struct rf_factory));
  if(!mod) {
    return -ENOMEM;
  }
  rf = mod_to_rf(mod);
  rf->mod = mod;
  rf->test_done = true;

  ret = ftm_register(mod, rf_test_entry, (void*)rf);
  if(ret) {
    LOGD(TAG "register rf_test_entry failed (%d)\n", ret);
  }

  return ret;
}
Exemplo n.º 25
0
int sim_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct sim_factory *sim;

    LOGD(TAG "%s: Start\n", __FUNCTION__);

    mod = ftm_alloc(ITEM_SIM, sizeof(struct sim_factory));
    if(!mod) {
        return -ENOMEM;
    }
    sim = mod_to_sim(mod);
    sim->mod = mod;
    sim->test_done = true;

    ret = ftm_register(mod, sim_entry, (void*)sim);
    if(ret) {
        LOGD(TAG "register sim_entry failed (%d)\n", ret);
    }

    return ret;
}
Exemplo n.º 26
0
int emmc_init(void)
{
    int ret = 0;
	int index = 0;
    struct ftm_module *mod;
    struct emmc *mmc = NULL;
	 
    LOGD(TAG "%s\n", __FUNCTION__);
    
    mod = ftm_alloc(ITEM_EMMC, sizeof(struct emmc));
	if (!mod)
        return -ENOMEM;
    mmc  = mod_to_emmc(mod);

    mmc->mod      = mod;
    mmc->id       = CUST_EMMC_ID;
    mmc->avail    = false;

	emmc_update_info(mmc, mmc->info); 

    ret = ftm_register(mod, (ftm_entry_fn)emmc_entry, (void*)mmc);

    return ret;
}
Exemplo n.º 27
0
int battery_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct batteryFTM *batt;

    LOGD(TAG "%s\n", __FUNCTION__);
    
    mod = ftm_alloc(ITEM_CHARGER, sizeof(struct batteryFTM));
    batt = mod_to_batteryFTM(mod);

	/* init */
    batt->mod = mod;
	batt->bat_voltage = 0;
	batt->charger_voltage = 0;
	batt->current_charging = 0;
	batt->bat_temperature = 0;
	#ifdef FEATURE_FTM_PMIC_632X
	batt->adc_vbat_3_2 = 683;
	batt->adc_vbat_4_2 = 896;
	#else
	batt->adc_vbat_3_2 = 584;
	batt->adc_vbat_4_2 = 767;
	#endif
	batt->adc_vbat_current = 0;
	batt->is_charging = false;
	batt->is_calibration = false;
	batt->charger_exist = false;

    if (!mod)
        return -ENOMEM;

    ret = ftm_register(mod, battery_entry, (void*)batt);

    return ret;
}
Exemplo n.º 28
0
/*---------------------------------------------------------------------------*/
int barometer_init(void)
{
    int ret = 0;
    struct ftm_module *mod;
    struct baro_data *dat;

    LOGD(TAG "%s\n", __FUNCTION__);
    
    mod = ftm_alloc(ITEM_BAROMETER, sizeof(struct baro_data));
    dat  = mod_to_baro_data(mod);

    memset(dat, 0x00, sizeof(*dat));
    barometer_init_priv(&dat->baro);
        
    /*NOTE: the assignment MUST be done, or exception happens when tester press Test Pass/Test Fail*/    
    dat->mod = mod; 
    
    if (!mod)
        return -ENOMEM;

    ret = ftm_register(mod, barometer_entry, (void*)dat);

    return ret;
}
Exemplo n.º 29
0
int keys_init(void)
{
	int r;
	struct ftm_module *mod;
	struct keys *keys;

	mod = ftm_alloc(ITEM_KEYS, sizeof(struct keys));
	if (!mod)
		return -ENOMEM;

	keys = mod_to_keys(mod);
	keys->mod = mod;
	/*keys->iv = ui_new_itemview();
	if (!keys->iv)
		return -ENOMEM;*/

	r = ftm_register(mod, keys_entry, (void*)keys);
	if (r) {
		LOGD(TAG "register KEYS failed (%d)\n", r);
		return r;
	}

	return 0;
}
Exemplo n.º 30
0
int mcard_init(void)
{
    int ret = 0;
    struct ftm_module *mod = NULL;
    struct mcard *mc = NULL;
    struct mcard_array *ma = NULL;
    char* env_var;


    LOGD(TAG "%s\n", __FUNCTION__);

    if ( NULL != (env_var = getenv("EXTERNAL_STORAGE"))) {
        strcpy(g_mountpoint1, env_var);
    }
    if ( NULL != (env_var = getenv("SECONDARY_STORAGE"))) {
        strcpy(g_mountpoint2, env_var);
    }
    LOGD(TAG "g_mountpoint1(%s), g_mountpoint2(%s)\n", g_mountpoint1, g_mountpoint2);

    mod = ftm_alloc(ITEM_MEMCARD, sizeof(struct mcard_array));
    if (!mod)
        return -ENOMEM;
    mc = (struct mcard*)malloc(sizeof(struct mcard));
    if(!mc){
        ftm_free(mod);
        return -ENOMEM;
    }
    ma = (struct mcard_array*)malloc(sizeof(struct mcard_array));
    if(!ma){
        ftm_free(mod);
        free(mc);
        return -ENOMEM;
    }

    memset(ma,0,sizeof(struct mcard_array));
    ma  = mod_to_mcard_array(mod);

    ma->mod      = mod;
    #ifdef MTK_EMMC_SUPPORT
    mc->id       = CUST_EMMC_ID;
    #else
    mc->id       = CUST_MCARD_ID;
    #endif
    mc->mounted  = false;
    mc->avail    = false;
    mc->mntpnt   = g_mountpoint1;
    mc->checksum = -1;
    mc->blocknum = -1;
    ma->mcard[0] = mc;
    ma->mcard_no += 1;
#if defined(MTK_MULTI_STORAGE_SUPPORT) && !defined(MTK_FAT_ON_NAND)
    LOGD("MTK_MULTI_STORAGE_SUPPORT\n");
    struct mcard *mc2 = (struct mcard*)malloc(sizeof(struct mcard));;
    mc2->id       = CUST_MCARD_ID2;
    mc2->mounted  = false;
    mc2->avail    = false;
    mc2->mntpnt   = g_mountpoint2;
    mc2->checksum = -1;
    mc2->blocknum = -1;
    ma->mcard[1] = mc2;
    ma->mcard_no += 1;
#endif
    LOGD(TAG "ma->mcard_no(%d)\n",ma->mcard_no);

#if defined(MTK_MULTI_STORAGE_SUPPORT) && !defined(MTK_FAT_ON_NAND)
    mcard_update_info_multi_storage(ma, ma->info,1);
#else
    mcard_update_info(ma->mcard[0],ma->info);
#endif

#if defined(MTK_EMMC_SUPPORT) && defined(MTK_MULTI_STORAGE_SUPPORT)
    mcard_auto_format_internal_sd(ma);
#endif

    ret = ftm_register(mod, mcard_entry, (void*)ma);
    return ret;
}