VOS_VOID ADS_StopTimer(
    VOS_UINT32                          ulPid,
    ADS_TIMER_ID_ENUM_UINT32            enTimerId,
    ADS_TIMER_STOP_CAUSE_ENUM_UINT8     enStopCause
)
{
    ADS_TIMER_CTX_STRU                 *pstTiCtx;

    pstTiCtx = ADS_GetTiCtx();

    /* 不在使用的定时器范围内 */
    if (enTimerId >= ADS_MAX_TIMER_NUM)
    {
        return;
    }

    if (ADS_TIMER_STATUS_RUNNING != pstTiCtx[enTimerId].enTimerStatus)
    {
        return;
    }

    /* 停止VOS定时器: 当定时器的指针已经为空的时候, 说明其已经停止或者超时 */
    if (VOS_NULL_PTR != pstTiCtx[enTimerId].hTimer)
    {
        VOS_StopRelTimer(&(pstTiCtx[enTimerId].hTimer));
    }

    pstTiCtx[enTimerId].hTimer        = VOS_NULL_PTR;
    pstTiCtx[enTimerId].enTimerStatus = ADS_TIMER_STATUS_STOP;

    /*勾包ADS_TIMER_INFO_STRU*/
    ADS_MNTN_TraceTimerOperation(ulPid, enTimerId, 0, ADS_TIMER_OPERATION_STOP, enStopCause);

    return;
}
VOS_VOID  NAS_MMC_StopAllTimer( VOS_VOID )
{
    NAS_MMC_TIMER_CTX_STRU             *pstMmcTimerCtx;
    VOS_UINT32                          i;

    VOS_UINT32                          ulTimerRemainLen;

    ulTimerRemainLen = 0;

    pstMmcTimerCtx   =  NAS_MMC_GetTimerAddr();

    for ( i = 0 ; i < NAS_MMC_MAX_TIMER_NUM ; i++ )
    {
        if ( NAS_MMC_TIMER_STATUS_RUNING  == pstMmcTimerCtx[i].enTimerStatus )
        {
            if (VOS_OK != VOS_GetRelTmRemainTime(&(pstMmcTimerCtx[i].hTimer), &ulTimerRemainLen ))
            {
                ulTimerRemainLen = 0;
            }

            /* 停止VOS定时器 */
            (VOS_VOID)VOS_StopRelTimer(&(pstMmcTimerCtx[i].hTimer));

            NAS_MMC_SndOmMmcTimerStatus(NAS_MMC_TIMER_STATUS_STOP, pstMmcTimerCtx[i].enTimerId, ulTimerRemainLen * 10);

            pstMmcTimerCtx[i].hTimer        = VOS_NULL_PTR;
            pstMmcTimerCtx[i].enTimerId     = TI_NAS_MMC_TIMER_BUTT;
            pstMmcTimerCtx[i].enTimerStatus = NAS_MMC_TIMER_STATUS_STOP;
        }
    }
}
VOS_VOID  TAF_MMA_InitAllTimers(
    TAF_MMA_INIT_CTX_TYPE_ENUM_UINT8     enInitType,
    TAF_MMA_TIMER_CTX_STRU              *pstMmaTimerCtx
)
{
    VOS_UINT32                          i;

    for (i = 0 ; i < TAF_MMA_MAX_TIMER_NUM ; i++)
    {
        pstMmaTimerCtx[i].hTimer        = VOS_NULL_PTR;
        pstMmaTimerCtx[i].enTimerId     = TI_TAF_MMA_TIMER_BUTT;
        pstMmaTimerCtx[i].enTimerStatus = TAF_MMA_TIMER_STATUS_STOP;
        pstMmaTimerCtx[i].aucReserve[0] = 0;
    }

    for ( i = 0; i < STA_TIMER_MAX; i++ )
    {
        if (STA_TIMER_NULL != g_StatusContext.aFsmSub[i].TimerName )
        {
            VOS_StopRelTimer (&g_StatusContext.ahStaTimer[i]);
            g_StatusContext.aFsmSub[i].TimerName = STA_TIMER_NULL;
        }
    }

    /* 只有在上电才初始化内部定时器 */
    if (TAF_MMA_INIT_CTX_STARTUP == enInitType)
    {
        TAF_MMA_InitInternalTimer();
    }

    return;
}
VOS_VOID  RNIC_StopAllTimer( VOS_VOID )
{

    RNIC_TIMER_CTX_STRU                *pstRnicTimerCtx;
    VOS_UINT32                          i;

    pstRnicTimerCtx   =  RNIC_GetTimerAddr();

    for (i = 0 ; i < RNIC_MAX_TIMER_NUM ; i++)
    {
        if (RNIC_TIMER_STATUS_RUNING  == pstRnicTimerCtx[i].enTimerStatus)
        {
            /* 停止VOS定时器 */
            VOS_StopRelTimer(&(pstRnicTimerCtx[i].hTimer));

            pstRnicTimerCtx[i].hTimer        = VOS_NULL_PTR;
            pstRnicTimerCtx[i].enTimerStatus = RNIC_TIMER_STATUS_STOP;
        }
    }

#if (FEATURE_ON == FEATURE_LTE)
    /* 如果已经设置了唤醒源标志,则清除该标志,并且设置32K时钟为非唤醒源 */
    if (VOS_TRUE == RNIC_GetTimer4WakeFlg())
    {
        BSP_PWC_DelTimer4WakeSrc();

        RNIC_SetTimer4WakeFlg(VOS_FALSE);
    }
#endif
}
示例#5
0
/*****************************************************************************
 函 数 名  : AT_StopRelTimer
 功能描述  : AT停止REL定时器函数
 输入参数  : VOS_UINT32 ulName
             HTIMER *phTm
 输出参数  : 无
 返 回 值  : VOS_UINT32
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2011年10月5日
    修改内容   : 新生成函数

*****************************************************************************/
VOS_UINT32 AT_StopRelTimer(
    VOS_UINT32                          ulName,
    HTIMER                             *phTm
)
{
    VOS_UINT32                          ulRet;
    AT_TIMER_OPERATION_STRU             stTimer;

    ulRet = VOS_StopRelTimer(phTm);

    if (VOS_ERR == ulRet)
    {
        AT_ERR_LOG("AT_StopRelTimer: Stop Rel Timer Fail!");
    }

    stTimer.ulSenderCpuId   = VOS_LOCAL_CPUID;
    stTimer.ulSenderPid     = WUEPS_PID_AT;
    stTimer.ulReceiverCpuId = VOS_LOCAL_CPUID;
    stTimer.ulReceiverPid   = VOS_PID_TIMER;
    stTimer.ulLength        = sizeof(AT_TIMER_OPERATION_STRU) - VOS_MSG_HEAD_LENGTH;
    stTimer.ulMsgName       = ulName;
    stTimer.enTimeAction    = AT_TIMER_OPERATION_STOP;
    stTimer.ulTimeLen       = 0x0;

    OM_AcpuTraceMsgHook(&stTimer);

    return ulRet;
}
VOS_UINT32 RRM_StartTimer
(
    RRM_RFID_ENUM_UINT16                enRFIDTimerId
)
{
    RRM_RFID_TIMER_CTRL_STRU           *pstRFIDTimerAddr;
    VOS_UINT32                          ulRslt;


    /*获取该状态定时器控制块地址*/
    pstRFIDTimerAddr       = RRM_GetRFIDTimerAddr(enRFIDTimerId);

    /*无法获取该定时器控制块地址,说明定时器ID非法*/
    if( VOS_NULL_PTR == pstRFIDTimerAddr)
    {
        /* 打印错误信息 */
        RRM_WARNING_LOG1(UEPS_PID_RRM, "TimerId is Error!", enRFIDTimerId);
        return VOS_ERR;
    }

    /*检查该状态定时器是否在运行,如果正在运行,先停止该定时器。
      停止定时器时,VOS会直接将该定时器句柄清除为VOS_NULL_PTR*/
    if(VOS_NULL_PTR != pstRFIDTimerAddr->pstStaTHandle)
    {
        VOS_StopRelTimer(&(pstRFIDTimerAddr->pstStaTHandle));
    }

    /* 定时器ID设置 */
    pstRFIDTimerAddr->enRFIDTimerId = enRFIDTimerId;

    /* 定时器无参数信息,启动定时器时将定时器参数设置为0
      非循环定时器,定时器模式为VOS_RELTIMER_NOLOOP*/
    ulRslt        = VOS_StartRelTimer( &(pstRFIDTimerAddr->pstStaTHandle),
                                        UEPS_PID_RRM,
                                        RRM_TMR_DEF_LEN,
                                        pstRFIDTimerAddr->enRFIDTimerId,
                                        0,
                                        VOS_RELTIMER_NOLOOP,
                                        VOS_TIMER_PRECISION_0);

    /*这里调用的是VOS的接口函数,因此需要使用VOS的返回值进行检查*/
    if( VOS_OK != ulRslt)
    {
        /* 启动失败,打印失败信息 */
        RRM_ERROR_LOG1(UEPS_PID_RRM, "Start TimerId Failure!", enRFIDTimerId);
        return VOS_ERR;
    }

    return VOS_OK;
}
示例#7
0
/*****************************************************************************
 函 数 名  : At_StartTimer
 功能描述  : AT启动定时器
 输入参数  : TAF_UINT32 usLength
             TAF_UINT8 ucIndex
 输出参数  : 无
 返 回 值  : TAF_UINT32
 调用函数  :
 被调函数  :

 修改历史      :

  1.Date        : 2005-04-19
    Modification: Created function
  2.日    期   : 2009-03-25
    修改内容   : 问题单号:AT2D10008
  3.日    期   : 2011年10月5日
    修改内容   : AT Project:定时器由AT内部实现

*****************************************************************************/
VOS_UINT32 At_StartTimer(
    VOS_UINT32                          usLength,
    VOS_UINT8                           ucIndex
)
{
    VOS_StopRelTimer(&gastAtClientTab[ucIndex].hTimer);
    if(VOS_OK != AT_StartRelTimer(&gastAtClientTab[ucIndex].hTimer,usLength,ucIndex,0,VOS_RELTIMER_NOLOOP))
    {
        AT_ERR_LOG("At_StartTimer:ERROR:Start Timer");
        return AT_FAILURE;
    }

    return AT_SUCCESS;
}
示例#8
0
VOS_VOID  RNIC_StopTimer(
    RNIC_TIMER_ID_ENUM_UINT16           enTimerId
)
{
    RNIC_TIMER_CTX_STRU                *pstRnicTimerCtx;
    VOS_UINT32                          i;

    pstRnicTimerCtx   =  RNIC_GetTimerAddr();

    for ( i = 0 ; i < RNIC_MAX_TIMER_NUM ; i++ )
    {
        if ( ( RNIC_TIMER_STATUS_RUNING  == pstRnicTimerCtx[i].enTimerStatus )
          && ( enTimerId                 == pstRnicTimerCtx[i].enTimerId))
        {
            break;
        }
    }

    if ( i >= RNIC_MAX_TIMER_NUM)
    {
        RNIC_WARNING_LOG1(ACPU_PID_RNIC, "RNIC_StopTimer:too many timer", enTimerId);
        return;
    }

    /* 停止VOS定时器: 当定时器的指针已经为空的时候, 说明其已经停止或者超时 */
    if (VOS_NULL_PTR != pstRnicTimerCtx[i].hTimer)
    {
        VOS_StopRelTimer(&(pstRnicTimerCtx[i].hTimer));
    }

    pstRnicTimerCtx[i].hTimer        = VOS_NULL_PTR;
    pstRnicTimerCtx[i].enTimerId     = TI_RNIC_TIMER_BUTT;
    pstRnicTimerCtx[i].enTimerStatus = RNIC_TIMER_STATUS_STOP;

    /* 定时器状态勾包出来 */
#if (FEATURE_ON == FEATURE_LTE)
    /* 如果已经设置了唤醒源标志,并且是按需断开定时器,则清除该标志,并且设置32K时钟为非唤醒源 */
    if ((VOS_TRUE == RNIC_GetTimer4WakeFlg())
     && (TI_RNIC_DEMAND_DIAL_DISCONNECT == enTimerId))
    {
        BSP_PWC_DelTimer4WakeSrc();

        RNIC_SetTimer4WakeFlg(VOS_FALSE);
    }
#endif
}
VOS_UINT32 RRM_StopTimer
(
    RRM_RFID_ENUM_UINT16                enRFIDTimerId
)
{
    RRM_RFID_TIMER_CTRL_STRU           *pstRFIDTimerAddr;


    /*获取该状态定时器控制块地址*/
    pstRFIDTimerAddr       = RRM_GetRFIDTimerAddr(enRFIDTimerId);

    /*无法获取该定时器控制块,说明定时器ID非法*/
    if(VOS_NULL_PTR == pstRFIDTimerAddr)
    {
        /* 打印错误信息 */
        RRM_WARNING_LOG1(UEPS_PID_RRM, "TimerId is Error!", enRFIDTimerId);
        return VOS_ERR;
    }

    /* 定时器的ID标识是否一致,如果不一致,直接返回 */
    if (enRFIDTimerId != pstRFIDTimerAddr->enRFIDTimerId)
    {
        /* 打印错误信息 */
        RRM_WARNING_LOG2(UEPS_PID_RRM,
                       "enRFIDTimerId is <1>, RFIDTimerId is <2>!",
                       enRFIDTimerId, pstRFIDTimerAddr->enRFIDTimerId);

        return VOS_ERR;
    }

    /*检查该状态定时器是否在运行,如果正在运行,停止该定时器。
      停止定时器时,VOS会直接将该定时器句柄清除为VOS_NULL_PTR*/
    if(VOS_NULL_PTR != pstRFIDTimerAddr->pstStaTHandle)
    {
        VOS_StopRelTimer(&(pstRFIDTimerAddr->pstStaTHandle));

        /* Timer ID清除 */
        pstRFIDTimerAddr->enRFIDTimerId = RRM_RFID_BUTT;
    }

    return VOS_OK;
}
VOS_VOID CMMCA_StopTimer(
    VOS_UINT32                          ulPid,
    CMMCA_TIMER_ID_ENUM_UINT32          enTimerId
)
{
    VOS_UINT32                          i;
    CMMCA_TIMER_CTX_STRU               *pstTiCtx;

    pstTiCtx = CMMCA_GetTiCtx();

    /* 如果该定时器已经启动则直接返回 */
    for (i = 0; i < CMMCA_MAX_TIMER_NUM; i++)
    {
        if ((CMMCA_TIMER_STATUS_RUNNING == pstTiCtx[i].enTimerStatus)
         && (enTimerId               == pstTiCtx[i].enTimerId))
        {
            break;
        }
    }

    /* 未找到该定时器 */
    if ( i >= CMMCA_MAX_TIMER_NUM)
    {
        return;
    }

    /* 停止VOS定时器: 当定时器的指针已经为空的时候, 说明其已经停止或者超时 */
    if (VOS_NULL_PTR != pstTiCtx[i].hTimer)
    {
        VOS_StopRelTimer(&(pstTiCtx[i].hTimer));
    }

    pstTiCtx[i].hTimer        = VOS_NULL_PTR;
    pstTiCtx[i].enTimerId     = TI_CMMCA_TIMER_BUTT;
    pstTiCtx[i].enTimerStatus = CMMCA_TIMER_STATUS_STOP;

    /* 勾包CMMCA_TIMER_INFO_STRU */
    CMMCA_MNTN_TraceTimerOperation(ulPid, enTimerId, 0, CMMCA_TIMER_OPERATION_STOP);

    return;
}
VOS_VOID  RNIC_StopTimer(
    RNIC_TIMER_ID_ENUM_UINT16           enTimerId
)
{
    RNIC_TIMER_CTX_STRU                *pstRnicTimerCtx;

    pstRnicTimerCtx   =  RNIC_GetTimerAddr();

    /* 不在使用的定时器范围内 */
    if (enTimerId >= RNIC_MAX_TIMER_NUM)
    {
        return;
    }

    /* 没有启动则不需要停止 */
    if (RNIC_TIMER_STATUS_RUNING  != pstRnicTimerCtx[enTimerId].enTimerStatus)
    {
        return;
    }

    /* 停止VOS定时器: 当定时器的指针已经为空的时候, 说明其已经停止或者超时 */
    if (VOS_NULL_PTR != pstRnicTimerCtx[enTimerId].hTimer)
    {
        VOS_StopRelTimer(&(pstRnicTimerCtx[enTimerId].hTimer));
    }

    pstRnicTimerCtx[enTimerId].hTimer        = VOS_NULL_PTR;
    pstRnicTimerCtx[enTimerId].enTimerStatus = RNIC_TIMER_STATUS_STOP;

    /* 定时器状态勾包出来 */
#if (FEATURE_ON == FEATURE_LTE)
    /* 如果已经设置了唤醒源标志,并且是按需断开定时器,则清除该标志,并且设置32K时钟为非唤醒源 */
    if ((VOS_TRUE == RNIC_GetTimer4WakeFlg())
     && (TI_RNIC_DEMAND_DIAL_DISCONNECT == enTimerId))
    {
        BSP_PWC_DelTimer4WakeSrc();

        RNIC_SetTimer4WakeFlg(VOS_FALSE);
    }
#endif
}
VOS_VOID  TAF_SPM_StopTimer(
    TAF_SPM_TIMER_ID_ENUM_UINT32        enTimerId,
    VOS_UINT16                          usClientId
)
{
    TAF_SPM_TIMER_CTX_STRU             *pstSpmTimerCtx = VOS_NULL_PTR;
    VOS_UINT32                          i;

    pstSpmTimerCtx   =  TAF_SPM_GetTimerCtxAddr();

    for (i = 0 ; i < TAF_SPM_MAX_TIMER_NUM ; i++)
    {
        if ((TAF_SPM_TIMER_STATUS_RUNING  == pstSpmTimerCtx[i].enTimerStatus)
         && (enTimerId                    == pstSpmTimerCtx[i].enTimerId)
         && (usClientId                   == pstSpmTimerCtx[i].usClientId))
        {
            break;
        }
    }

    if (i >= TAF_SPM_MAX_TIMER_NUM)
    {
        TAF_WARNING_LOG2(WUEPS_PID_TAF,"TAF_SPM_StopTimer:timer already stoppe", (VOS_INT32)enTimerId, usClientId);
        return;
    }

    /* 停止VOS定时器: 当定时器的指针已经为空的时候, 说明其已经停止或者超时 */
    if (VOS_NULL_PTR != pstSpmTimerCtx[i].hTimer)
    {
        VOS_StopRelTimer(&(pstSpmTimerCtx[i].hTimer));
    }

    pstSpmTimerCtx[i].hTimer            = VOS_NULL_PTR;
    pstSpmTimerCtx[i].enTimerId         = TI_TAF_SPM_TIMER_BUTT;
    pstSpmTimerCtx[i].enTimerStatus     = TAF_SPM_TIMER_STATUS_STOP;
    pstSpmTimerCtx[i].usClientId        = TAF_SPM_INVALID_CLIENT_ID;
    
    TAF_SPM_SndOmTimerStatus(TAF_SPM_TIMER_STATUS_STOP, enTimerId, 0, usClientId);  
}
示例#13
0
VOS_VOID  TAF_MMA_StopTimer(
    TAF_MMA_TIMER_ID_ENUM_UINT32        enTimerId
)
{
    TAF_MMA_TIMER_CTX_STRU             *pstMmaTimerCtx = VOS_NULL_PTR;
    VOS_UINT32                          i;

    pstMmaTimerCtx   =  TAF_MMA_GetTimerCtxAddr();

    for (i = 0 ; i < TAF_MMA_MAX_TIMER_NUM ; i++)
    {
        if ((TAF_MMA_TIMER_STATUS_RUNING  == pstMmaTimerCtx[i].enTimerStatus)
         && (enTimerId                    == pstMmaTimerCtx[i].enTimerId))
        {
            break;
        }
    }

    if (i >= TAF_MMA_MAX_TIMER_NUM)
    {
        TAF_WARNING_LOG1(WUEPS_PID_MMA,"TAF_MMA_StopTimer:timer already stoped", (VOS_INT32)enTimerId);
        return;
    }

    /* 停止VOS定时器: 当定时器的指针已经为空的时候, 说明其已经停止或者超时 */
    if (VOS_NULL_PTR != pstMmaTimerCtx[i].hTimer)
    {
        VOS_StopRelTimer(&(pstMmaTimerCtx[i].hTimer));
    }

    pstMmaTimerCtx[i].hTimer            = VOS_NULL_PTR;
    pstMmaTimerCtx[i].enTimerId         = TI_TAF_MMA_TIMER_BUTT;
    pstMmaTimerCtx[i].enTimerStatus     = TAF_MMA_TIMER_STATUS_STOP;

    TAF_MMA_SndOmTimerStatus(TAF_MMA_TIMER_STATUS_STOP, enTimerId, 0);
}
VOS_UINT32 diag_FsExportProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
    //DIAG_CMD_FS_EXPORT_REQ* pstFsReq = NULL;
    DIAG_CMD_FS_EXPORT_CNF *pstFsCnf = NULL;
    VOS_UINT32 ret = ERR_MSP_SUCCESS;
    VOS_UINT32 ulReadSize = 0;
