VOS_VOID OM_HsicInitMsgProc(MsgBlock* pMsg)
{
    SC_PORT_STATUS_ENUM_UINT32          enStatus;

    /* 获取DK文件中端口关联设置 */
    if (SC_ERROR_CODE_NO_ERROR != SC_FAC_GetPortAttrib(&enStatus))
    {
        PS_LOG(WUEPS_PID_OM, 0, PS_PRINT_ERROR, "OM_HsicInitMsgProc:SC_FAC_GetPortAttrib error.");

        return;
    }

    /* DK文件设置不做OM和HSIC端口的关联 */
    if (SC_PORT_STATUS_ON != enStatus)
    {
        return;
    }

    /* 将关联请求发到A核的OMAGENT去处理 */
    if (VOS_OK != OM_HsicConnectReq())
    {
        PS_LOG(WUEPS_PID_OM, 0, PS_PRINT_ERROR, "OM_HsicInitMsgProc:OM_HsicConnectReq error.");

        return;
    }

    return;
}
예제 #2
0
VOS_VOID* TTF_RING_Q_Front(VOS_UINT32 ulPid, TTF_RING_Q_ST *pstRingQ)
{
    VOS_VOID    *pNode;

    if (VOS_NULL_PTR == pstRingQ )
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: pstRingQ is Null !");
        return VOS_NULL_PTR;
    }

    if ( VOS_NULL_PTR == pstRingQ->ppNode) /* pstRingQ is not Initialized ! */
    {
        return VOS_NULL_PTR;
    }

    if ( pstRingQ->ulRear == pstRingQ->ulFront)
    {
        PS_LOG(ulPid, 0, PS_PRINT_INFO, "Info: RingQ is Empty !");
        return VOS_NULL_PTR;
    }

    pNode = pstRingQ->ppNode[pstRingQ->ulFront];

    return pNode;

} /* TTF_RING_Q_Rear */
예제 #3
0
VOS_UINT32 TTF_LinkInsertHead(VOS_UINT32 ulPid, TTF_LINK_ST * pLink, TTF_NODE_ST *pInsert)
{

    if ( (VOS_NULL_PTR == pLink) || (VOS_NULL_PTR == pInsert ))
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: pLink Or pInsert is Null!");
        return PS_FAIL;
    }

#ifdef WTTF_PC_ST_SWITCH
    /*检查节点pInsert是否在链表pLink中*/
    if ( PS_TRUE == TTF_LinkCheckNodeInLink(ulPid, pLink, pInsert) )
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: pInsert has Existed in pLink!");
        return PS_FAIL;
    }
#endif

    pInsert->pPrev              = (TTF_NODE_ST *)(&pLink->stHead);
    pLink->stHead.pNext->pPrev  = pInsert;
    pInsert->pNext              = pLink->stHead.pNext;
    pLink->stHead.pNext         = pInsert;

    pLink->ulCnt++;

    return PS_SUCC;
} /*TTF_LinkInsertHead*/
예제 #4
0
int ps_gstsink_init (ps_callbacks * callback, const char * config_path) {
	if (g_atomic_int_get(&stopping)) return -1;
	//if (callback == NULL || config_path == NULL) return -1;
	if (callback == NULL) return -1;
	
	/* Initialize GSTREAMER */
	gst_init (NULL, NULL);
	
	sessions = g_hash_table_new (NULL, NULL);
	ps_mutex_init (&sessions_mutex);
	messages = g_async_queue_new_full ((GDestroyNotify) ps_gstsink_message_free);
	
	gateway = callback;
	g_atomic_int_set (&initialized, 1);
	
	GError * error = NULL;
	watchdog = g_thread_try_new ("streaming watchdog", &ps_gstsink_watchdog, NULL, &error);
	if (!watchdog) {
		g_atomic_int_set(&initialized, 0);
		PS_LOG (LOG_ERR, "Got error %d (%s) trying to launch the GstSink watchdog thread...\n", error->code, error->message ? error->message : "??");
		return -1;
	}
	handler_thread = g_thread_try_new ("streaming handler", &ps_gstsink_handler, NULL, &error);
	if (!handler_thread) {
		g_atomic_int_set(&initialized, 0);
		PS_LOG (LOG_ERR, "Got error %d (%s) trying to launch the GstSink handler thread...\n", error->code, error->message ? error->message : "??");
		return -1;
	}
	PS_LOG (LOG_INFO, "%s initialized\n", PS_GSTSINK_NAME);
	return 0;
}
예제 #5
0
VOS_UINT32 TTF_LinkStick(VOS_UINT32 ulPid, TTF_LINK_ST *pLink1,
    TTF_LINK_ST *pLink2)
{
    if (VOS_NULL_PTR == pLink1)
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING,
            "TTFCOMM, TTF_LinkStick, ERROR, pLink1 is null\n");
        return VOS_ERR;
    }

    if (VOS_NULL_PTR == pLink2)
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING,
            "TTFCOMM, TTF_LinkStick, ERROR, pLink2 is null\n");
        return VOS_ERR;
    }

    if (TTF_LINK_IS_EMPTY(pLink2))
    {
        return VOS_OK;
    }

    pLink1->stHead.pPrev->pNext = pLink2->stHead.pNext;
    pLink2->stHead.pNext->pPrev = pLink1->stHead.pPrev;
    pLink1->stHead.pPrev        = pLink2->stHead.pPrev;
    pLink2->stHead.pPrev->pNext = (TTF_NODE_ST *)&(pLink1->stHead);

    /*更新长度*/
    pLink1->ulCnt       += pLink2->ulCnt;

    TTF_LINK_INIT(pLink2);

    return VOS_OK;
}
예제 #6
0
TTF_NODE_ST* TTF_LinkRemoveTail(VOS_UINT32 ulPid, TTF_LINK_ST * pLink)
{
    TTF_NODE_ST    *pNode;

    if (VOS_NULL_PTR == pLink)
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: pLink is Null!");
        return VOS_NULL_PTR;
    }

    if (0 == pLink->ulCnt)
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: pLink Cnt is 0!");
        return VOS_NULL_PTR;
    }

    /*异常:链表和链表个数不一致时, 容错处理*/
    if ( pLink->stHead.pNext == &pLink->stHead )
    {
        PS_LOG1(ulPid, 0, PS_PRINT_WARNING, "Warning: pLink is null, but Cnt is <1>!", (VOS_INT32)pLink->ulCnt);
        pLink->ulCnt = 0;
        return VOS_NULL_PTR;
    }

    pNode               = pLink->stHead.pPrev;
    pLink->stHead.pPrev = pNode->pPrev;
    pNode->pPrev->pNext = &pLink->stHead;
    pNode->pNext        = VOS_NULL_PTR;
    pNode->pPrev        = VOS_NULL_PTR;

    pLink->ulCnt--;
    return  pNode;

} /* TTF_LinkRemoveTail */
예제 #7
0
VOS_UINT32 TTF_LinkInsertNext(VOS_UINT32 ulPid, TTF_LINK_ST * pLink,
                TTF_NODE_ST *pCurr, TTF_NODE_ST *pInsert)
{

    if ( (VOS_NULL_PTR == pLink) || (VOS_NULL_PTR == pCurr) || (VOS_NULL_PTR == pInsert))
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: pLink、pCurr Or pInsert is Null!");
        return PS_FAIL;
    }

    /*遍历该节点是否在链表内,若无,返回失败*/





