VOS_VOID Api_AppRabmDataReq( ST_APP_RABM_DATA *pRabmDataReq ) { VOS_UINT32 ulDataLen; TAFRABM_CS_DATA_REQ_STRU *pSndCsMsg = VOS_NULL_PTR; /* 定义发送到CS域的指针 */ VOS_UINT32 ulRet; if (D_RABM_CS_DOMAIN != pRabmDataReq->ucDomain) { PS_NAS_LOG( WUEPS_PID_RABM, VOS_NULL, PS_LOG_LEVEL_ERROR, "Api_AppRabmDataReq(CS):ucDomain is not D_RABM_CS_DOMAIN!" ); return; } ulDataLen = (pRabmDataReq->ulDataLen + 7) / 8; /* 将APP传来的bit长度改为字节长度 */ pSndCsMsg = (TAFRABM_CS_DATA_REQ_STRU *) PS_ALLOC_MSG( WUEPS_PID_TAF, (sizeof(TAFRABM_CS_DATA_REQ_STRU) + ulDataLen) - 4); if (VOS_NULL_PTR ==pSndCsMsg) { PS_NAS_LOG( WUEPS_PID_RABM, VOS_NULL, PS_LOG_LEVEL_ERROR, "Api_AppRabmDataReq(CS):Alloc msg fail!" ); return; } pSndCsMsg->MsgHeader.ulSenderCpuId = VOS_LOCAL_CPUID; pSndCsMsg->MsgHeader.ulSenderPid = WUEPS_PID_TAF; pSndCsMsg->MsgHeader.ulReceiverCpuId = VOS_LOCAL_CPUID; pSndCsMsg->MsgHeader.ulReceiverPid = WUEPS_PID_RABM; pSndCsMsg->MsgHeader.ulMsgName = TAFRABM_CS_DATA_REQ; pSndCsMsg->ulSi = pRabmDataReq->ucRabId; /* 保存SI */ pSndCsMsg->ulDataLen = pRabmDataReq->ulDataLen; /* 保存数据长度 */ PS_NAS_MEM_CPY(pSndCsMsg->aucData, pRabmDataReq->pucData, ulDataLen); /* 获得数据 */ PS_NAS_LOG( WUEPS_PID_RABM, VOS_NULL, PS_LOG_LEVEL_NORMAL, "\n Api_AppRabmDataReq: ucDomain = D_RABM_CS_DOMAIN\r" ); PS_NAS_LOG1( WUEPS_PID_RABM, VOS_NULL, PS_LOG_LEVEL_NORMAL, "\n Api_AppRabmDataReq: ucRabId = \r", pRabmDataReq->ucRabId ); PS_NAS_LOG1( WUEPS_PID_RABM, VOS_NULL, PS_LOG_LEVEL_NORMAL, "\n Api_AppRabmDataReq: ulDataLen = \r", (VOS_INT32)pRabmDataReq->ulDataLen ); ulRet = PS_SEND_MSG(WUEPS_PID_TAF, pSndCsMsg); if ( VOS_OK != ulRet ) { NAS_WARNING_LOG(WUEPS_PID_TAF, "Api_AppRabmDataReq():WARNING:SEND LMM START REQ FIAL"); } }
/******************************************************************************* Module: RABM_SaveData Function: 缓存数据 Input: RABM_DATA_SAVE_STRU *pSaveDataPtr 缓存数据的链表指针 VOS_VOID *pMsg 被缓存的数据 VOS_UINT8 ucMsgType 消息类型 Output: VOS_VOID NOTE: Return: VOS_VOID History: 1. 张志勇 2003.12.11 新规作成 *******************************************************************************/ VOS_VOID RABM_SaveData( RABM_DATA_SAVE_STRU *pSaveDataPtr, /* 缓存数据的链表指针 */ VOS_VOID *pMsg, /* 被缓存的数据 */ VOS_UINT8 ucMsgType /* 消息类型 */ ) { RABM_DATA_LINK_STRU *pTemp1 = RABM_POINTER_NULL; RABM_DATA_LINK_STRU *pTemp2 = RABM_POINTER_NULL; VOS_VOID *pSaveMsg = RABM_POINTER_NULL; VOS_UINT32 ulDataLen = 0; if ( RABM_UPLINK == ucMsgType ) { /* 获得上行数据的长度 */ ulDataLen = ((TAFRABM_PS_DATA_REQ_STRU *)pMsg)->MsgHeader.ulLength + VOS_MSG_HEAD_LENGTH; } else { /* 获得下行数据的长度 */ ulDataLen = sizeof(PDCP_RABM_DATA_BUF_STRU); } pSaveMsg = RABM_Malloc(ulDataLen); if(VOS_NULL_PTR == pSaveMsg) { return; } PS_NAS_MEM_CPY(pSaveMsg, pMsg, ulDataLen); /* 获得数据 */ if(0 == pSaveDataPtr->ucNum) { /* 是链表中的第一个数据 */ pSaveDataPtr->Data.pData = pSaveMsg; /* 存储数据消息 */ pSaveDataPtr->Data.pNxt = RABM_POINTER_NULL; /* 初始化链表指针 */ } else if(1 == pSaveDataPtr->ucNum) { pSaveDataPtr->Data.pNxt = (RABM_DATA_LINK_STRU *) RABM_Malloc(sizeof(RABM_DATA_LINK_STRU)); pSaveDataPtr->Data.pNxt->pData = pSaveMsg; /* 存储数据消息 */ pSaveDataPtr->Data.pNxt->pNxt = RABM_POINTER_NULL; } else { pTemp1 = pSaveDataPtr->Data.pNxt; pTemp2 = pTemp1; if(0xff != pSaveDataPtr->ucNum) { for( ; ; ) { /* 查找链表尾 */ if(RABM_POINTER_NULL != pTemp1->pNxt) { pTemp1 = pTemp2->pNxt; } else { break; } pTemp2 = pTemp1; } pTemp1->pNxt = (RABM_DATA_LINK_STRU *) RABM_Malloc(sizeof(RABM_DATA_LINK_STRU)); pTemp1->pNxt->pData = pSaveMsg; /* 存储数据消息 */ pTemp1->pNxt->pNxt = RABM_POINTER_NULL; /* 初始化链表指针 */ } else { /*释放上行数据的零拷贝内存*/ if (RABM_UPLINK == ucMsgType) { TTF_MemFree(WUEPS_PID_RABM, ((TAFRABM_PS_DATA_REQ_STRU *)pMsg)->pData); } RABM_Free(pSaveMsg); return; } } pSaveDataPtr->ucNum++; /* 更新缓存的数据个数 */ }