#if(VOS_OS_VER == VOS_LINUX)
    mm_segment_t old_fs;
#endif


    if (DIAG_FILE_NULL == g_stDiagFileInfo.lFile)
    {

		diag_fs_log();
         return ERR_MSP_FAILURE;
    }

    /*停止定时器*/
    VOS_StopRelTimer(&g_stDiagFileInfo.hTimer);
	diag_fs_log();

    pstFsCnf = (DIAG_CMD_FS_EXPORT_CNF*)VOS_MemAlloc(diag_GetAgentPid(), DYNAMIC_MEM_PT, sizeof(DIAG_CMD_FS_EXPORT_CNF)+DIAG_TRANSFER_BLOCK_MAX_SIZE);
    if (VOS_NULL_PTR == pstFsCnf)
    {

		diag_fs_log();
        diag_FsClose();
        return ERR_MSP_FAILURE;

    }

#if(VOS_OS_VER == VOS_LINUX)
    old_fs = get_fs();
    set_fs(KERNEL_DS);
#endif

#if(VOS_OS_VER == VOS_LINUX)
    ulReadSize = (VOS_UINT32)DIAG_FS_READ(g_stDiagFileInfo.lFile,(VOS_CHAR*)pstFsCnf + sizeof(DIAG_CMD_FS_EXPORT_CNF), DIAG_TRANSFER_BLOCK_MAX_SIZE);