#ifdef WTTF_PC_ST_SWITCH
    /*检查节点pInsert是否在链表pLink中*/
    if ( PS_TRUE == TTF_LinkCheckNodeInLink(ulPid, pLink, pInsert) )
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: pInsert has Existed in pLink!");
        return PS_FAIL;
    }
#endif

    pInsert->pPrev              = pCurr;
    pCurr->pNext->pPrev         = pInsert;
    pInsert->pNext              = pCurr->pNext;
    pCurr->pNext                = pInsert;

    pLink->ulCnt++;

    return PS_SUCC;
}
예제 #8
0
void ps_gstsink_incoming_rtp (ps_plugin_session * handle, int video, char * buf, int len) {
	if (handle == NULL || handle->stopped || g_atomic_int_get(&stopping) || !g_atomic_int_get(&initialized))
		return;
	if (gateway) {
		ps_gstsink_session * session = (ps_gstsink_session *)handle->plugin_handle;
		if(!session) {
			PS_LOG(LOG_ERR, "No session associated with this handle\n");
			return;
		}
		if (session->destroyed) return;
		if (session->active && session->vplayer != NULL) {
			ps_video_packet * pkt = (ps_video_packet *)g_malloc0(sizeof(ps_video_packet));
			if (pkt == NULL) {
				PS_LOG (LOG_FATAL, "Memory error!\n");
				return;
			}
			pkt->data = (char *)g_malloc0(len);
			memcpy(pkt->data, buf, len);
			pkt->length = len;
			pkt->is_video = video;
			if (session->vpackets != NULL)
				g_async_queue_push (session->vpackets, pkt);
		}
		ps_gstsink_send_rtcp_feedback (handle, video, buf, len);
		return;
	}
}
예제 #9
0
/*****************************************************************************
 Function   : HPA_FIDInit
 Description: HPA FID Init
 Input      : Ip
 Return     : void
 Other      :
 *****************************************************************************/
