Exemplo n.º 1
0
INT32  wmt_ctrl_crystal_triming_get(P_WMT_CTRL_DATA pWmtCtrlData)
{
    INT32 iRet = 0x0;
     UCHAR *pFileName = (UCHAR *)pWmtCtrlData->au4CtrlData[0];
	 PUINT8 *ppBuf = (PUINT8 *)pWmtCtrlData->au4CtrlData[1];
	 PUINT32 pSize = (PUINT32)pWmtCtrlData->au4CtrlData[2];

	 osal_firmware *pNvram = NULL;

	 if ((NULL == pFileName) || (NULL == pSize))
	 {
	     WMT_ERR_FUNC("parameter error, pFileName(0x%08x), pSize(0x%08x)\n", pFileName, pSize);
		 iRet = -1;
		 return iRet;
	 }
	 if (0 == wmt_dev_patch_get(pFileName, &pNvram, 0))
	 {
	     *ppBuf = (PUINT8)(pNvram)->data;
         *pSize = (pNvram)->size;
		 gDevWmt.pNvram = pNvram;
		 return 0;
	 }
	 return -1;

	 
}
Exemplo n.º 2
0
INT32 wmt_conf_read_file(VOID)
{
	INT32 ret = -1;

	osal_memset(&gDevWmt.rWmtGenConf, 0, osal_sizeof(gDevWmt.rWmtGenConf));
	osal_memset(&gDevWmt.pWmtCfg, 0, osal_sizeof(gDevWmt.pWmtCfg));

#if 1
	osal_memset(&gDevWmt.cWmtcfgName[0], 0, osal_sizeof(gDevWmt.cWmtcfgName));

	osal_strncat(&(gDevWmt.cWmtcfgName[0]), CUST_CFG_WMT_PREFIX, osal_sizeof(CUST_CFG_WMT_PREFIX));
	osal_strncat(&(gDevWmt.cWmtcfgName[0]), CUST_CFG_WMT, osal_sizeof(CUST_CFG_WMT));
#endif

	if (!osal_strlen(&(gDevWmt.cWmtcfgName[0]))) {
		WMT_ERR_FUNC("empty Wmtcfg name\n");
		osal_assert(0);
		return ret;
	}
	WMT_INFO_FUNC("WMT config file:%s\n", &(gDevWmt.cWmtcfgName[0]));
	if (0 == wmt_dev_patch_get(&gDevWmt.cWmtcfgName[0], (osal_firmware **) &gDevWmt.pWmtCfg, 0)) {
		/*get full name patch success */
		WMT_INFO_FUNC("get full file name(%s) buf(0x%p) size(%d)\n",
			      &gDevWmt.cWmtcfgName[0], gDevWmt.pWmtCfg->data, gDevWmt.pWmtCfg->size);

		if (0 == wmt_conf_parse(&gDevWmt, (const PINT8)gDevWmt.pWmtCfg->data, gDevWmt.pWmtCfg->size)) {
			/*config file exists */
			gDevWmt.rWmtGenConf.cfgExist = 1;

			WMT_INFO_FUNC("&gDevWmt.rWmtGenConf=%p\n", &gDevWmt.rWmtGenConf);
			ret = 0;
		} else {
			WMT_ERR_FUNC("wmt conf parsing fail\n");
			osal_assert(0);
			ret = -1;
		}
		wmt_dev_patch_put((osal_firmware **) &gDevWmt.pWmtCfg);
/*
	if (gDevWmt.pWmtCfg)
	{
	    if (gDevWmt.pWmtCfg->data)
	    {
		osal_free(gDevWmt.pWmtCfg->data);
	    }
	    osal_free(gDevWmt.pWmtCfg);
	    gDevWmt.pWmtCfg = 0;
	}
*/
		return ret;
	} else {
		WMT_ERR_FUNC("read %s file fails\n", &(gDevWmt.cWmtcfgName[0]));
		osal_assert(0);

		gDevWmt.rWmtGenConf.cfgExist = 0;
		return ret;
	}
}
Exemplo n.º 3
0
INT32  wmt_ctrl_get_patch(P_WMT_CTRL_DATA pWmtCtrlData)
{
    UCHAR *pFullPatchName = NULL;
    UCHAR *pDefPatchName = NULL;
    PUINT8 *ppBuf = (PUINT8 *)pWmtCtrlData->au4CtrlData[2];
    PUINT32 pSize = (PUINT32)pWmtCtrlData->au4CtrlData[3];

    osal_firmware *pPatch = NULL;
    pFullPatchName = (UCHAR *)pWmtCtrlData->au4CtrlData[1];
    WMT_DBG_FUNC("BF get patch, pPatch(0x%08x)\n", pPatch);
    if ( (NULL != pFullPatchName)
        && (0 == wmt_dev_patch_get(pFullPatchName, &pPatch, BCNT_PATCH_BUF_HEADROOM)) ) {
        /*get full name patch success*/
        WMT_DBG_FUNC("get full patch name(%s) buf(0x%p) size(%d)\n",
            pFullPatchName, (pPatch)->data, (pPatch)->size);
        WMT_DBG_FUNC("AF get patch, pPatch(0x%08x)\n", pPatch);
        *ppBuf = (PUINT8)(pPatch)->data;
        *pSize = (pPatch)->size;
        gDevWmt.pPatch = pPatch;
        return 0;
    }

    pDefPatchName = (UCHAR *)pWmtCtrlData->au4CtrlData[0];
    if ( (NULL != pDefPatchName)
        && (0 == wmt_dev_patch_get(pDefPatchName, &pPatch, BCNT_PATCH_BUF_HEADROOM)) ) {
        WMT_DBG_FUNC("get def patch name(%s) buf(0x%p) size(%d)\n",
            pDefPatchName, (pPatch)->data, (pPatch)->size);
        WMT_DBG_FUNC("AF get patch, pPatch(0x%08x)\n", pPatch);
        /*get full name patch success*/
        *ppBuf = (PUINT8)(pPatch)->data;
        *pSize = (pPatch)->size;
        gDevWmt.pPatch = pPatch;
        return 0;
    }
    return -1;

}