#else
    ulReadSize = (VOS_UINT32)DIAG_FS_READ((FILE *)g_stDiagFileInfo.lFile,(VOS_CHAR*)pstFsCnf + sizeof(DIAG_CMD_FS_EXPORT_CNF), DIAG_TRANSFER_BLOCK_MAX_SIZE);
#endif

	diag_fs_log();

#if(VOS_OS_VER == VOS_LINUX)
    set_fs(old_fs);
#endif

    /*读取文件出现错误*/
    if (DIAG_FS_ERROR == (VOS_INT32)ulReadSize)
    {

		diag_fs_log();
        VOS_MemFree(diag_GetAgentPid(),pstFsCnf);
        diag_FsClose();
        return ERR_MSP_FAILURE;

    }

    /*表明已经没有内容可以读取,文件内容全部读完*/
    if (0 == ulReadSize)
    {

		diag_fs_log();
        diag_FsClose();
    }
    else
    {

		diag_fs_log();
        /*启动定时器*/
        g_stDiagFileInfo.hTimer = VOS_NULL_PTR;
        ret = VOS_StartRelTimer(&g_stDiagFileInfo.hTimer, diag_GetAgentPid(), DIAG_CMD_FILE_OPS_TIME_OUT_LEN, 0, DIAG_TMR_FILE_OP_TIMEOUT_PARAM, VOS_RELTIMER_NOLOOP, VOS_TIMER_NO_PRECISION);
        if(ret != ERR_MSP_SUCCESS)
        {
            diag_printf("VOS_StartRelTimer fail [%s]\n", __func__);
        }

	}

    pstFsCnf->ulRet = ret;
    pstFsCnf->ulSize = ulReadSize;

    /*打包回复给FW*/
    ret = diag_AgentCnfFun((VOS_UINT8*)pstFsCnf,ulCmdId,sizeof(DIAG_CMD_FS_EXPORT_CNF)+ulReadSize);
    VOS_MemFree(diag_GetAgentPid(),pstFsCnf);

	diag_fs_log();
    return ret;

}
VOS_UINT32 diag_FsImportProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
    DIAG_CMD_FS_IMPORT_REQ* pstFsReq = NULL;
    DIAG_CMD_FS_IMPORT_CNF stFsCnf = {0};
    VOS_UINT32 ret = ERR_MSP_SUCCESS;
    VOS_INT32 lResult =0;