VOS_UINT32 HPA_FIDInit( enum VOS_INIT_PHASE_DEFINE ip )
{
    /* Add for L Only version */
    if (BOARD_TYPE_LTE_ONLY == BSP_OM_GetBoardType())
    {
        return 0;
    }
    /* Add for L Only version */

    switch ( ip )
    {
        case VOS_IP_LOAD_CONFIG:
            if ( VOS_OK != VOS_RegisterPIDInfo(UEPS_PID_SHPA,
                APM_PIDInit, (Msg_Fun_Type)HPA_ApmMsgPIDProc))
            {
                PS_LOG(  UEPS_PID_GHPA, 0, PS_PRINT_ERROR,
                    "VOS_RegisterPIDInfo UEPS_PID_SHPA failure !\n");

                return VOS_ERR;
            }

            if ( VOS_OK
                != VOS_RegisterTaskPrio(WUEPS_FID_HPA, COMM_HPA_TASK_PRIO) )
            {
                PS_LOG(  UEPS_PID_GHPA, 0, PS_PRINT_ERROR,
                    "HPA_FIDInit:VOS_RegisterMsgTaskPrio failure !\n");

                return VOS_ERR;
            }

            if ( VOS_NULL_BYTE == VOS_RegisterSelfTaskPrio(WUEPS_FID_HPA,
                (VOS_TASK_ENTRY_TYPE)HPA_TransferTaskEntry,
                COMM_HPA_SELFTASK_PRIO, HPA_TRANSFER_TASK_STACK_SIZE ) )
            {
                PS_LOG(  UEPS_PID_GHPA, 0, PS_PRINT_ERROR,
                    "VOS_RegisterSelfTask:HPA_TransferTaskEntry failure !\n");

                return VOS_ERR;
            }

            break;

        case VOS_IP_FARMALLOC:
            if(VOS_OK != HPA_Init())
            {
                PS_LOG(  UEPS_PID_GHPA, 0, PS_PRINT_ERROR,
                    "HPA Init failure !\n");
                return VOS_ERR;
            }
            break;

        default:
            break;
    }

    return VOS_OK;
}
VOS_UINT32 OM_AcpuGetNvIdList(APP_OM_MSG_EX_STRU *pstAppToOmMsg,
                                          VOS_UINT16 usReturnPrimId)
{
    VOS_UINT32              ulNvNum;
    VOS_UINT32              ulTotalLen;
    OM_APP_MSG_EX_STRU      *pstOmToAppMsg;
    VOS_UINT32              ulResult;
    OM_APP_GET_NV_LIST_STRU *pstOmGetNvList;

    ulNvNum = NV_GetNVIdListNum();
    /*No NV exist*/
    if (0 == ulNvNum)
    {
        OM_AcpuSendResultChannel(pstAppToOmMsg->ucCpuId, pstAppToOmMsg->ucFuncType, VOS_ERR, usReturnPrimId);
        PS_LOG(WUEPS_PID_OM, 0, PS_PRINT_ERROR, "OM_AcpuGetNvIdList:No NV exist.\n");
        return VOS_ERR;
    }

    /*APP_HEAD + Result + NV nums + NV ID/LEN lists*/
    ulTotalLen = sizeof(OM_APP_MSG_EX_STRU) + sizeof(VOS_UINT32)
                        + (ulNvNum*sizeof(NV_LIST_INFO_STRU));

    pstOmToAppMsg = (OM_APP_MSG_EX_STRU*)VOS_MemAlloc(
                                   WUEPS_PID_OM, DYNAMIC_MEM_PT, ulTotalLen);

    if (VOS_NULL_PTR == pstOmToAppMsg)
    {
        OM_AcpuSendResultChannel(pstAppToOmMsg->ucCpuId, pstAppToOmMsg->ucFuncType, VOS_ERR, usReturnPrimId);
        PS_LOG(WUEPS_PID_OM, 0, PS_PRINT_ERROR, "OM_AcpuGetNvIdList:VOS_MemAlloc Fail.");
        return VOS_ERR;
    }

    pstOmGetNvList = (OM_APP_GET_NV_LIST_STRU*)(pstOmToAppMsg->aucPara);

    /*获取每个NV项的ID和长度*/
    ulResult = NV_GetNVIdList(pstOmGetNvList->astNvInfo);
    if (NV_OK != ulResult)
    {
        VOS_MemFree(WUEPS_PID_OM, pstOmToAppMsg);

        OM_AcpuSendResultChannel(pstAppToOmMsg->ucCpuId, pstAppToOmMsg->ucFuncType, ulResult, usReturnPrimId);
        PS_LOG(WUEPS_PID_OM, 0, PS_PRINT_ERROR, "OM_AcpuGetNvIdList:VOS_MemAlloc Fail.");
        return VOS_ERR;
    }

    /*填写执行结果和NV项数目*/
    pstOmGetNvList->ulErrorCode     = VOS_OK;
    pstOmGetNvList->usCount         = (VOS_UINT16)ulNvNum;
    pstOmGetNvList->ucMsgIndex      = 1;    /*分包索引,先默认为1*/
    pstOmGetNvList->ucTotalMsgCnt   = 1;    /*分包总数,先默认为1*/

    pstOmToAppMsg->usLength = (VOS_UINT16)(ulTotalLen - VOS_OM_HEADER_LEN);
    OM_AcpuSendContentChannel(pstAppToOmMsg->ucCpuId, pstAppToOmMsg->ucFuncType, (OM_RSP_PACKET_STRU *)pstOmToAppMsg, usReturnPrimId);
    VOS_MemFree(WUEPS_PID_OM, pstOmToAppMsg);
    return VOS_OK;
}
예제 #11
0
VOS_VOID TTF_MNTN_ErrlogBufGet(VOS_UINT32 ulPid, MODEM_ID_ENUM_UINT16  enModemId, VOS_CHAR *pBuffer, VOS_UINT32 ulBytes)
{
    VOS_UINT32              ulRslt;
    OM_RING_ID              pRingId;


    if (VOS_NULL_PTR == pBuffer)
    {
        PS_LOG(ulPid, 0, PS_PRINT_ERROR,
            "TTF_MNTN_ErrlogBufGet: pBuffer NULL PTR");

        return;
    }

    if (enModemId >= MODEM_ID_BUTT)
    {
        PS_LOG1(ulPid, 0, PS_PRINT_ERROR,
            "TTF_MNTN_ErrlogBufGet: Invalid ModemId ", enModemId);

        return;
    }

    pRingId   = TTF_ERR_LOG_ENT_RINGID_GET(enModemId);

    if (VOS_NULL_PTR == pRingId)
    {
        PS_LOG(ulPid, 0, PS_PRINT_ERROR,
            "TTF_MNTN_ErrlogBufGet: pRingId NULL PTR");

        return;
    }

    ulRslt = VOS_SmP(TTF_ERR_LOG_ENT_SEM_GET(enModemId), TTF_ERR_SEM_TIMEOUT_LEN);

    if(VOS_OK != ulRslt)
    {
        PS_LOG2(ulPid, 0, PS_PRINT_WARNING,
            "TTF_MNTN_ErrlogBufGet: VOS_SmP <1>, ulRslt<2> fail!", enModemId, (VOS_INT32)ulRslt);

        return;
    }

    ulRslt = (VOS_UINT32)OM_RingBufferGet(pRingId, pBuffer, (VOS_INT)ulBytes);

    if (ulRslt != ulBytes)
    {
        OM_RingBufferFlush(pRingId);

        PS_LOG2(ulPid, 0, PS_PRINT_ERROR,
            "TTF_MNTN_ErrlogBufGet: ERROR OM_RingBufferGet fail!", (VOS_INT32)ulRslt, (VOS_INT32)ulBytes);
    }

    VOS_SmV(TTF_ERR_LOG_ENT_SEM_GET(enModemId));
}
예제 #12
0
VOS_VOID NFExt_CtrlTxMsgTask(VOS_VOID)
{

    NF_EXT_DATA_RING_BUF_STRU   stData;
    VOS_UINT32                  ulRst;

/* 解决UT死循环问题 */
#ifdef __UT_CENTER__
    VOS_UINT32              i;
#endif


/* 解决UT死循环问题 */
#ifndef __UT_CENTER__
    for ( ; ; )
#else
    for (i = 0; i < 1; i++)
#endif
    {

        if (VOS_NULL_PTR == g_stExEntity.pRingBufferId)
        {
            PS_LOG(ACPU_PID_NFEXT, 0, PS_PRINT_WARNING,
                "NFExt_CtrlSendTask : ERROR : pRingBufferId is NULL!" );
            break;
        }

        /*lint -e522*/
        wait_event_interruptible(g_stExEntity.stWaitHeadTxTask, (VOS_TRUE != OM_RingBufferIsEmpty(g_stExEntity.pRingBufferId)));
        /*lint +e522*/

        ulRst = (VOS_UINT32)NFExt_RingBufferGet(g_stExEntity.pRingBufferId, (VOS_CHAR *)&stData,
            sizeof(NF_EXT_DATA_RING_BUF_STRU));

        if ((0 != ulRst) && (ulRst != sizeof(NF_EXT_DATA_RING_BUF_STRU)))
        {
            PS_LOG(ACPU_PID_NFEXT, 0, PS_PRINT_WARNING,
                "NFExt_CtrlSendTask : ERROR : Get data error from ring buffer!" );

            NF_EXT_STATS_INC(1, NF_EXT_STATS_GET_BUF_FAIL);

            NFExt_FlushRingBuffer(g_stExEntity.pRingBufferId);

            continue;
        }

        if (0 != ulRst)
        {
            OM_AcpuSendData((OM_RSP_PACKET_STRU*)stData.pData, stData.usDataLen);

            NF_EXT_MEM_FREE(ACPU_PID_NFEXT, stData.pData);
        }
    }
}
예제 #13
0
/*****************************************************************************
 函 数 名  : TTF_LinkPeekPrev
 功能描述  : 查看链表中指定节点前一个节点,返回该节点的地址
                若该节点是头节点,则返回空
 输入参数  : pLink   -- 链表指针
             pCurr   -- 链表中指定的节点
 输出参数  : 无
 返 回 值  : pCurr前一个节点
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2006年12月8日
    作    者   : 查鸣峰,蒋丽萍
    修改内容   : 新生成函数

*****************************************************************************/
VOS_UINT32 TTF_LinkPeekPrev(VOS_UINT32 ulPid, TTF_LINK_ST * pLink,
    TTF_NODE_ST *pCurr, TTF_NODE_ST **ppCurrPrev)
{
    TTF_NODE_ST*    pNode;

    if (( VOS_NULL_PTR == pLink ) || ( VOS_NULL_PTR == pCurr ) || ( VOS_NULL_PTR == ppCurrPrev ))
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "\n Warning: pLink、pInsert Or ppCurrPrev is Null!\n");
        return PS_FAIL;
    }

    if ( 0 == pLink->ulCnt )
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "\n Warning: pLink Cnt is 0!\n");
        return PS_FAIL;
    }

    if ( (TTF_NODE_ST*)pLink == pCurr )
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "\n Warning: Node Address == Link Address!\n");
        return PS_FAIL;
    }

