VOS_VOID CpuView_Start(VOS_UINT32 ulMode)
{
    VOS_INT32         lLockValue;

    if (CPU_VIEW_NO == g_ulCpuViewInitFlag)
    {
        /* 按照默认值初始化 */
        CpuView_Init(CPU_VIEW_MEMORY_MODE_DYNAMIC, 0);
    }

    if (CPU_VIEW_YES == g_ulCpuViewStartFlag)
    {
        CPU_VIEW_LOG_PRINT("CpuView is already started!\r\n");
        return;
    }

    g_ulCpuViewMode = ulMode;

    CpuView_OpenPointWatch();
    CpuView_OpenTaskWatch();
    CpuView_OpenFuncWatch();

    lLockValue = VOS_SplIMP();
    g_ulCpuViewCnt          = 0;
    g_ulCpuViewOC           = CPU_VIEW_RECORD_OVERTURN_NO;
    g_ulCpuViewStartFlag    = CPU_VIEW_YES;
    VOS_Splx(lLockValue);

    CPU_VIEW_LOG_PRINT("CpuView Start......\r\n");

    return;
} /* CpuView_Start */
/******************************************************************************
 Prototype      : CpuView_Dump
 Description    : 输出结果到主机文件上
 Input          :
 Output         :
 Return Value   :
 Calls          :
 Called By      :

 History        : ---
  1.Date        : 2007-1-24
    Author      : g45205
    Modification: Created function
******************************************************************************/
VOS_VOID CpuView_Dump(VOS_UINT32 ulDumpMode)
{
    FILE                               *fp;
    VOS_CHAR                            acDumpFileName[500];
    static VOS_UINT8                    s_ucDumpFileNO = 0;
    VOS_INT                             iRet;
    VOS_INT32                           lLockValue;

    /* cpu_View未初始化,则按照默认值进行初始化 */
    if (CPU_VIEW_NO == g_ulCpuViewInitFlag)
    {
        /* 按照默认值初始化 */
        CpuView_Init(CPU_VIEW_MEMORY_MODE_DYNAMIC, 0);

        /* 非循环模式 */
        CpuView_Start(CPU_VIEW_RECORD_MODE_CYCLE_NO);

        /* 等待10s */
        CPU_VIEW_TASK_DELAY(1000);
    }

    /* cpu_View未开始,则按照默认值开始 */
    if (CPU_VIEW_NO == g_ulCpuViewStartFlag)
    {
        /* 非循环模式 */
        CpuView_Start(CPU_VIEW_RECORD_MODE_CYCLE_NO);

        /* 等待10s */
        CPU_VIEW_TASK_DELAY(1000);
    }

    if ( (VOS_NULL == g_pstCpuView)
        || ((0 == g_ulCpuViewCnt) && (CPU_VIEW_RECORD_OVERTURN_NO == g_ulCpuViewOC)) )
    {
        CPU_VIEW_LOG_PRINT("CpuView_DumpTrace, No Trace need dump!\r\n");
        return;
    }

    CpuView_End();

    CPU_VIEW_LOG_PRINT("CpuView Dump Begin ............\r\n");

    lLockValue = VOS_SplIMP();

    if (CPU_VIEW_DUMP_GEN_MODE_FLASH == ulDumpMode)    /* 输出到FLASH */
    {
#if (FEATURE_ON == FEATURE_MULTI_FS_PARTITION) /* SFT board*/
        sprintf(acDumpFileName, "/data/hisi_logs/cp_log/coredump/CpuView%d.dump", s_ucDumpFileNO);
#else
        sprintf(acDumpFileName, "/yaffs0/CpuView%d.dump", s_ucDumpFileNO);
#endif

        fp  = mdrv_file_open(acDumpFileName, "wb");
    }
    /* 暂不支持输出到网卡 */
#if 0
    else if (CPU_VIEW_DUMP_GEN_MODE_NETCARD == ulDumpMode)   /* 输出到网卡 */
    {
        CPU_VIEW_LOG_PRINT("Dump to Host!\r\n");
        fp  = DRV_FILE_OPEN("host:CpuView.dump", "wb");
    }
#endif
    else
    {
        VOS_Splx(lLockValue);
        CPU_VIEW_LOG_PRINT("Not support Dump file mode,Please check again!\r\n");

        return;
    }

    if (VOS_NULL == fp)
    {
        VOS_Splx(lLockValue);
        CPU_VIEW_LOG_PRINT("Open File Fail!\r\n");

        return;
    }

    iRet = mdrv_file_write(g_pstCpuViewCtrl, sizeof(CPU_VIEW_CTRL_STRU), 1, fp);
    if (-1 ==  iRet)
    {
        mdrv_file_close(fp);
        VOS_Splx(lLockValue);
        CPU_VIEW_LOG_PRINT("Write Control Info Fail!\r\n");

        return;
    }

    iRet = mdrv_file_write(g_pstCpuView, sizeof(CPU_VIEW_STRU), g_ulCpuViewTraceCnt, fp);
    if (-1 ==  iRet)
    {
        mdrv_file_close(fp);
        VOS_Splx(lLockValue);
        CPU_VIEW_LOG_PRINT("Write Cpu View Fail!\r\n");

        return;
    }

    mdrv_file_close(fp);

    VOS_Splx(lLockValue);

    CPU_VIEW_LOG_PRINT("CpuView Dump End ............\r\n");
    CPU_VIEW_LOG_PRINT1("Dump File Name:%s......\r\n", (VOS_INT)acDumpFileName);

    s_ucDumpFileNO++;

    return;
} /* CpuView_Dump */