UINT32 CFW_Cfg_test2() { UINT32 err_code = ERR_SUCCESS; UINT16 uInd=0; UINT8 sOption; UINT8 sNewSmsStorage; CFW_IND_EVENT_INFO sIndInfo; //general indicator err_code = CFW_CfgGetIndicatorEvent(&uInd); CSW_TRACE(CFW_CFG_TS_ID, "1, call CFW_CfgGetIndicatorEvent,ret=0x%x, uInd=0x%x\n",err_code, uInd); uInd = 0x3b; err_code = CFW_CfgSetIndicatorEvent(uInd); CSW_TRACE(CFW_CFG_TS_ID, "2, call CFW_CfgSetIndicatorEvent,ret=0x%x, uInd=0x%x\n\n",err_code, uInd); err_code = CFW_CfgGetIndicatorEventInfo(&sIndInfo); CSW_TRACE(CFW_CFG_TS_ID, "3, call CFW_CfgGetIndicatorEventInfo,ret=0x%x, bc=%d,bit_err=%d,sq=%d\n", err_code, sIndInfo.bc,sIndInfo.bit_err,sIndInfo.sq); CSW_TRACE(CFW_CFG_TS_ID, "4,call=%d, nw_srv=%d,roam=%d,sms_full=%d, sms_receive=%d,sms_receive=%d\n\n", sIndInfo.call, sIndInfo.nw_srv,sIndInfo.roam,sIndInfo.sms_full, sIndInfo.sms_receive,sIndInfo.sms_receive); // sms smsstorageOption sOption =0; sNewSmsStorage = 0; err_code = CFW_CfgGetNewSmsOption(&sOption,&sNewSmsStorage); //CSW_TRACE(CFW_CFG_TS_ID, PCSTR pFormat,...) //CFW_CfgSetNewSmsOption return ERR_SUCCESS; }
VOID CFW_PppTermProcess(VOID) { CSW_TRACE(CFW_GPRS_TS_ID, TSTXT(" in CFW_PppTermProcess ")); if(ppp_Gprs_state.PPP_Act == TRUE)//active in ppp { CSW_TRACE(CFW_GPRS_TS_ID, TSTXT(" in CFW_PppTermProcess active TRUE ")); #if 1 #if 0 UINT8 nSimID= 0; CFW_GprsAct(CFW_GPRS_DEACTIVED, ppp_Gprs_state.PPP_Cid, 3,nSimID); CFW_GprsAct(CFW_GPRS_DEACTIVED, ppp_Gprs_state.PPP_Cid, 3); #endif #else UINT8 uTi; if(ERR_SUCCESS == CFW_GetFreeUTI(CFW_GPRS_SRV_ID, &uTi)) CFW_GprsAct(CFW_GPRS_DEACTIVED, ppp_Gprs_state.PPP_Cid, uTi); else CSW_TRACE(CFW_GPRS_TS_ID, TSTXT(" no free uTi ")); #endif }else{ //no active in PPP, CSW_TRACE(CFW_GPRS_TS_ID, TSTXT(" in CFW_PppTermProcess ")); CFW_PppTermInd();//send terminate to ATE } }
// ============================================================================= // bal_fstraceStart // ----------------------------------------------------------------------------- /// start tFlash trace recorsing // ============================================================================= PUBLIC VOID bal_fstraceStart(VOID) { UINT8 targetTraceName[20] = "/t/fstrace.bin"; if(g_trace_Data != NULL){ CSW_TRACE(BASE_BAL_TS_ID, TSTXT("bal_fstraceStart:fs trace already opened!")); return; } if((g_tracefileHandle = _fsTraceFileOpen(targetTraceName, FS_O_RDWR | FS_O_CREAT | FS_O_TRUNC, 0)) < 0){ CSW_TRACE(BASE_BAL_TS_ID, TSTXT("bal_fstraceStart:file %s open fail, ret %x"),targetTraceName, g_tracefileHandle); return; } if((g_trace_Data = CSW_Malloc(MAX_TRACE_LEN)) == NULL){ CSW_TRACE(BASE_BAL_TS_ID, TSTXT("bal_fstraceStart:malloc fail!")); _fsTraceFileClose(g_tracefileHandle); return; } _fsTraceSetLevel(); fstraces_Open(); COS_SetTimerEX(BAL_TH(BAL_DEV_MONITOR_TASK_PRIORITY) ,PRV_CFW_TRACE_TO_FLASH_TIMER_ID, COS_TIMER_MODE_SINGLE,FS_TRACE_TIMER_CNT); }
// ============================================================================= // _fsTraceSetLevel // ----------------------------------------------------------------------------- /// set trace level // ============================================================================= PRIVATE VOID _fsTraceSetLevel(void) { UINT16 traceLevel[SXS_NB_ID] = {0, }; UINT16 cnt = 0; UINT8 targetTraceLevelFileName[30] = "/t/csd_fstracelevel.tfg"; INT32 iResult = -1; INT32 fhd; UINT8 tmpTransfer = 0,*tmpTransfer1; traceLevel[__MMI] = 0xffff; traceLevel[__CSW] = 0xffff; CSW_TRACE(BASE_BAL_TS_ID, TSTXT("fsTrace_setTraceLevel OK.%d,%d\n"), __MMI, SXS_NB_ID); if((fhd =_fsTraceFileOpen(targetTraceLevelFileName, FS_O_RDONLY, 0)) >= 0) { iResult = FS_Read(fhd, (UINT8*)(traceLevel), SXS_NB_ID* 2); CSW_TRACE(BASE_BAL_TS_ID, TSTXT("fsTrace_setTraceLevel read result is %d\n"), iResult); cnt = 0; while (cnt < SXS_NB_ID) { /******CONVERT H8 AND L8,START ****/ tmpTransfer1 = (UINT8*)(&traceLevel[cnt]); tmpTransfer =*tmpTransfer1; *tmpTransfer1 = *(tmpTransfer1+1); *(tmpTransfer1+1) = tmpTransfer; /******CONVERT H8 AND L8, END ****/ CSW_TRACE(BASE_BAL_TS_ID, TSTXT("fstraces_setLevel(0x%x 0x%x"), TID(cnt), traceLevel[cnt]); fstraces_setLevel(TID(cnt), traceLevel[cnt]); ++cnt; } iResult = _fsTraceFileClose(fhd); CSW_TRACE(BASE_BAL_TS_ID, TSTXT("fsTrace_setTraceLevel close result is %d\n"), iResult); } else // set default level { while (cnt < SXS_NB_ID) { fstraces_setLevel(TID(cnt), traceLevel[cnt]); ++cnt; } } }
//---------------------------------------------------------------------------- //author: Hameina // this function called by CFW_PostNotifyEvent to output trace about message send from CSW to MMI. //-------------------------------------------------------------------------- VOID TS_OutPutEvId( #ifdef CFW_MULTI_SIM CFW_SIM_ID nSIMID, #endif UINT32 EvID ) { #ifdef CFW_MULTI_SIM CSW_TRACE(CFW_API_TS_ID, "CSW --->MMI, %s, SIM ID:%d\n", TS_GetEventName(EvID), nSIMID); #else CSW_TRACE(CFW_API_TS_ID, "CSW --->MMI, %s\n", TS_GetEventName(EvID)); #endif return; }
UINT32 CFW_CfgInit() { UINT32 ret = ERR_SUCCESS; UINT32 param=0; CSW_PROFILE_FUNCTION_ENTER(CFW_CfgInit); CSW_TRACE(CFW_CFG_TS_ID, "CFW_CfgInit\n"); #ifdef CFW_MULTI_SIM UINT8 i = 0x00; for( ; i <= CFW_SIM_NUMBER; i++ ) { IND_EVENT_general[i] = 0xFF; } #else IND_EVENT_general = 0xFF; #endif CFW_CfgSimParamsInit(); ret = CFW_CfgGetUserProfile ( ); ret = cfg_read_hex("general", "IND_EVENT", ¶m, 2); if(ERR_SUCCESS != ret) { CSW_TRACE(CFW_CFG_TS_ID, "cfg_read_hex, error ret =0x%x\n",ret); ret = cfg_readdefault("general", "IND_EVENT", ¶m); if(ERR_SUCCESS != ret) { CSW_TRACE(CFW_CFG_TS_ID, "cfg_readdefault, error ret =0x%x\n",ret); CSW_PROFILE_FUNCTION_EXIT(CFW_CfgInit); return ret; } } #ifdef CFW_MULTI_SIM i = 0x00; for( ; i<= CFW_SIM_NUMBER; i++ ) { IND_EVENT_general[i] = param; } #else IND_EVENT_general = (UINT16)param; #endif CSW_TRACE(CFW_CFG_TS_ID, "CFW_CfgInit, exit ret =0x%x\n",ret); CSW_PROFILE_FUNCTION_EXIT(CFW_CfgInit); return ret; }
PRIVATE INT32 _fsTraceFileOpen(CONST CHAR *name, UINT32 iFlag, UINT32 iMode) { INT32 result; INT32 fd = -1; UINT32 uni_len = 0; UINT8* uni_name = NULL; if((result = ML_LocalLanguage2UnicodeBigEnding(name, DSM_StrLen(name),&uni_name,&uni_len,NULL) )!= ERR_SUCCESS){ if(uni_name){ CSW_Free(uni_name); uni_name = NULL; } CSW_TRACE(BASE_BAL_TS_ID,"fstrace:%s:%u:ML_LocalLanguage2UnicodeBigEnding ret %d",__FUNCTION__, __LINE__,result); return -1; } fd = FS_Open(uni_name,iFlag,iMode); if(uni_name){ CSW_Free(uni_name); uni_name = NULL; } return fd; }
void* socketdata_get(INT32 sockfd) { CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("socketdata_get!\n")); struct socket_data *p = &socketid[sockfd]; void* buf = NULL; if(p->index[p->front]) { buf = p->index[p->front]; p->index[p->front] = NULL; p->front = INDEX_MOD(p->front + 1) ; } else { CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("get too fast!\n")); } return buf; }
PRIVATE INT32 _fsTraceFileClose(INT32 fd) { if(fd < 0) { CSW_TRACE(BASE_BAL_TS_ID,"%s:%d: 0x%x not a FILE pointer",__FUNCTION__, __LINE__, fd); return -1; } return FS_Close(fd); }
//param radix: 10, output memery using %d // 16, output memery using %x // uMask: trace ID defined in CSW VOID CSW_TC_MEMBLOCK(UINT16 uMask, UINT8 *buffer, UINT16 len, UINT8 radix) { INT32 i = 0; CHAR s[4] = {0}; CHAR line_buff[64] = {0}; // Temporary buffer for print trace information. CSW_TRACE(uMask, "==================TRACE MEMORY BLOCK=====================>>"); // Just print part of the data if the data length overrun the temporary buffer size. ///////////////////////////////////////////////////////////////////////////// // the buffer of vsprintf is not more than 256(the max number chars of each line), so // the size of the buffer to need to print is not limited, line_buffer size can be less //than 256 each line and it can be used circularly, modify by wangqunyang 2008.06.02 ///////////////////////////////////////////////////////////////////////////// for (i = 0; i < len; i++) { if (radix == 10) SUL_StrPrint(s, "%3d ", buffer[i]); else if (radix == 16) SUL_StrPrint(s, "%02x ", buffer[i]); else //default case SUL_StrPrint(s, "%02x ", buffer[i]); /* we can print 10 chars each line or any others being less than ** line_buff size and in this function max size of line_buff is 64 */ if (i != 0 && i % 10 == 0) { CSW_TRACE(uMask, "%s", line_buff); SUL_MemSet8(line_buff, 0, sizeof(line_buff)); } SUL_StrCat(line_buff, s); } if (SUL_Strlen(line_buff) > 0) CSW_TRACE(uMask, "%s", line_buff); CSW_TRACE(uMask, "==================TRACE MEMORY BLOCK=====================<<"); return; }
VOID CFW_PppTermInd(VOID) { COS_EVENT sEvt ; CSW_TRACE(CFW_GPRS_TS_ID, TSTXT(" in CFW_PppTermInd ")); sEvt.nEventId = EV_CFW_PPP_TERMINATE_IND; sEvt.nParam1 = 0; sEvt.nParam2 = 0; Gprs_SetAppCng(TRUE, Pre_Task); COS_SendEvent(COS_GetDefaultMmiTaskHandle(), &sEvt, COS_WAIT_FOREVER, COS_EVENT_PRI_NORMAL); }
BOOL socketdata_store(INT32 sockfd, void* rec_data) { struct socket_data *p = &socketid[sockfd]; if(!rec_data) { return TRUE; } if(p->index[p->rear]) { CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("store too fast!\n")); return FALSE; } else { p->index[p->rear] = rec_data; p->rear = INDEX_MOD(p->rear + 1); return TRUE; } }
BOOL socketdata_store(INT32 sockfd, void* rec_data) { COS_WaitForSemaphore(Tcp_receive_buf_sem, COS_WAIT_FOREVER); struct socket_data *p = &socketid[sockfd]; if(!rec_data) { COS_ReleaseSemaphore(Tcp_receive_buf_sem); return TRUE; } if(p->index[p->rear]) { CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("store too fast!\n")); COS_ReleaseSemaphore(Tcp_receive_buf_sem); return FALSE; } else { p->index[p->rear] = rec_data; p->rear = INDEX_MOD(p->rear + 1); COS_ReleaseSemaphore(Tcp_receive_buf_sem); return TRUE; } }
VOID Aps_PppProc( COS_EVENT* pEvent ) { CFW_EVENT pCfwEvent; PPP_CP_ENTRY(CPID_Aps_PppProc); pCfwEvent.nType = HIUINT8(pEvent->nParam3); if(pEvent->nEventId == EV_CFW_GPRS_DATA_IND) { CFW_GPRS_DATA * Msg; Msg = (CFW_GPRS_DATA *)pEvent->nParam2; CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS receive EV_CFW_GPRS_DATA_IND. data length: %d\n"),Msg->nDataLength); ppp_OnReceiveIpPacket(Msg->pData, Msg->nDataLength); if(Msg != NULL) CSW_TCPIP_FREE(Msg); }else if(pEvent->nEventId == EV_CFW_GPRS_ATT_RSP) { CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS receive EV_CFW_GPRS_ATT_RSP.pCfwEvent.nType : %d\n"),pCfwEvent.nType); if(pCfwEvent.nType == CFW_GPRS_ATTACHED)//attach success { ppp_Gprs_state.PPP_Act = TRUE; ppp_Gprs_state.PPP_Cid = 1; // if not set the PDP context, do it if(PdpContList[0] == NULL) { CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS set PDP context.\n")); CFW_GPRS_QOS qos; qos.nDelay = 4; qos.nMean = 16; qos.nPeak = 4; qos.nPrecedence = 3; qos.nReliability = 3; #if 0 CFW_GprsSetReqQos(1, &qos); #endif CFW_GPRS_PDPCONT_INFO pdp_cont; pdp_cont.nApnSize = 5; pdp_cont.pApn = "CMNET"; pdp_cont.nApnUserSize = 3; pdp_cont.pApnUser = "******"; pdp_cont.nApnPwdSize = 3; pdp_cont.pApnPwd= "wap"; pdp_cont.nPdpAddrSize = 0; pdp_cont.pPdpAddr = NULL; pdp_cont.nDComp = 0; pdp_cont.nHComp = 0; pdp_cont.nPdpType = CFW_GPRS_PDP_TYPE_IP; #if 0 CFW_GprsSetPdpCxt(ppp_Gprs_state.PPP_Cid, &pdp_cont); #endif } #if 1 #if 0 #endif #else UINT8 uTi; if(ERR_SUCCESS == CFW_GetFreeUTI(CFW_GPRS_SRV_ID, &uTi)) { CFW_GprsAct(CFW_GPRS_ACTIVED, ppp_Gprs_state.PPP_Cid, uTi); }else CSW_TRACE(CFW_GPRS_TS_ID, TSTXT(" no free uTi ")); #endif }else if(pCfwEvent.nType == CFW_GPRS_DETACHED)//if Detached ,sent ternminate to AT { CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS eceive CFW_GPRS_DETACHED,APS send terminate ppp.\n")); ppp_Gprs_state.PPP_Att = FALSE; CFW_PppTermInd(); }else{ CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS attach failure. error :0x%x\n"),pEvent->nParam1); } }else if(pEvent->nEventId == EV_CFW_GPRS_ACT_RSP) { CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS eceive EV_CFW_GPRS_ACT_RSP.\n")); //if PDP context actived, and the ppp state is PPP_STATUS_NCP_START, begin handle NCP packet if(pCfwEvent.nType == CFW_GPRS_ACTIVED)// active success { g_Pdp_Acting = FALSE; ppp_Gprs_state.PPP_Cid = 1; if(ppp_Data.Status == PPP_STATUS_NCP_START) { ppp_ProcessNcpPacket(); }else if(ppp_Data.Status ==PPP_STATUS_PPP_NULL) { //TODO } }else if(pCfwEvent.nType == CFW_GPRS_DEACTIVED)//deactive success { CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS eceive CFW_GPRS_DEACTIVED.\n")); ppp_Gprs_state.PPP_Cid = 0; ppp_Gprs_state.PPP_Act = FALSE; if(ppp_Gprs_state.PPP_Att == TRUE) { #if 1 #else UINT8 uTi; if(ERR_SUCCESS == CFW_GetFreeUTI(CFW_NW_SRV_ID, &uTi)) { CFW_GprsAtt(CFW_GPRS_DETACHED, uTi); }else CSW_TRACE(CFW_GPRS_TS_ID, TSTXT(" no free uTi ")); #endif PPP_CP_EXIT(CPID_Aps_PppProc); return; }else{ CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS send terminate ppp.\n")); CFW_PppTermInd(); } }else{ CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS active failure.\n")); } }else if(pEvent->nEventId == EV_APS_PPP_DATA_REQ) { CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("Process ppp data from AT.\n")); if(Aps_APP == APS_TCP) Aps_APP = APS_PPP; UINT16 packet_head =0 ; UINT16 elem = 0; CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("Process ppp data from AT. data length: %d\n"),pEvent->nParam2); //SXS_DUMP(_MMI, 0, ppp_Buffer, pEvent->nParam2); UINT8* tmp = (UINT8*)(pEvent->nParam1); while (elem < pEvent->nParam2) { elem++; while(( tmp[elem] !=0x7E)&&(elem < pEvent->nParam2)) { elem ++; } elem ++; CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("PPP handle a packet : %d\n"),elem - packet_head); ppp_ProcessPPP(tmp + packet_head, elem - packet_head); packet_head = elem; } }else{ CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("PPP receive unknow event : 0x%x\n"),pEvent->nEventId); } PPP_CP_EXIT(CPID_Aps_PppProc); }
UINT32 CFW_Cfg_test() { #ifdef CFW_GPRS_SUPPORT //UINT32 ret = 0; UINT32 err_code =0; UINT8 uClip=0; UINT8 nCid=1; CFW_GPRS_PDPCONT_INFO sPdpCont; UINT8 apn[8]; UINT8 add[10]; CFW_SMS_PARAMETER sInfo; UINT8 nIndex; CFW_SMS_STORAGE_INFO sStorageInfo; UINT16 nStorage=0; //test clip, this value was saved in general part err_code = CFW_CfgGetClip(&uClip); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 1, call CFW_CfgGetClip = 0x%x, clip=%d\n",err_code, uClip); uClip = 0; err_code = CFW_CfgSetClip(uClip); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 2, call CFW_CfgSetClip = 0x%x, clip=%d\n",err_code, uClip); err_code = CFW_CfgGetClip(&uClip); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 3, call CFW_CfgGetClip = 0x%x, clip=%d\n\n",err_code, uClip); // test colp, this value was saved in cm part err_code = CFW_CfgGetColp(&uClip); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 4, call CFW_CfgGetColp = 0x%x, Colp=%d\n",err_code, uClip); uClip = 1; err_code = CFW_CfgSetColp(uClip); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 5, call CFW_CfgSetColp = 0x%x, Colp=%d\n",err_code, uClip); err_code = CFW_CfgGetColp(&uClip); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 6, call CFW_CfgGetColp = 0x%x, Colp=%d\n\n",err_code, uClip); // test audiomode, device part,this value was saved in a global. err_code = CFW_CfgGetAudioAudioMode(&uClip); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 7, call CFW_CfgGetAudioAudioMode = 0x%x, Mode=%d\n",err_code, uClip); uClip = 2; err_code = CFW_CfgSetAudioAudioMode(uClip); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 8, call CFW_CfgSetAudioAudioMode = 0x%x, Mode=%d\n",err_code, uClip); err_code = CFW_CfgGetAudioAudioMode(&uClip); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 9, call CFW_CfgGetAudioAudioMode = 0x%x, Mode=%d\n\n",err_code, uClip); // test frequency band, nw part err_code = CFW_CfgNwGetFrequencyBand(&uClip); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 10, call CFW_CfgNwGetFrequencyBand = 0x%x, Band=%d\n",err_code, uClip); uClip = 0x48; err_code = CFW_CfgNwSetFrequencyBand(uClip); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 11, call CFW_CfgNwSetFrequencyBand = 0x%x, Band=%d\n",err_code, uClip); err_code = CFW_CfgNwGetFrequencyBand(&uClip); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 12, call CFW_CfgNwGetFrequencyBand = 0x%x, Band=%d\n\n",err_code, uClip); // test PDDcontext, gprs part sPdpCont.pApn = apn; sPdpCont.pPdpAddr = add; sPdpCont.nApnSize = 8; sPdpCont.nPdpAddrSize = 10; err_code = CFW_CfgGprsGetPdpCxt(nCid, &sPdpCont); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 13, call CFW_CfgGprsGetPdpCxt = 0x%x, nCid=%d\n",err_code, nCid); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 14, nPdpType = %d, nHComp=%d\n", sPdpCont.nPdpType, sPdpCont.nHComp); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 15, nDComp = %d, nPdpAddrSize=%d\n", sPdpCont.nDComp, sPdpCont.nPdpAddrSize); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 16, pPdpAddr = %s, nApnSize=%d,pApn=%s\n\n", sPdpCont.pPdpAddr, sPdpCont.nApnSize,sPdpCont.pApn); nCid = 7; sPdpCont.nPdpType =2; sPdpCont.nHComp = 3; sPdpCont.nDComp = 1; sPdpCont.nPdpAddrSize =9; SUL_StrCopy(sPdpCont.pPdpAddr, "ABwwCGDEF"); sPdpCont.nApnSize = 7; SUL_StrCopy(sPdpCont.pApn, "1002567"); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, ####, call CFW_CfgGprsSetPdpCxt = 0x%x, nCid=%d\n\n",err_code, nCid); err_code = CFW_CfgGprsSetPdpCxt(nCid, &sPdpCont); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 17, call CFW_CfgGprsSetPdpCxt = 0x%x, nCid=%d\n\n",err_code, nCid); sPdpCont.pApn = apn; sPdpCont.pPdpAddr = add; SUL_ZeroMemory8(apn, 8); SUL_ZeroMemory8(add, 10); sPdpCont.nApnSize = 8; sPdpCont.nPdpAddrSize = 10; err_code = CFW_CfgGprsGetPdpCxt(nCid, &sPdpCont); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 18, call CFW_CfgGprsGetPdpCxt = 0x%x, nCid=%d\n",err_code, nCid); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 19, nPdpType = %d, nHComp=%d\n", sPdpCont.nPdpType, sPdpCont.nHComp); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 20, nDComp = %d, nPdpAddrSize=%d\n", sPdpCont.nDComp, sPdpCont.nPdpAddrSize); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 21, pPdpAddr = %s, nApnSize=%d,pApn=%s\n\n", sPdpCont.pPdpAddr, sPdpCont.nApnSize,sPdpCont.pApn); // test sms param, sms part nIndex = 1; err_code = CFW_CfgGetSmsParam(&sInfo, nIndex); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 22, call CFW_CfgGetSmsParam = 0x%x, nIndex=%d\n",err_code, nIndex); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 23 bSimChange = %d, vp=%d\n", sInfo.bSimChange, sInfo.dcs, sInfo.vp); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 24, bearer = %d, bReserved=%d\n", sInfo.bearer, sInfo.bReserved); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 25, mr = %d, mti=%d,nNumber=%s\n", sInfo.mr, sInfo.mti,sInfo.nNumber); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 26, pid = %d, rp=%d,ssr=%d\n", sInfo.pid, sInfo.rp,sInfo.ssr); nIndex = 2; sInfo.bearer =1; sInfo.bReserved = 3; sInfo.bSimChange = 1; sInfo.dcs =8; SUL_StrCopy(sInfo.nNumber, "12365487"); sInfo.mr = 6; sInfo.mti = 4; sInfo.pid = 23; sInfo.rp = 43; sInfo.ssr =10; sInfo.vp = 11; err_code = CFW_CfgSetSmsParam(&sInfo, nIndex); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 27, call CFW_CfgSetSmsParam = 0x%x, nIndex=%d,nNumber=%s\n",err_code, nIndex,sInfo.nNumber); SUL_ZeroMemory8(&sInfo, sizeof(CFW_SMS_PARAMETER)); err_code = CFW_CfgGetSmsParam(&sInfo, nIndex); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 28, call CFW_CfgGetSmsParam = 0x%x, nIndex=%d\n",err_code, nIndex); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 29, bSimChange = %d, vp=%d\n", sInfo.bSimChange, sInfo.dcs, sInfo.vp); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 30, bearer = %d, bReserved=%d\n", sInfo.bearer, sInfo.bReserved); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 31, mr = %d, mti=%d,nNumber=%s\n", sInfo.mr, sInfo.mti,sInfo.nNumber); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 32, pid = %d, rp=%d,ssr=%d\n\n", sInfo.pid, sInfo.rp,sInfo.ssr); // test CFW_CfgSetSmsStorageInfo, sms part nStorage = CFW_SMS_STORAGE_SM; err_code = CFW_CfgGetSmsStorageInfo(&sStorageInfo, nStorage); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 33, call CFW_CfgGetSmsStorageInfo = 0x%x, nStorage=%d\n",err_code, nStorage); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 34, readRecords=%d, sentRecords=%d, storageId=%d\n", sStorageInfo.readRecords, sStorageInfo.sentRecords,sStorageInfo.storageId); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 35, totalSlot=%d, unknownRecords=%d, unReadRecords=%d\n", sStorageInfo.totalSlot, sStorageInfo.unknownRecords,sStorageInfo.unReadRecords); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 36, unsentRecords=%d, usedSlot=%d\n\n", sStorageInfo.unsentRecords, sStorageInfo.usedSlot); nStorage = CFW_SMS_STORAGE_ME; sStorageInfo.readRecords = 20; sStorageInfo.sentRecords =30; sStorageInfo.storageId = CFW_SMS_STORAGE_ME; sStorageInfo.totalSlot =1000; sStorageInfo.unknownRecords = 111; sStorageInfo.unReadRecords = 222; sStorageInfo.unsentRecords =33; sStorageInfo.usedSlot =500; err_code = CFW_CfgSetSmsStorageInfo(&sStorageInfo, nStorage); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 37, call CFW_CfgSetSmsStorageInfo = 0x%x, nStorage=%d\n\n",err_code, nStorage); nStorage = CFW_SMS_STORAGE_ME; err_code = CFW_CfgGetSmsStorageInfo(&sStorageInfo, nStorage); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 38, call CFW_CfgGetSmsStorageInfo = 0x%x, nStorage=%d\n",err_code, nStorage); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 39, readRecords=%d, sentRecords=%d, storageId=%d\n", sStorageInfo.readRecords, sStorageInfo.sentRecords,sStorageInfo.storageId); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 40, totalSlot=%d, unknownRecords=%d, unReadRecords=%d\n", sStorageInfo.totalSlot, sStorageInfo.unknownRecords,sStorageInfo.unReadRecords); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 41, unsentRecords=%d, usedSlot=%d\n\n", sStorageInfo.unsentRecords, sStorageInfo.usedSlot); // test cssn param, cm part uClip =0; nCid =0; err_code = CFW_CfgGetSSN(&uClip, &nCid); CSW_TRACE(CFW_CFG_TS_ID, "in cfg_test, 42, cssi = %d, cssu=%d\n\n",uClip,nCid); #endif return ERR_SUCCESS; }
VOID socketdata_initial(INT32 sockfd, UINT8 type) { CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("start socketdata_initial socketid: 0x%x, type: 0x%x !\n"),sockfd,type); COS_WaitForSemaphore(Tcp_receive_buf_sem, COS_WAIT_FOREVER); // void* buf = NULL; if(0xFF==sockfd) { INT32 sid=0; for(sid = 0; sid<MEMP_NUM_NETCONN; sid++) { SUL_MemSet8(&socketid[sid], 0, sizeof(struct socket_data)); socketid[sid].type = type; } CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("socketdata_initial in TCP init!\n")); COS_ReleaseSemaphore(Tcp_receive_buf_sem); return; } if((sockfd < 0) && (sockfd>=MEMP_NUM_NETCONN)) { COS_ReleaseSemaphore(Tcp_receive_buf_sem); CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("socketdata_initial socket error!\n")); return; } struct socket_data *p = &socketid[sockfd]; switch(p->type) { case NETCONN_UDPLITE: case NETCONN_UDPNOCHKSUM: case NETCONN_UDP: while(p->index[p->front]) { netbuf_delete(p->index[p->front]); p->index[p->front] = NULL; p->front = INDEX_MOD(p->front + 1) ; } break; case NETCONN_TCP: while(p->index[p->front]) { pbuf_free(p->index[p->front]); p->index[p->front] = NULL; p->front = INDEX_MOD(p->front + 1) ; } break; default: break; } SUL_MemSet8(&socketid[sockfd], 0, sizeof(struct socket_data)); socketid[sockfd].type = type; CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("end socketdata_initial socketid: 0x%x, type: 0x%x !\n"),sockfd,type); COS_ReleaseSemaphore(Tcp_receive_buf_sem); return; }
BOOL BAL_TaskInit() { UINT8 i = 0; INT32 err_code = 0x00; UINT32 fs_dev_count = 0; FS_DEV_INFO* fs_dev_info = NULL; UINT32 fs_root_dev_count = 0; #if ( CHIP_ASIC_ID != CHIP_ASIC_ID_JADE) csw_RegisterYourself(); #else DM_CheckPowerOnCause(); #endif // hal_fastOSTimInit(); BAL_DevHandlerInit(); TS_Init_Inner(); // TS_SetOutputMask(CSW_TS_ID, 1); // TS_SetOutputMask(CFW_SIM_TS_ID, 1); // TS_SetOutputMask(CFW_NW_TS_ID, 1); // TS_SetOutputMask(CFW_SMS_TS_ID, 1); // TS_SetOutputMask(CFW_CC_TS_ID, 1); // TS_SetOutputMask(CFW_SS_TS_ID, 1); // TS_SetOutputMask(CFW_PM_TS_ID, 1); // TS_SetOutputMask(BASE_FFS_TS_ID, 1); // TS_SetOutputMask(BASE_TM_TS_ID, 1); // TS_SetOutputMask(CFW_SHELL_TS_ID, 1); // TS_SetOutputMask(CFW_AOM_TS_ID, 1); // open 1,2,3,4 // sxs_IoCtx.TraceBitMap [TGET_ID(_CSW)] = 1|(1 << 1) | (1 << 2)|(1<<3); // open shell trace sxs_IoCtx.TraceBitMap[TGET_ID(_CSW)] = (1 << 1); // // sxs_IoCtx.TraceBitMap [TGET_ID(_MMI)] = 0; // sxs_IoCtx.TraceBitMap [TGET_ID(_MM)] = 0; BAL_SetMMIDefaultValue(); // CSW_CheckMMIDefaultValue() ; CSW_CheckMMIDefaultValue(); // add wys 2007-06-20 csw_MemIint(); PM_CheckValidPowerOnVoltage(3000); /* if(0x00 == CFW_GetValidMarker())//0x00 表示非生产模式 { CSW_TRACE(100, TSTXT("norm modle")); if(!PM_CheckValidPowerOnVoltage(g_MMI_Default_Value.nMinVol)) { hal_ShutDown(); } } else { CSW_TRACE(100, TSTXT("e modle")); } //deleted by mabo to power on at low power voltage,20070829 //add wys 2007-06-20 if(0x00 == CFW_GetValidMarker())//0x00 表示非生产模式 { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("BAL_TaskInit norm modle")); if(!PM_CheckValidPowerOnVoltage(g_MMI_Default_Value.nMinVol)) { hal_ShutDown(); } } else { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("BAL_TaskInit e modle")); } //add end */ CSW_TRACE(BASE_BAL_TS_ID, TSTXT("\nBAL_TaskInit Start. \n")); DRV_FlashPowerUp(); //mabo deleted,20070813 //DRV_FlashInit(CSW_DVR_FLASH_INIT_PARA) ; //romuald added 20080425 #if (CHIP_ASIC_ID != CHIP_ASIC_ID_JADE) DRV_FlashInit(); #endif //Modify for memory overflow bug at 20090724 //for(i = 0; i< SIZEOF(g_BalTasks); i++) for(i = 0; i< MAX_BAL_TASK_NUM; i++) g_BalTasks[i] = HNULL; g_BalTasks[BAL_TASK_NUM(BAL_SYS_TASK_PRIORITY)] = COS_CreateTask_Prv(BAL_SysTask, NULL, NULL, BAL_SYS_TASK_STACK_SIZE, BAL_SYS_TASK_PRIORITY, COS_CREATE_DEFAULT, 0, "BAL_SysTask"); #ifdef CFW_TCPIP_SUPPORT g_BalTasks[BAL_TASK_NUM(BAL_CFW_ADV_TASK_PRIORITY)] = COS_CreateTask_Prv(BAL_CFWApsTask, NULL, NULL, BAL_CFW_ADV_TASK_STACK_SIZE, BAL_CFW_ADV_TASK_PRIORITY, COS_CREATE_DEFAULT, 0, "BAL_CFWApsTask"); #endif g_BalTasks[BAL_TASK_NUM(BAL_DEV_MONITOR_TASK_PRIORITY)] = COS_CreateTask_Prv(BAL_DevMonitorTask, NULL, NULL, BAL_DEV_MONITOR_TASK_STACK_SIZE, BAL_DEV_MONITOR_TASK_PRIORITY, COS_CREATE_DEFAULT, 0, "BAL_DevMonitorTask"); g_BalTasks[3] = COS_CreateTask_Prv(BAL_BackgroundTask, NULL, NULL, BAL_BG_TASK_STACK_SIZE, COS_BK_TASK_PRI, COS_CREATE_DEFAULT, 0, "BAL_BackgroundTask"); //Add by lixp at 20080201 // #ifdef ML_SUPPORT ML_Init(); ML_SetCodePage(ML_ISO8859_1); #elif defined(NEW_ML_SUPPORT) #endif BAL_ApplicationInit(); err_code = VDS_Init(); // Initialize VDS. added bye nie. 20070322 if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"VDS_Init() OK.\n"); } else { CSW_TRACE(BASE_BAL_TS_ID,"VDS_Init() ERROR, Error code: %d.\n", err_code); } err_code = DSM_DevInit(); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"DSM_DevInit OK.\n"); } else { CSW_TRACE(BASE_BAL_TS_ID,"DSM_DevInit ERROR, Error code: %d. \n",err_code); } err_code = REG_Init(); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("REG_Init() OK.\n")); } else { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("REG_Init() Fail!Error code:%d.\n"),err_code); } err_code = CFW_CfgInit(); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("CFW_CfgInit OK.\n")); } else { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("CFW_CfgInit ERROR, Error code: 0x%08x \n"), err_code); } err_code = SMS_DM_Init(); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("SMS_DM_Init OK.\n")); } else { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("SMS_DM_Init ERROR, Error code: %d.\n"), err_code); } err_code = FS_PowerOn(); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"FS Power On Check OK.\n"); } else { CSW_TRACE(BASE_BAL_TS_ID,"FS Power On Check ERROR, Error code: %d. \n",err_code); } // Get FS device table. err_code = FS_GetDeviceInfo(&fs_dev_count, &fs_dev_info); if(err_code != ERR_SUCCESS) { CSW_TRACE(BASE_BAL_TS_ID,"Device not register.\n"); fs_dev_count = 0; } // Check the state of root device ,if not format, format it. // Mount root device. for(i = 0; i < fs_dev_count; i++) { // format the flash device. if(fs_dev_info[i].dev_type == FS_DEV_TYPE_FLASH && fs_dev_info[i].is_root == TRUE) { err_code = FS_HasFormatted(fs_dev_info[i].dev_name,FS_TYPE_FAT); if(ERR_FS_HAS_FORMATED == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s has formated.\n",fs_dev_info[i].dev_name); } else if(ERR_FS_NOT_FORMAT == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s not format.\n",fs_dev_info[i].dev_name); err_code = FS_Format(fs_dev_info[i].dev_name,FS_TYPE_FAT,0); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s format ok.\n",fs_dev_info[i].dev_name); } else if(ERR_FS_NOT_FORMAT == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s format error.Error code:%d.\n",fs_dev_info[i].dev_name,err_code); } } else { CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s has formated error.Error code:%d.\n",fs_dev_info[i].dev_name,err_code); } // Mount root device. if(fs_root_dev_count > 0) { CSW_TRACE(BASE_BAL_TS_ID,"The FS root device too more:%d.\n",fs_root_dev_count); } else { err_code = FS_MountRoot(NULL); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"FS MountRoot(%s) OK.\n",fs_dev_info[i].dev_name); } else { CSW_TRACE(BASE_BAL_TS_ID,"FS MountRoot(%s) ERROR, Error code: %d. \n",fs_dev_info[i].dev_name,err_code); } } fs_root_dev_count ++; } } //#ifdef SIM_SWITCH_ENABLE #if 0 // //Add by lixp at 070407 //SimSwitch(UINT8 SimNum) //#define SIM_1 1 //simcard 1 //#define SIM_2 2 //simcard 2 // UINT8 nSIMCARD_INDEX = 0x00; err_code = CFW_CfgGetSimSwitch(&nSIMCARD_INDEX); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("CFW_CfgGetSimSwitch OK.\n")); } else { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("CFW_CfgGetSimSwitch ERROR, Error code: 0x%08x \n"), err_code); } SimSwitch(nSIMCARD_INDEX); CSW_TRACE(BASE_BAL_TS_ID, TSTXT("nSIMCARD_INDEX is %d\n"),nSIMCARD_INDEX); #endif #ifdef FSTRACE_SUPPORT fsTace_task_create(); #endif #if defined(USER_DATA_CACHE_SUPPORT) && !defined(_T_UPGRADE_PROGRAMMER) err_code = VDS_InitCache(); // Initialize VDS Cache. if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"VDS_InitCache() OK.\n"); } else { CSW_TRACE(BASE_BAL_TS_ID,"VDS_InitCache() ERROR, Error code: %d.\n", err_code); } #endif return TRUE; }
VOID Cfw_SetApsApp(UINT8 ApsApp) { CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("!!!!!!!!!Cfw_SetApsApp. 0x%x\n"),ApsApp); Aps_APP = ApsApp; }
BOOL BAL_ApsEvtParse (COS_EVENT* pEvent) { // SXS_TRACE(_MMI, TSTXT("-----------APS parse ID:%d------\n"),pEvent->nEventId); // CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("-----------APS parse ID: 0x%x, Aps_APP: 0x%x\n"),pEvent->nEventId, Aps_APP); switch (pEvent->nEventId) { case EV_INTER_APS_TCPIP_REQ: if(Aps_APP != APS_TCP) { //ppp_Init(); Cfw_SetApsApp(APS_TCP); Pre_Task = Gprs_GetAppCng(); Gprs_SetAppCng(TRUE, CFW_bal_GetTaskHandle(CSW_TASK_ID_APS)); } BAL_ApsTaskTcpipProc( pEvent ); break; case EV_INTER_APS_SMTP_REQ: // SXS_TRACE(_MMI, TSTXT("!!!!!!!!EV_INTER_APS_SMTP_REQ\n")); //BAL_ApsTaskSmtpProc( pEvent ); // mime_parse_main(); break; case EV_INTER_APS_POP3_REQ: BAL_ApsTaskPop3Proc( pEvent ); break; case EV_CFW_GPRS_DATA_IND: case EV_CFW_GPRS_ACT_RSP: case EV_CFW_GPRS_ATT_RSP: //case EV_INTER_APS_ACT_REQ: case EV_CFW_GPRS_CXT_DEACTIVE_IND: if(Aps_APP == APS_TCP) BAL_ApsTaskTcpipProc( pEvent ); else if(Aps_APP == APS_PPP) Aps_PppProc( pEvent ); break; case EV_TIMER: BAL_ApsTaskTimerProc( pEvent ); break; case EV_APS_PPP_DATA_REQ: if(Aps_APP != APS_PPP) { ppp_Init(); Cfw_SetApsApp(APS_PPP); Pre_Task = Gprs_GetAppCng(); Gprs_SetAppCng(TRUE, CFW_bal_GetTaskHandle(CSW_TASK_ID_APS)); } CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS receive ppp data from AT.\n")); Aps_PppProc( pEvent ); break; default: break; } // COS_FREE(pEvent->nParam1); return TRUE; }