#ifdef WTTF_PC_ST_SWITCH
    pNode = pLink->stHead.pNext;
    while (pCurr != pNode)
    {
        /*遍历链表,未查找到对应的节点*/
        if ( &(pLink->stHead) == pNode )
        {
            PS_LOG(ulPid, 0, PS_PRINT_WARNING, "\n Warning: Not Find The Node In the Link!\n");
            return PS_FAIL;
        }

        pNode = pNode->pNext;
    }
#else
    pNode = pCurr;
#endif

    /*若当前节点是头节点,则返回VOS_NULL_PTR;否则,返回前一个地址*/
    if ( &(pLink->stHead) == pNode->pPrev )
    {
        *ppCurrPrev = VOS_NULL_PTR;
    }
    else
    {
        *ppCurrPrev = pNode->pPrev;
    }

    return PS_SUCC;

}
예제 #14
0
void ps_gstsink_destroy (void) {
	if (!g_atomic_int_get(&initialized)) return;
	g_atomic_int_set(&stopping, 1);
	
	g_async_queue_push (messages, &exit_message);
	
	if (handler_thread != NULL) {
		g_thread_join (handler_thread);
		handler_thread = NULL;
	}
	
	if (watchdog != NULL) {
		g_thread_join (watchdog);
		watchdog = NULL;
	}
	usleep(500000);
	
	ps_mutex_lock(&sessions_mutex);
	/* Cleanup session data */
	GHashTableIter iter;
	gpointer value;
	g_hash_table_iter_init (&iter, sessions);
	while (g_hash_table_iter_next (&iter, NULL, &value)) {
		ps_gstsink_session * session = value;
		if (!session->destroyed && session->vplayer != NULL) {
			ps_video_player * player = session->vplayer;
			gst_object_unref (player->vbus);
			gst_element_set_state (player->vpipeline, GST_STATE_NULL);
			if (gst_element_get_state (player->vpipeline, NULL, NULL, GST_CLOCK_TIME_NONE) == GST_STATE_CHANGE_FAILURE) {
				PS_LOG (LOG_ERR, "Unable to stop GSTREAMER video player..!!\n");
			}
			gst_object_unref (GST_OBJECT(player->vpipeline));
		}
		/*g_hash_table_iter_remove (&iter);
		session->handle = NULL;
		g_free(session);
		session = NULL;*/
		g_hash_table_remove(sessions, session->handle);
		old_sessions = g_list_append(old_sessions, session);
	}
	
	g_hash_table_destroy(sessions);
	ps_mutex_unlock(&sessions_mutex);
	g_async_queue_unref(messages);
	messages = NULL;
	sessions = NULL;
	
	g_atomic_int_set(&initialized, 0);
	g_atomic_int_set(&stopping, 0);
	PS_LOG(LOG_INFO, "%s destroyed!\n", PS_GSTSINK_NAME);
	
}
예제 #15
0
void * ps_websockets_thread (void * data) {
	struct lws_context * service = (struct lws_context *)data;
	if (service == NULL) {
		PS_LOG (LOG_ERR,"Invalid service\n");
		return NULL;
	}
	
	while (g_atomic_int_get(&initialized) && !g_atomic_int_get(&stopping)) {
		lws_service (service, 50);
	}
	
	//lws_context_destroy(service);
	PS_LOG (LOG_INFO,"ps_websockets_thread: thread ended\n");
	return NULL;	
}
VOS_VOID RABM_TcInfRls(
                   RRRABM_RAB_IND_STRU  *pMsg,
                   VOS_UINT8  ucRabId
                   )
{
    VOS_UINT8    i;

    if(pMsg->aRabInfo[ucRabId].ulRbNum > 1)
    {
        PS_LOG(WUEPS_PID_RABM, VOS_NULL, PS_PRINT_WARNING, "RABM_TcInfRls:WARNING:RRC->RABM(TC) RAB contains more than one RB!");
        return;
    }

    for(i = 0; i < TC_LB_MAX_RBNUM; i++)
    {
        if(g_RabmTcInf.aRbInf[i].ucRbId ==
            (VOS_UINT8)(pMsg->aRabInfo[ucRabId].aulRbId[0]))
        {
            if(RABM_TRUE == g_RabmTcInf.aRbInf[i].ucEstFlg)
            {
                g_RabmTcInf.aRbInf[i].ucEstFlg = RABM_FALSE;                    /* 标志该RB不可用                           */
                RABM_SndTcRabInd(i, TC_RAB_RELEASE);                            /* 通知TC该RB释放                           */

                /*罗德 GCF用例:7.2.3.36,仪器下发的CLOSE UP TEST LOOP中指示的LB个数为0,
                    与实际建立的RAB不一致,导致环回失败。为了规避该问题,做如下检查:*/
                if (0 != g_RabmTcInf.ucLbCnt)
                {
                    g_RabmTcInf.ucLbCnt--;
                }
                break;
            }
        }
    }
    return;
}
예제 #17
0
/*****************************************************************************
 函 数 名  : TTF_LinkPeekTail
 功能描述  : 查看链表的尾部,返回尾节点
 输入参数  : pLink   -- 链表指针
 输出参数  : 无
 返 回 值  : pNode   -- 链表节点
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2006年12月8日
    作    者   : 查鸣峰,蒋丽萍
    修改内容   : 新生成函数

*****************************************************************************/
TTF_NODE_ST* TTF_LinkPeekTail(VOS_UINT32 ulPid, const TTF_LINK_ST * pLink)
{
    if ( VOS_NULL_PTR == pLink )
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: pLink is Null!");
        return VOS_NULL_PTR;
    }

    if ( 0 == pLink->ulCnt )
    {
        PS_LOG(ulPid, 0, PS_PRINT_INFO, "Info: Tail Node is Null!");
        return VOS_NULL_PTR;
    }

    return pLink->stHead.pPrev;
}
예제 #18
0
int ps_websockets_init (ps_transport_callbacks * callback) {
	
	if (g_atomic_int_get(&stopping)) {
		return -1;
	}
	if (callback == NULL) {
		return -1;
	}
	
	gateway = callback;
	struct lws * wsi;
	
	/* Set Log level */
	lws_set_log_level (0, NULL);
	
	/* Prepare context */
	struct lws_context_creation_info info;
	struct lws_client_connect_info cinfo;
	memset(&info, 0, sizeof info);
	memset(&cinfo, 0, sizeof cinfo);
	
	info.port = CONTEXT_PORT_NO_LISTEN;
	info.iface = NULL;
	info.protocols = wss_protocols;
	info.extensions = NULL; //lws_get_internal_extensions();
	info.ssl_cert_filepath = NULL;
	info.ssl_private_key_filepath = NULL;
	info.gid = -1;
	info.uid = -1;
	info.options = 0;
	
	/* Create the websockets context */
	wss = lws_create_context(&info);
	
	cinfo.context = wss;
	cinfo.ssl_connection = 0;
	cinfo.host = host;
	cinfo.address = host;
	cinfo.port = wsport;
	cinfo.path = path;
	cinfo.protocol = "ps-protocol"; //wss_protocols.name;
	
	GError * error = NULL;
	if (wss != NULL) {
		/* Connect to the server */
		wsi = lws_client_connect_via_info (&cinfo);
		/*TODO: somehow, check if the connection is established?*/
		wss_thread = g_thread_try_new("websockets thread", &ps_websockets_thread, wss, &error);
		if (!wss_thread) {
			g_atomic_int_set(&initialized, 0);
			PS_LOG (LOG_ERR,"Got error %d (%s) trying to launch the wss thread...\n", 
			error->code, error->message ? error->message : "??");
			return -1;
		}
	}
	
	/* done */
	g_atomic_int_set(&initialized, 1);
	return 0;
}
VOS_UINT32 PPM_LogFileInit(VOS_VOID)
{
    OM_CHANNLE_PORT_CFG_STRU            stPortCfg;

    /*读取SD Log在NV中的配置*/
    if(NV_OK != NV_Read(en_NV_Item_Om_Port_Type, &stPortCfg, sizeof(OM_CHANNLE_PORT_CFG_STRU)))
    {
        PS_LOG(WUEPS_PID_OM, 0, PS_PRINT_ERROR, "PPM_LogFileInit:Read NV Config fail!");

        return VOS_OK;
    }

    /* 读取SD Log在NV中的配置为输出到SD卡的时候才使能 */
    if (CPM_OM_PORT_TYPE_SD == stPortCfg.enPortNum)
    {
        OM_SDInit();

        return VOS_OK;
    }
#if (VOS_OS_VER == VOS_LINUX)
    else if (CPM_OM_PORT_TYPE_FS == stPortCfg.enPortNum)
    {
        PPM_FSInitLogFile();

        return VOS_OK;
    }
#endif

    return VOS_OK;
}
예제 #20
0
VOS_VOID SMR_TimerTr1mExpire()
{
    /* 停止timer TR1M */
    SMS_LOG( PS_PRINT_NORMAL, "SMS:SMR_TimerTr1mExpire: TimerStop: TR1M" );
    if ( SMS_FALSE == SMS_TimerStop( SMC_TIMER_ID_TR1M ) )
    {
        return;
    }

    if ( SMR_WAIT_FOR_RP_ACK == g_SmrEnt.SmrMo.ucState )
    {
        if ( SMS_TRUE == g_SmrEnt.SmrMo.ucMemAvailFlg )
        {                                                                       /*是内存通知过程                            */
            SMR_MemNotifyRetrans(SMR_SMT_ERROR_TR1M_TIMEOUT, VOS_NULL_PTR, 0);         /* 调用重发过程的处理                       */

            if (SMR_IDLE == g_SmrEnt.SmrMo.ucState)
            {
                SMC_SmrApiRelReq(SMR_SMC_REL_CAUSE_NORMAL, SMS_FALSE );             /* 释放当前正在建立的消息的资源 */
            }

        }
        else
        {
            SMC_SmrApiAbortReq(SMR_SMC_ABORT_CAUSE_TR1M_EXP);                   /* 向网侧报错                               */

            PS_LOG(WUEPS_PID_SMS, VOS_NULL, PS_PRINT_NORMAL, "SMR_TimerTr1mExpire:NORMAL:SMS state = SMR_IDLE");
            g_SmrEnt.SmrMo.ucState = SMR_IDLE;                                  /* 进入空闲                                 */

            SMS_SendMnReportReq(SMR_SMT_ERROR_TR1M_TIMEOUT, VOS_NULL_PTR, 0);

        }
    }
}
예제 #21
0
VOS_VOID OM_LittleImgRemoveLogFile(VOS_UINT32 ulFileId)
{
    VOS_CHAR acFileName[LOG_FILE_PATH_MAX_LENGTH] = {0};
	LOG_FILE_DISK_INFO_STRU stDiskInfo;

    /* 拼接LOG文件名称 */
    VOS_sprintf((VOS_CHAR *)acFileName, "%s_%04d",
            g_acLogFileName,
            ulFileId);

    DRV_FILE_RMFILE(acFileName);

    /* 更新全局信息 */
    g_stLogFileSaveInfo.ulFileMinId++;

    /* 调用底软接口返回 */
    if (DRV_ERROR == DRV_FILE_GET_DISKSPACE(
                    g_acFileSystemRoot,
                    (VOS_UINT*)&stDiskInfo.ulDiskSpace,
                    (VOS_UINT*)&stDiskInfo.ulUsedSpace,
                    (VOS_UINT*)&stDiskInfo.ulValidSpace))
    {
        PS_LOG(WUEPS_PID_OM, 0, PS_PRINT_ERROR, "OM_LittleImgRemoveLogFile: DRV_FILE_GET_DISKSPACE Failed!");
        return;
    }

    g_stLogFileSaveInfo.ulFSFreeSpace = stDiskInfo.ulValidSpace;

    return;
}
예제 #22
0
/***********************************************************************
 *  MODULE   : Mm_Event_Analy_From_SS
 *  FUNCTION : Mm_Event_Analy函数降复杂度: 来自SS的消息处理
 *  INPUT    : VOS_VOID
 *  OUTPUT   : VOS_VOID
 *  RETURN   : VOS_UINT8 ucEventID
 *  NOTE     :
 *  HISTORY  :
     1.  欧阳飞   2009.06.11  新版作成
 ************************************************************************/
