Пример #1
0
static MS_S32 MsDrv_FILE_read(MS_U8 *Pbuf, MS_U32 max_bytes_to_read, MS_BOOL *Peof_flag)
{
    MS_U8* u8RequestDataAddr = 0;
    MS_S32 bytes_read = 0;
    MS_S32 i = 0;
	UBOOT_TRACE("IN\n");

    u8RequestDataAddr = Pbuf;

    UBOOT_DEBUG("%s,u8RequestDataAddr = 0x%lX, FilePosition = %lu, FileLength = %lu\n"
        , __FUNCTION__, (MS_U32)u8RequestDataAddr, u32ReadPosition, u32InputDataLength);

    if (u32ReadPosition <= u32InputDataLength)
    {
        bytes_read = max_bytes_to_read;
        if ((u32ReadPosition + max_bytes_to_read) >= u32InputDataLength)
        {
            bytes_read = u32InputDataLength - u32ReadPosition;
            *Peof_flag = TRUE;
        }

        for(i = 0; i < bytes_read; i++)
        {
            u8RequestDataAddr[i] = u8InputDataAddr[u32ReadPosition + i];
        }
        MsOS_FlushMemory();
    }
    else
    {
        *Peof_flag = TRUE;
    }
    u32ReadPosition += bytes_read;
    UBOOT_DEBUG("%s, bytes_read = %lu\n", __FUNCTION__, bytes_read);
	UBOOT_TRACE("OK\n");
    return bytes_read;
}
Пример #2
0
/*
 * Subroutine:  do_tuner
 *
 * Description: Handler for 'tuner' command..
 *
 * Inputs:	argv[1] contains the subcommand
 *
 * Return:      None
 *
 */
int do_dmx_init(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
    MS_PHYADDR      phyFW;
    MS_U8*          pu8FW;
    DMX_FLOW_INPUT inSrc;
    if (argc<1)
    {
        printf ("Usage:\n%s\n", cmdtp->usage);
        return 1;
    }
    inSrc = (DMX_FLOW_INPUT)simple_strtoul(argv[1], NULL, 10);
    MDrv_MMIO_Init(); // must init MMI before init DMX

    pu8FW = (MS_U8*)(((int)u8TSFwBuf + 0x7F) & (~0x7F));
    pu8FW = (MS_U8*)MsOS_VA2PA((MS_U32)pu8FW);
    pu8FW = (MS_U8*)MsOS_PA2KSEG1((MS_U32)pu8FW);
    memcpy(pu8FW, u8TSPFirmware, sizeof(u8TSPFirmware));
    MsOS_FlushMemory();

    phyFW = (MS_PHYADDR)MsOS_VA2PA((MS_U32)pu8FW);
    if (DMX_FILTER_STATUS_ERROR == MApi_DMX_SetFW(phyFW, sizeof(u8TSPFirmware)))
    {
        printf("DeMux>>ERROR! SetFW fail\n");
        return -1;
    }
    MApi_DMX_SetHK(TRUE);
    if (DMX_FILTER_STATUS_ERROR == MApi_DMX_Init())
    {
        printf("DeMux>>ERROR! TSP init fail\n");
        return -1;
    }

#if defined(CONFIG_URANUS4) || defined(CONFIG_KRONUS) || defined(CONFIG_KAISERIN) || defined(CONFIG_KENYA)
    // set VQ for TSP, set FW/VQ for TSP2
    MS_U8*          pu8VQ;
    MS_PHYADDR      phyVQ;
    DMX_TSPParam    param;

    memset(&param,0,sizeof(param));
    pu8VQ = (MS_U8*)(((int)u8TSVQBuf + 0x7) & (~0x7));
    phyVQ = (MS_PHYADDR)MsOS_VA2PA((MS_U32)pu8VQ);

    // printf("[%s][%d] (fw, vq) = (0x%08x 0x%08x)\n", __FUNCTION__, __LINE__,
    // phyFW, phyVQ);
    param.phyFWAddr = (MS_PHYADDR)phyFW;
    param.u32FWSize = TSP_FW_SIZE;
    param.phyVQAddr = (MS_PHYADDR)phyVQ;
    param.u32VQSize = TSP_VQ_SIZE;//(200*16 + 200*8 + 200*8);

    if (DMX_FILTER_STATUS_ERROR == MApi_DMX_TSPInit(&param))
    {
        printf("DeMux>>ERROR! TSP set fw/vq fail\n");
        return -1;
    }
#endif

    if (DMX_FILTER_STATUS_OK!= MApi_DMX_FlowSet(DMX_FLOW_PLAYBACK, inSrc, TS_CLK_INV, TRUE, TS_PARALLEL_OUTPUT))
    {
        printf("DeMux>>ERROR! switch to demod fail\n");
        return -1;
    }

    return 0;
}