#if(VOS_OS_VER == VOS_LINUX)
    mm_segment_t old_fs;
#endif

    pstFsReq = (DIAG_CMD_FS_IMPORT_REQ*)(DIAG_OFFSET_HEAD_GET_DATA(pstReq));

    if (DIAG_FILE_NULL == g_stDiagFileInfo.lFile)
    {
        return ERR_MSP_FAILURE;
    }
    diag_fs_log();

    /*停止定时器*/
    VOS_StopRelTimer(&g_stDiagFileInfo.hTimer);

    /*写文件完毕,关闭文件*/
    if (0 == pstFsReq->ulSize)
    {

		diag_fs_log();
        diag_FsClose();
        /*打包回复给FW*/
        stFsCnf.ulRet = ERR_MSP_SUCCESS;
        ret = diag_AgentCnfFun((VOS_UINT8*)&stFsCnf,ulCmdId,sizeof(DIAG_CMD_FS_IMPORT_CNF));
        return ret;
    }

#if(VOS_OS_VER == VOS_LINUX)
    old_fs = get_fs();
    set_fs(KERNEL_DS);
#endif

#if(VOS_OS_VER == VOS_LINUX)
    lResult = DIAG_FS_WRITE(g_stDiagFileInfo.lFile, pstFsReq->acContent, pstFsReq->ulSize);
