Exemplo n.º 1
0
VOS_VOID TAF_SPM_FreeSpecificedIndexMessageInCcQueue(
    VOS_UINT8                           ucIndex
)
{
    VOS_UINT8                           ucCacheMsgNum;
    TAF_SPM_CACHE_MSG_INFO_STRU        *pstCachedMsgInfo = VOS_NULL_PTR;

    /* get the specified index message address */
    pstCachedMsgInfo = TAF_SPM_GetSpecifiedIndexMessageAddrFromCcQueue(ucIndex);    

    /* get the cached message number */
    ucCacheMsgNum = TAF_SPM_GetCcMsgQueueNum();

    if (0 < ucCacheMsgNum)
    {
        /* update the cached message number */
        ucCacheMsgNum--;
        TAF_SPM_SetCcMsgQueueNum(ucCacheMsgNum);
        
        /* by the way, move the cached messages forward */
        PS_MEM_MOVE(pstCachedMsgInfo, 
                    (pstCachedMsgInfo+1),
                    (ucCacheMsgNum - ucIndex) * sizeof(TAF_SPM_CACHE_MSG_INFO_STRU));

        PS_MEM_SET((pstCachedMsgInfo + ucCacheMsgNum), 0, sizeof(TAF_SPM_CACHE_MSG_INFO_STRU));                    
    }
}
Exemplo n.º 2
0
VOS_VOID TAF_SPM_FreeSpecificedIndexSmsRedialBuffer(VOS_UINT8 ucIndex)
{
    VOS_UINT8                           ucCacheMsgNum;
    TAF_SPM_ENTRY_MSG_STRU             *pstCachedMsgInfo = VOS_NULL_PTR;

    /* get the specified index message address */
    pstCachedMsgInfo = TAF_SPM_GetSpecificedIndexFromSmsRedialBuffer(ucIndex);    

    /* get the cached message number */
    ucCacheMsgNum = TAF_SPM_GetNumberOfSmsRedialBuffer();

    if (0 < ucCacheMsgNum)
    {
        /* update the cached message number */
        ucCacheMsgNum--;
        TAF_SPM_SetNumberOfSmsRedialBuffer(ucCacheMsgNum);
        
        /* by the way, move the cached messages forward */
        PS_MEM_MOVE(pstCachedMsgInfo, 
                    (pstCachedMsgInfo+1),
                    (ucCacheMsgNum - ucIndex) * sizeof(TAF_SPM_ENTRY_MSG_STRU));

        PS_MEM_SET((pstCachedMsgInfo + ucCacheMsgNum), 0, sizeof(TAF_SPM_ENTRY_MSG_STRU));
    }
}
Exemplo n.º 3
0
VOS_UINT32  TAF_APS_ClearCacheMsg(
    VOS_UINT32                          ulEventType
)
{
    TAF_APS_MSG_QUEUE_STRU             *pstMsgQueue = VOS_NULL_PTR;
    VOS_INT8                            i;
    VOS_INT8                            cCachePos;

    pstMsgQueue                         = TAF_APS_GetCachMsgBufferAddr();
    cCachePos                           = -1;

    /* 先找到需要被清除的缓存 */
    for ( i = 0 ; i < pstMsgQueue->ucCacheMsgNum ; i++ )
    {
        if ( ulEventType == pstMsgQueue->astMsgQueue[i].stMsgEntry.ulEventType )
        {
            PS_MEM_SET(&(pstMsgQueue->astMsgQueue[i].stMsgEntry),
                       0x00,
                       sizeof(TAF_APS_ENTRY_MSG_STRU));
            cCachePos = (VOS_INT8)i;
            break;
        }
    }

    /* 未找到该消息类型直接返回 */
    if ( -1 == cCachePos )
    {
        TAF_INFO_LOG1(WUEPS_PID_TAF,"TAF_APS_ClearCacheMsg:invalid msg type", (VOS_INT32)ulEventType);
        return VOS_FALSE;
    }

    /* 为保证先入先出,需要将后面的消息移到前面 */
    for ( i = cCachePos ; i < (pstMsgQueue->ucCacheMsgNum - 1) ; i++ )
    {
        /* COPY消息内容 */
        PS_MEM_MOVE(&(pstMsgQueue->astMsgQueue[i].stMsgEntry),
                   &(pstMsgQueue->astMsgQueue[i + 1].stMsgEntry),
                   sizeof(TAF_APS_ENTRY_MSG_STRU));

    }

    /* 将缓存个数减一 */
    pstMsgQueue->ucCacheMsgNum--;

    /* 将当前缓存给打印出来 */
    /* TAF_APS_LogBufferQueueMsg(VOS_FALSE); */

    return VOS_OK;
}