예제 #1
0
파일: nmitnr.c 프로젝트: mrtos/gk6105s-id
static int nmi_tnr_init(void *pv)
{
	tNmiDrv *pd = &drv;
	int result	= NMI_S_OK;
	tNmiIn inp;
	tTnrInit *p = (tTnrInit *)pv;

	if (!already_init) {
		nmi_memset((void *)pd, 0, sizeof(tNmiDrv));


		/**
			Asic Init
		**/
		nmi_memset((void *)&inp, 0, sizeof(tNmiIn));		
		inp.xo							= p->xo;
		inp.ldobypass				= p->ldobypass;
		inp.ai2c                    = p->i2c_adr;
		inp.zone                    = N_ERR|N_INFO;
		inp.hlp.c.write				= nmi_bus_write;
		inp.hlp.c.read				= nmi_bus_read;
		inp.hlp.c.getreadblksz      = nmi_bus_get_read_blksz;
		inp.hlp.c.getwriteblksz     = nmi_bus_get_write_blksz;
		inp.hlp.delay				= nmi_delay;
		inp.hlp.gettick				= nmi_get_tick;
		inp.hlp.log					= nmi_log;
		inp.init_bus_only           = p->init_bus_only;
		inp.xo_out_en               = p->xo_out_en;
		inp.ltGain                  = p->ltGain;
		inp.disableOneKhzShift      = p->disableOneKhzShift;

		nmi_common_init(&inp, &pd->tnr);
		//nmi_tuner_os_log("nmi_tnr_init 2\n");
		//print_32hex(pd->tnr.init);
 
		/**
			initialize chip
		**/
		if (pd->tnr.init() < 0) {
			//dPrint(N_ERR, "[NMI] Failed to initialize chip...\n");
			nmi_tuner_os_log("[NMI] Failed to initialize chip...\n");
			result = NMI_E_CHIP_INIT;
			goto _fail_;
		}

		/**
		    Get chip id
		**/
		pd->chipid = pd->tnr.getchipid();
		nmi_tuner_os_log("chip id:");
		print_32hex(pd->chipid);
		already_init = 1;
	}

_fail_:

	return result;
}
예제 #2
0
int npm_dvb_init()
{
	//unsigned char base = 0xc0;
    memset(&gDVBTCfg, 0, sizeof(gDVBTCfg));

	/* common init */
	memset(pn, 0, sizeof(NMICMN));
	pn->dtvtype = DVB;
	pn->bustype = _I2C_;
	pn->dbgflag = _ERR_|_INFO_;
	pn->crystalindex = 5;
	pn->tbl.nmi_write_reg = NPM_bus_write;
	pn->tbl.nmi_read_reg = NPM_bus_read;
	pn->tbl.nmi_delay = nmi_delay;
	pn->tbl.nmi_get_tick = nmi_get_tick;
	pn->tbl.nmi_log = nmi_log;
	
	ptv = nmi_common_init(pn);
	if (ptv == NULL)
		return FALSE;
	return TRUE;
}