#else
    lResult = DIAG_FS_WRITE((FILE *)g_stDiagFileInfo.lFile, pstFsReq->acContent, pstFsReq->ulSize);
#endif

	diag_fs_log();

#if(VOS_OS_VER == VOS_LINUX)
    set_fs(old_fs);
#endif

    /*写文件操作失败或者写入长度不正确*/
    if ((DIAG_FS_ERROR == lResult)||(lResult != (VOS_INT32)(pstFsReq->ulSize)))
    {
		diag_fs_log();
		diag_printf("[%s]!,lResult=%d\n",__FUNCTION__,lResult);
		diag_FsClose();
        return VOS_ERR;
    }

    /*启动定时器*/
    ret = VOS_StartRelTimer(&g_stDiagFileInfo.hTimer, diag_GetAgentPid(),DIAG_CMD_FILE_OPS_TIME_OUT_LEN,0,DIAG_TMR_FILE_OP_TIMEOUT_PARAM,VOS_RELTIMER_NOLOOP, VOS_TIMER_NO_PRECISION);
    if(ret != ERR_MSP_SUCCESS)
    {
        diag_printf("VOS_StartRelTimer fail [%s]\n",__func__);
    }

    stFsCnf.ulRet = ret;

    /*打包回复给FW*/
    ret = diag_AgentCnfFun((VOS_UINT8*)&stFsCnf,ulCmdId,sizeof(DIAG_CMD_FS_IMPORT_CNF));
    return ret;

}
VOS_UINT32 l4a_StopTimer(HTIMER *phTimerId)
{
    /*删除定时器*/
    return VOS_StopRelTimer(phTimerId);
}
示例#17
0
/*****************************************************************************
 Prototype      : Ppp_ReleasePppReq
 Description    : 为AT模块"释放PPP链路"提供对应的API函数。

 Input          : ---要释放的PPP链路对应的PPP ID
 Output         : ---
 Return Value   : ---VOS_UINT32
 Calls          : ---
 Called By      : ---

 History        : ---
  1.Date        : 2005-11-18
    Author      : ---
    Modification: Created function
*****************************************************************************/
VOS_UINT32 Ppp_ReleasePppReq ( PPP_ID usPppId)
{
    VOS_UINT32                          ulRet;


    /* 可维可测信息上报*/
    Ppp_EventMntnInfo(usPppId, AT_PPP_RELEASE_PPP_REQ);

    if(VOS_OK != PppIsIdValid(usPppId))
    {
        return VOS_ERR;
    }

    /* 如果当前PPP在PHASE_NETWORK阶段,属于网侧主动去激活
       此时PPP等待和PC间PPP协议结束后通知AT拉管脚信号,并起定时器保护*/
    if (PHASE_NETWORK == (PPP_LINK(usPppId)->phase))
    {
        if (VOS_NULL_PTR != (PPP_LINK(usPppId)->lcp.hLcpCloseTimer))
        {
            PS_STOP_REL_TIMER(&(PPP_LINK(usPppId)->lcp.hLcpCloseTimer));
            PPP_LINK(usPppId)->lcp.hLcpCloseTimer= VOS_NULL_PTR;
        }

        /*起定时器,确保通知拉AT管脚信号*/
        ulRet = VOS_StartRelTimer(&(PPP_LINK(usPppId)->lcp.hLcpCloseTimer),  PS_PID_APP_PPP,
            1000,  usPppId,  PHASE_TERMINATE_PENDING,  VOS_RELTIMER_NOLOOP,  VOS_TIMER_PRECISION_5 );

        if (VOS_OK != ulRet)
        {
            PPP_LINK(usPppId)->lcp.hLcpCloseTimer = VOS_NULL_PTR;
            PPP_ProcPppDisconnEvent(usPppId);
        }
    }

    /*首先调用PPP模块对应的函数*/
    fsm_Close(&(PPP_LINK(usPppId)->ipcp.fsm));
    fsm_Close(&(PPP_LINK(usPppId)->lcp.fsm));

    /*停止IPCP状态机定时器:*/
    if( VOS_NULL_PTR !=((PPP_LINK(usPppId))->ipcp.fsm.timer) )
    {
        VOS_StopRelTimer(&((PPP_LINK(usPppId))->ipcp.fsm.timer));
        (PPP_LINK(usPppId))->ipcp.fsm.timer = VOS_NULL_PTR;
    }

    /*停止CHAP状态机定时器:*/
    if( VOS_NULL_PTR !=((PPP_LINK(usPppId))->chap.auth.hAuthTimer) )
    {
        VOS_StopRelTimer(&((PPP_LINK(usPppId))->chap.auth.hAuthTimer));
        (PPP_LINK(usPppId))->chap.auth.hAuthTimer = VOS_NULL_PTR;
    }

    /*停止LCP状态机定时器:*/
    if( VOS_NULL_PTR !=((PPP_LINK(usPppId))->lcp.fsm.timer) )
    {
        VOS_StopRelTimer(&((PPP_LINK(usPppId))->lcp.fsm.timer));
        (PPP_LINK(usPppId))->lcp.fsm.timer = VOS_NULL_PTR;
    }

    /*释放待PDP激活定时器*/
    if (VOS_NULL_PTR != (PPP_LINK(usPppId)->ipcp.hIpcpPendTimer))
    {
        PS_STOP_REL_TIMER(&(PPP_LINK(usPppId)->ipcp.hIpcpPendTimer));
        PPP_LINK(usPppId)->ipcp.hIpcpPendTimer = VOS_NULL_PTR;
    }

    /*释放待处理IPCP帧*/
    if (VOS_NULL_PTR != (PPP_LINK(usPppId)->ipcp.pstIpcpPendFrame))
    {
        ppp_m_freem(PPP_LINK(usPppId)->ipcp.pstIpcpPendFrame);
        PPP_LINK(usPppId)->ipcp.pstIpcpPendFrame = VOS_NULL_PTR;
    }

    PppFreeId(usPppId);

    /* 不用释放PPP数据队列,因为只要队列里面有数据,PPP任务就会被调度起来处理,
       如果HDLC处理完成而PPP实体已经释放,那么封装或解封装出来的数据自然会被丢弃。
       这个API会在AT任务里被调用,如果这里把数据放掉,PPP任务有可能正在使用 */
    /* PPP_ClearDataQ(); */

    /*返回正确*/
    return VOS_OK;
}
VOS_VOID  NAS_MMC_StopTimer(
    NAS_MMC_TIMER_ID_ENUM_UINT16        enTimerId
)
{
    NAS_MMC_TIMER_CTX_STRU             *pstMmcTimerCtx;
    VOS_UINT32                          i;

    VOS_UINT32                          ulTimerRemainLen;

    ulTimerRemainLen = 0;


    pstMmcTimerCtx   =  NAS_MMC_GetTimerAddr();

    for ( i = 0 ; i < NAS_MMC_MAX_TIMER_NUM ; i++ )
    {
        if ( ( NAS_MMC_TIMER_STATUS_RUNING  == pstMmcTimerCtx[i].enTimerStatus )
          && ( enTimerId                    == pstMmcTimerCtx[i].enTimerId))
        {
            break;
        }
    }

    if ( i >= NAS_MMC_MAX_TIMER_NUM)
    {
        NAS_NORMAL_LOG1(WUEPS_PID_MMC, "NAS_MMC_StopTimer:Timer not running", enTimerId);

        return;
    }

    /* 停止VOS定时器: 当定时器的指针已经为空的时候, 说明其已经停止或者超时 */
    if (VOS_NULL_PTR != pstMmcTimerCtx[i].hTimer)
    {


        /* 获取当前定时器的剩余时间 */
        if (VOS_OK != VOS_GetRelTmRemainTime(&(pstMmcTimerCtx[i].hTimer), &ulTimerRemainLen ))
        {
            ulTimerRemainLen = 0;
        }



        (VOS_VOID)VOS_StopRelTimer(&(pstMmcTimerCtx[i].hTimer));
    }

    pstMmcTimerCtx[i].hTimer        = VOS_NULL_PTR;
    pstMmcTimerCtx[i].enTimerId     = TI_NAS_MMC_TIMER_BUTT;
    pstMmcTimerCtx[i].enTimerStatus = NAS_MMC_TIMER_STATUS_STOP;



    if (0!=ulTimerRemainLen)
    {
        NAS_TIMER_EventReport(enTimerId, WUEPS_PID_MMC, NAS_OM_EVENT_TIMER_OPERATION_STOP);
    }


    /* 定时器状态勾包出来 */
    NAS_MMC_SndOmMmcTimerStatus(NAS_MMC_TIMER_STATUS_STOP, enTimerId, ulTimerRemainLen * 10);




}
VOS_VOID Monitor_QueryTask( VOS_VOID )
{
#if 0
    VOS_UINT32       ulRet;
#endif

    for(;;)
    {
        /* 等待信号量 */
        VOS_SmP(g_ulMonitorCtrlSem, 0);

#if 0

        switch ( g_ulMonitorConnectState )
        {
            case MONITOR_IDLE_STATE:

                if (ID_PHY_MONITOR_QUERY_IND == g_ulMonitorIndType )   /* IDLE态收到环境查询中断 */
                {
                    Moniter_SendReq(WUEPS_PID_MONITOR,ID_MONITOR_TEMP_QUERY_REQ);
                }
                else                                        /* IDLE态收到进入NORMAL态中断 */
                {
                    if (VOS_NULL_PTR == g_hQueryTimer)
                    {
                       ulRet = VOS_StartRelTimer( &g_hQueryTimer,
                                                   WUEPS_PID_MONITOR,
                                                   2000,
                                                   MONITOR_TIMER_NAME_QUERY,
                                                   0,
                                                   VOS_RELTIMER_LOOP );

                        if(VOS_OK != ulRet)
                        {
                            g_ulMonitorErrCode |= MONITOR_ERR_CODE_TIMER;
                        }
                    }

                    g_ulMonitorConnectState = MONITOR_CONNECT_STATE;
                }

                break;

            case MONITOR_CONNECT_STATE:      /* 进入CONN态 */

                if (ID_PHY_MONITOR_QUERY_IND == g_ulMonitorIndType )   /* IDLE态收到环境查询中断 */
                {
                    if( VOS_NULL_PTR != g_hQueryTimer )
                    {
                        VOS_StopRelTimer( &g_hQueryTimer );
                    }

                    g_hQueryTimer = VOS_NULL_PTR;

                    Moniter_SendReq(WUEPS_PID_MONITOR, ID_MONITOR_TEMP_QUERY_REQ);

                    g_ulMonitorConnectState = MONITOR_IDLE_STATE;
                }
                else
                {
                    g_ulMonitorErrCode |= MONITOR_ERR_CODE_INT;
                }

                break;

            default:
                break;
        }
#endif
    }
}
VOS_UINT32 VOS_Startup( enum VOS_STARTUP_PHASE ph )
{
    VOS_UINT32      ulReturnValue;
    VOS_UINT32      ulStartUpFailStage = 0;

    switch(ph)
    {
    case VOS_STARTUP_INIT_DOPRA_SOFEWARE_RESOURCE :
        vos_StartUpStage = 0x00010000;

        if ( VOS_OK != VOS_MemInit() )
        {
            ulStartUpFailStage |= 0x0001;

            break;
        }

        VOS_SemCtrlBlkInit();

        VOS_QueueCtrlBlkInit();

        VOS_TaskCtrlBlkInit();

        VOS_TimerCtrlBlkInit();

        OM_RecordMemInit();

        if ( VOS_OK != RTC_TimerCtrlBlkInit() )
        {
            ulStartUpFailStage |= 0x0100;
        }

#if (OSA_CPU_CCPU == VOS_OSA_CPU)
        if ( VOS_OK != VOS_DrxTimerCtrlBlkInit())
        {
            ulStartUpFailStage |= 0x0200;
        }
#endif

        if ( VOS_OK != VOS_PidCtrlBlkInit() )
        {
            ulStartUpFailStage |= 0x0400;
        }

        if ( VOS_OK != VOS_FidCtrlBlkInit() )
        {
            ulStartUpFailStage |= 0x0800;
        }

        if ( VOS_OK != CreateFidsQueque() )
        {
            ulStartUpFailStage |= 0x1000;
        }
        break;

    case VOS_STARTUP_SET_TIME_INTERRUPT:
        vos_StartUpStage = 0x00020000;
        break;

    case VOS_STARTUP_CREATE_TICK_TASK:
        vos_StartUpStage = 0x00040000;
        /* create soft timer task */
        if ( VOS_OK != VOS_TimerTaskCreat() )
        {
            ulStartUpFailStage |= 0x0001;
        }

        if ( VOS_OK != RTC_TimerTaskCreat() )
        {
            ulStartUpFailStage |= 0x0002;
        }

#if (OSA_CPU_CCPU == VOS_OSA_CPU)
        if ( VOS_OK != VOS_DrxTimerTaskCreat() )
        {
            ulStartUpFailStage |= 0x0004;
        }
#endif

        break;

    case VOS_STARTUP_CREATE_ROOT_TASK:
        vos_StartUpStage = 0x00080000;

        if ( VOS_OK !=
                VOS_StartCallBackRelTimer(&g_VosProtectInitTimer,
                                          DOPRA_PID_TIMER, 20000, 0, 0,
                                          VOS_RELTIMER_NOLOOP, VOS_ProtectInit, VOS_TIMER_NO_PRECISION) )
        {
            ulStartUpFailStage |= 0x0001;
        }

        g_ulVosStartStep = 0x0000;

        ulReturnValue = VOS_OutsideInit();

        if(VOS_OK != ulReturnValue)
        {
            ulStartUpFailStage |= ulReturnValue;
        }

        g_ulVosStartStep = 0x0004;

        if ( VOS_OK != WD_TaskCreat() )
        {
            ulStartUpFailStage |= 0x0004;
        }

        g_ulVosStartStep = 0x0008;

        if ( VOS_OK != VOS_FidsInit() )
        {
            ulStartUpFailStage |= 0x0008;
        }

        g_ulVosStartStep = 0x0010;

#if 0
        /* 创建VOS各FID任务之前,锁任务 */
        if ( VOS_OK != VOS_TaskLock() )
        {
            ulStartUpFailStage |= 0x0010;
        }
#endif
        g_ulVosStartStep = 0x0020;

        /* create FID task & selftask task */
        if ( VOS_OK != CreateFidsTask() )
        {
            ulStartUpFailStage |= 0x0020;
        }

#if (VOS_WIN32 != VOS_OS_VER)
        g_ulVosStartStep = 0x0040;

        /* suspend FID task & selftask task */
        if ( VOS_OK != VOS_SuspendFidsTask() )
        {
            ulStartUpFailStage |= 0x0040;
        }
#endif

        g_ulVosStartStep = 0x0080;
#if 0
        /* 创建VOS各FID任务完成后解锁 */
        if ( VOS_OK != VOS_TaskUnlock() )
        {
            ulStartUpFailStage |= 0x0080;
        }
#endif
        g_ulVosStartStep = 0x0100;

        if ( VOS_OK != VOS_PidsInit() )
        {
            ulStartUpFailStage |= 0x0100;
        }
        break;

    case VOS_STARTUP_SUSPEND_MAIN_TASK:
        vos_StartUpStage = 0x00100000;

        g_ulVosStartStep = 0x0001;

        /* Resume任务之前,锁任务 */
        if ( VOS_OK != VOS_TaskLock() )
        {
            ulStartUpFailStage |= 0x0001;
        }

#if (VOS_WIN32 != VOS_OS_VER)

        g_ulVosStartStep = 0x0002;

        /* Resume FID task & selftask task */
        if ( VOS_OK != VOS_ResumeFidsTask() )
        {
            ulStartUpFailStage |= 0x0002;
        }
#endif

        g_ulVosStartStep = 0x0004;

        /* Resume任务之后解锁 */
        if ( VOS_OK != VOS_TaskUnlock() )
        {
            ulStartUpFailStage |= 0x0004;
        }

        g_ulVosStartStep = 0x0008;

        /* stop protect timer */
        VOS_StopRelTimer(&g_VosProtectInitTimer);

#if (OSA_CPU_CCPU == VOS_OSA_CPU)
        /* OSA初始化完成,需要调用DRV函数通知DRV OSA启动完成 */
        if ( VOS_OK != DRV_CCPU_RESET_OVER() )
        {
            ulStartUpFailStage |= 0x0008;
        }
#endif

#if (VOS_LINUX == VOS_OS_VER)
        VOS_RunTask();
#endif


        break;

    default:
        break;
    }

    /* calculate return value */
    if( 0 != ulStartUpFailStage )
    {
        ulReturnValue = vos_StartUpStage;
        ulReturnValue |= ulStartUpFailStage;
        Print1("startup retuen value is %x.\r\n",ulReturnValue);

        /* reboot */
        VOS_ProtectionReboot(OSA_INIT_ERROR, (VOS_INT)ulReturnValue,
                             (VOS_INT)g_ulOmPidInit, (VOS_CHAR *)&g_ulOmFidInit, sizeof(VOS_UINT32));

        return(ulReturnValue);
    }
    else
    {
        return(VOS_OK);
    }
}