VOS_UINT8   Mm_Event_Analy_From_SS(MSG_HEADER_STRU* pMsgHeader)
{
    VOS_UINT8 ucEventID = MM_EVENT_ID_INVALID;

    switch ( pMsgHeader->ulMsgName )
    {
    case MMSS_EST_REQ:
        ucEventID   = 65;
        break;
    case MMSS_REL_REQ:
        ucEventID   = 66;
        break;
    case MMSS_DATA_REQ:
        ucEventID   = 67;
        break;
    case MMSS_ABORT_REQ:
        ucEventID   = 80;
        break;
    default:
        PS_LOG(WUEPS_PID_MM, VOS_NULL, PS_PRINT_WARNING, "Mm_Event_Analy_From_SS:WARNING: Msg name from SS is Error");
        break;
    }

    return ucEventID;
}
예제 #23
0
VOS_UINT32  TTF_RING_Q_Free(VOS_UINT32 ulPid, TTF_RING_Q_ST *pstRingQ)
{

    if (VOS_NULL_PTR == pstRingQ )
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: pstRingQ is Null !");
        return PS_FAIL;
    }

    if ( VOS_NULL_PTR != pstRingQ->ppNode )
    {
        #if( VOS_OS_VER == VOS_WIN32 )
        free(pstRingQ->ppNode);
        #else
        VOS_MemFree(ulPid, pstRingQ->ppNode);
        #endif

        pstRingQ->ppNode = VOS_NULL_PTR;
    }

    pstRingQ->ulFront   =0;
    pstRingQ->ulRear    =0;
    pstRingQ->ulMaxSize =0;

    return PS_SUCC;

} /* TTF_RING_Q_Free */
VOS_VOID  PCSC_AcpuMsgProc( MsgBlock *pMsg)
{
    SI_PIH_PCSC_CNF_STRU *pstPCSCMsg;

    pstPCSCMsg = (SI_PIH_PCSC_CNF_STRU*)pMsg;

    OM_RecordInfoStart(VOS_EXC_DUMP_MEM_NUM_1, pMsg->ulSenderPid, ACPU_PID_PCSC, *((VOS_UINT32*)pMsg->aucValue));/* [false alarm]:*/

    switch(pstPCSCMsg->ulMsgName)
    {
        case SI_PIH_PCSC_DATA_CNF:
#if (RAT_MODE == RAT_GU)
            DRV_PCSC_SEND_DATA(pstPCSCMsg->ulCmdType, pstPCSCMsg->ulResult, pstPCSCMsg->aucContent, pstPCSCMsg->ulRspLen);
#endif
            break;
        case PS_USIM_GET_STATUS_IND:
            PCSC_UpdateCardStatus((PS_USIM_STATUS_IND_STRU*)pMsg);
            break;
        default:
            PS_LOG(ACPU_PID_PCSC, 0, PS_PRINT_WARNING, "PCSC_AcpuMsgProc: unknow MsgType");
            break;
    }

    OM_RecordInfoEnd(VOS_EXC_DUMP_MEM_NUM_1);

    return;
}
예제 #25
0
VOS_VOID NAS_MM_SndSmsNackMsg(RRMM_NACK_DATA_IND_STRU *pstMsg)
{
    MMSMS_NACK_DATA_IND_STRU           *pstMmSmsNackMsg = VOS_NULL_PTR;
    VOS_UINT32                          ulRet;

    pstMmSmsNackMsg = (MMSMS_NACK_DATA_IND_STRU *)PS_ALLOC_MSG(WUEPS_PID_MM,
                                                pstMsg->MsgHeader.ulLength);

    if (VOS_NULL_PTR == pstMmSmsNackMsg)
    {
        return;
    }

    pstMmSmsNackMsg->MsgHeader.ulMsgName        = MMSMS_NACK_DATA_IND;
    pstMmSmsNackMsg->MsgHeader.ulReceiverPid    = WUEPS_PID_SMS;

    pstMmSmsNackMsg->stNackMsg.ulNasMsgSize = pstMsg->stNackMsg.ulNasMsgSize;
    PS_MEM_CPY(pstMmSmsNackMsg->stNackMsg.aucNasMsg,
               pstMsg->stNackMsg.aucNasMsg,
               pstMsg->stNackMsg.ulNasMsgSize);

    ulRet = PS_SEND_MSG(WUEPS_PID_MM,  pstMmSmsNackMsg);
    if (VOS_OK != ulRet)
    {
        /* 打印错误信息 */
        PS_LOG(WUEPS_PID_MM, VOS_NULL, PS_PRINT_WARNING, "NAS_MM_SndSmsNackMsg: Send msg fails");
    }

    return;
}
QCI_TYPE_ENUM_UINT8 NAS_RABM_GetQciFromQos(
    VOS_UINT32                      ulQosLength,
    VOS_UINT8                      *pQosValue
)
{
    QCI_TYPE_ENUM_UINT8                 enQci;
    VOS_UINT8                           ucTrafficClass;
    VOS_UINT8                           ucTransDelay;
    VOS_UINT8                           ucTraffHandlPrior;
    VOS_UINT8                           ucSrcStatisticsDescriptor;
    VOS_UINT8                           ucSignallingIndication;


    /* 初始化 */
    enQci          = QCI_TYPE_QCI9_NONGBR;

    /* 获取QOS中trafficClass参数 */
    if (ulQosLength < NAS_RABM_QOS_TRAFFIC_CLASS_BYTE_OFFSET)
    {
        PS_LOG(WUEPS_PID_RABM, VOS_NULL, PS_PRINT_WARNING, "NAS_RABM_GetQciFromQos:WARNING:QOS too short!");
        return enQci;
    }

    if (ulQosLength > NAS_RABM_QOS_TRAFFIC_CLASS_BYTE_OFFSET)
    {
        ucTrafficClass = (pQosValue[NAS_RABM_QOS_TRAFFIC_CLASS_BYTE_OFFSET] & NAS_RABM_QOS_TRAFFIC_CLASS_MASK)
                                        >> NAS_RABM_QOS_TRAFFIC_CLASS_BIT_OFFSET;
    }
/*fanzhibin f49086 add it end*/
#if(FEATURE_ON == FEATURE_PPP)

static const VOS_CHAR * const papcodes[] = {
  "???", "REQUEST", "SUCCESS", "FAILURE"
};
#define MAXPAPCODE (sizeof papcodes / sizeof papcodes[0] - 1)


#if 0/*fanzhibin f49086 delete it*/
static void
pap_Req(struct authinfo *authp)
{
  struct bundle *bundle = authp->physical->dl->bundle;
  struct fsmheader lh;
  struct ppp_mbuf *bp;
  VOS_CHAR *cp;
  VOS_INT32 namelen, keylen, plen;

  namelen = strlen(bundle->cfg.auth.name);
  keylen = strlen(bundle->cfg.auth.key);
  plen = namelen + keylen + 2;
  PS_LOG(PS_PID_APP_PPP, 0, PS_PRINT_NORMAL, "pap_Req: namelen = %d, keylen = %d\n", namelen, keylen);
  log_Printf(LogPHASE, "Pap Output: %s ********\n", bundle->cfg.auth.name);
  if (*bundle->cfg.auth.name == '\0')
    log_Printf(LogWARN, "Sending empty PAP authname!\n");
  lh.code = PAP_REQUEST;
  lh.id = authp->id;
  lh.length = htons(plen + sizeof(struct fsmheader));
  bp = ppp_m_get(plen + sizeof(struct fsmheader));
  PS_MEM_CPY(PPP_MBUF_CTOP(bp), &lh, sizeof(struct fsmheader));
  cp = PPP_MBUF_CTOP(bp) + sizeof(struct fsmheader);
  *cp++ = namelen;
  PS_MEM_CPY(cp, bundle->cfg.auth.name, namelen);
  cp += namelen;
  *cp++ = keylen;
  PS_MEM_CPY(cp, bundle->cfg.auth.key, keylen);
  link_PushPacket(&authp->physical->link, bp,/* bundle,*/
                  LINK_QUEUES(&authp->physical->link) - 1, PROTO_PAP);
}
예제 #28
0
/*******************************************************************************
  Module:      SMS_ReportN2MOtaMsg
  Function:    在trace中勾取SMS的空口消息
  Input:       NAS_MSG_STRU*   pNasMsg     SMS空口消息
  NOTE:
  Return:      VOS_VOID
  History:
      1. 鲁琳    2009.07.11   新规作成
*******************************************************************************/
VOS_VOID SMS_ReportN2MOtaMsg(NAS_MSG_STRU *pNasMsg)
{
    NAS_OTA_MSG_ID_ENUM_UINT16 usNasOtaMsyId = NAS_OTA_MSG_ID_BUTT;

    PS_LOG1(WUEPS_PID_SMS, VOS_NULL, PS_PRINT_NORMAL, "SMS_ReportN2MOtaMsg:NORMAL: msg type is ", pNasMsg->aucNasMsg[1]);

    switch(pNasMsg->aucNasMsg[1])
    {
        case SMC_DATA_TYPE_CP_DATA:
          	usNasOtaMsyId = NAS_OTA_MSG_SMS_DATA_TYPE_CP_DATA_DOWN;
            break;

        case SMC_DATA_TYPE_CP_ACK:
           	usNasOtaMsyId = NAS_OTA_MSG_SMS_DATA_TYPE_CP_ACK_DOWN;
            break;

        case SMC_DATA_TYPE_CP_ERR:
            usNasOtaMsyId = NAS_OTA_MSG_SMS_DATA_TYPE_CP_ERROR_DOWN;
            break;

        default:
            PS_LOG(WUEPS_PID_SMS, VOS_NULL, PS_PRINT_WARNING, "SMS_ReportN2MOtaMsg:WARNING: invalid msg id");
            /*不属于SMS的空口消息,不在trace中显示*/
            return;
    }

    NAS_SendAirMsgToOM(WUEPS_PID_SMS, usNasOtaMsyId, NAS_OTA_DIRECTION_DOWN, pNasMsg->ulNasMsgSize + 4, (VOS_UINT8*)pNasMsg);
}
예제 #29
0
VOS_UINT32 OM_StartUpLogSaveReq(APP_OM_MSG_EX_STRU *pstAppToOmMsg,
                                            VOS_UINT16 usReturnPrimId)
{
    VOS_UINT32                ulResult;
    LOG_FILE_SAVE_CONFIG_STRU stLogFileSaveCfg;

    /* 读取NV项,更新默认文件大小以及校准结果 */
    ulResult = NV_Read(en_NV_Item_LOG_FILE_SAVE, &stLogFileSaveCfg, sizeof(LOG_FILE_SAVE_CONFIG_STRU));

    if (NV_OK != ulResult)
    {
        PS_LOG(WUEPS_PID_OM, 0, PS_PRINT_WARNING, "OM_StartUpLogSaveReq: NV_Read failed.\n");

        /* 返回结果ATE */
        OM_SendResult(pstAppToOmMsg->ucFuncType, ulResult, usReturnPrimId);

        return VOS_OK;
    }

    if ( VOS_OK != stLogFileSaveCfg.ulResult )
    {
        /* 返回结果ATE */
        OM_SendResult(pstAppToOmMsg->ucFuncType, stLogFileSaveCfg.ulResult, usReturnPrimId);

        return VOS_OK;
    }

    /*初始化LOG文件保存*/
    ulResult = OM_LittleImgInitLogFile(stLogFileSaveCfg.ulLogFileSize);

    /* 返回结果ATE */
    OM_SendResult(pstAppToOmMsg->ucFuncType, ulResult, usReturnPrimId);

    return VOS_OK;
}
예제 #30
0
VOS_VOID SMR_MemNotifyRetrans(
    SMR_SMT_ERROR_ENUM_UINT32           enErrorCode,
    VOS_UINT8                          *pucData,
    VOS_UINT32                          ulSendLen
)
{
    if ( SMR_RETRANS_PERMIT != g_SmrEnt.SmrMo.ucRetransFlg )
    {                                                                           /* RETRANS FLAG 置位                        */
        SMS_SendMnReportReq(enErrorCode, pucData, ulSendLen);
        g_SmrEnt.SmrMo.ucRetransFlg  = SMR_RETRANS_PERMIT;                      /* 将RETRANS FLAG置0清除                    */
        g_SmrEnt.SmrMo.ucMemAvailFlg = SMS_FALSE;                               /* 清除标志位                               */

        PS_LOG(WUEPS_PID_SMS, VOS_NULL, PS_PRINT_NORMAL, "SMR_SmcApiDataInd:NORMAL:SMS state = SMR_IDLE");
        g_SmrEnt.SmrMo.ucState = SMR_IDLE;                                      /* 状态迁移到空闲状态                       */
    }
    else
    {
        SMC_SmrApiRelReq((VOS_UINT8)enErrorCode, SMS_FALSE );                                   /* 发送MNSMS_REL_REQ,释放mm连接             */
        /*清除前面的消息*/
        g_SmrEnt.SmrMo.ucRetransFlg = SMR_RETRANS_NO_PERMIT;                    /* 将RETRANS FLAG置0清除                    */

        /* 启动定时器TRAM */
        SMS_LOG( PS_PRINT_NORMAL, "SMS:SMR_MemNotifyRetrans: TimerStart: TRAM" );
        if ( SMS_FALSE == SMS_TimerStart( SMC_TIMER_ID_TRAM ) )
        {
            return;
        }

        g_SmrEnt.SmrMo.ucState                  = SMR_WAIT_FOR_RETRANS_TIMER;   /* 状态迁移                                 */

    }
}