//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 socketdata_initial(INT32 sockfd) { SUL_MemSet8(&socketid[sockfd], 0, sizeof(struct socket_data)); }
VOID stats_init(VOID) { SUL_MemSet8(&lwip_stats, 0, sizeof(struct stats_)); }
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; }
void CFW_GprsQos2Api(CFW_GPRS_QOS sQos, UINT8 ApiQos[11], UINT8 *pQosLength) { CFW_GPRS_SSMQOS TempQos; TempQos.Length = 11; SUL_MemSet8(&TempQos.QOS, 0x00, (UINT32)TempQos.Length); #if 1 //add by wuys for gprs test 2008-09-03 //TempQos.QOS.ReliabilityClass = 3;//sQos.nReliability; TempQos.QOS.ReliabilityClass = sQos.nReliability;//modify by wuys 2008-01-21 //TempQos.QOS.DelayClass = 4;//sQos.nDelay; TempQos.QOS.DelayClass = sQos.nDelay;//modify by wuys 2008-01-21 TempQos.QOS.Spare0 = 0; //TempQos.QOS.PrecedenceClass = 3;//sQos.nPrecedence; TempQos.QOS.PrecedenceClass = sQos.nPrecedence;//modify by wuys 2008-01-21 TempQos.QOS.Spare1 = 0; //TempQos.QOS.PeakThroughput = 4;//sQos.nPeak; TempQos.QOS.PeakThroughput = sQos.nPeak;//modify by wuys 2008-01-21 //TempQos.QOS.MeanThroughput = 16;//sQos.nMean; TempQos.QOS.MeanThroughput = 0x1F;//modify by wuys 2010-09-20, refer to Nokia TempQos.QOS.MeanThroughput = sQos.nMean;//modify by wuys 2008-01-21 TempQos.QOS.Spare2 = 0; TempQos.QOS.DeliveryOfErroneousSDU = 1; TempQos.QOS.DeliveryOrder = 2; TempQos.QOS.TrafficClass = 4; TempQos.QOS.MaximumSDUSize = 0x96; TempQos.QOS.MaximumBitRateForUplink = 0x40; TempQos.QOS.MaximumBitRateForDownlink = 0x40; TempQos.QOS.SDUErrorRatio = 4; TempQos.QOS.ResidualBER = 7; TempQos.QOS.TrafficHandlingPriority = 0; TempQos.QOS.TransferDelay = 0; TempQos.QOS.GuaranteedBitRateForUplink = 0; TempQos.QOS.GuaranteedBitRateForDownlink = 0; #else UINT8* PtQoS = &TempQos.QOS; UINT8 PdpCtxNb = 15; PtQoS[0]= ((tcpTabQos[PdpCtxNb][0])<<3) | tcpTabQos[PdpCtxNb][1]; /* Delay class , Reliability class */ /* 1 => Sapi 3 , 1 => RLC ack, LLC ack, protected mode */ /* 2 => Sapi 5 , 2 => RLC ack, LLC ack, protected mode */ /* 3 => Sapi 9 , 3 => RLC ack, LLC unack, protected mode */ /* else => Sapi 11 , 4 => RLC unack, LLC unack, protected mode */ /* 5 => RLC unack, LLC unack, unprotected mode*/ // En mode llc ack, plus le numero de sapi est grand plus la fenetre est petite // plus les emmerdes sont grands PtQoS[1]= ((tcpTabQos[PdpCtxNb][2])<<4) | 3;//tcpTabQos[PdpCtxNb][3]; /* Peak throughput , Precedence class */ /* 1 => Up to 1 000 octet/s */ /* 2 => Up to 2 000 octet/s */ /* 3 => Up to 4 000 octet/s */ /* 4 => Up to 8 000 octet/s */ /* 5 => Up to 16 000 octet/s */ /* 6 => Up to 32 000 octet/s */ /* 7 => Up to 64 000 octet/s */ /* 8 => Up to 128 000 octet/s */ /* 9 => Up to 256 000 octet/s */ PtQoS[2]= tcpTabQos[PdpCtxNb][4]; /* Mean throughput (1 => 100octets/s) */ PtQoS[3]= ((tcpTabQos[PdpCtxNb][5])<<5) | ((tcpTabQos[PdpCtxNb][6])<<3) | (tcpTabQos[PdpCtxNb][7]); /* Traffic class, Delivery order, Delivery of erroneous SDU */ /* 0 => Subscribed traffic class 0 Subscribed delivery order 0 Subscribed delivery of erroneous SDUs */ /* 1 => Conversational class 1 With delivery order 1 No detect ('-') */ /* 2 => Streaming class 2 Without delivery order 2 Erroneous SDUs are delivered */ /* 3 => Interactive class 3 Erroneous SDUs are not delivered */ /* 4 => Background class */ PtQoS[4]= tcpTabQos[PdpCtxNb][8]; /* Maximum SDU size (0x99 => 1520 bytes)*/ PtQoS[5]= tcpTabQos[PdpCtxNb][9]; /* Maximum bit rate for uplink (0x3F => 63 kbps) */ PtQoS[6]= tcpTabQos[PdpCtxNb][10];/* Maximum bit rate for downlink (0x3F => 63 kbps) */ PtQoS[7]= ((tcpTabQos[PdpCtxNb][11])<<4) | (tcpTabQos[PdpCtxNb][12]); /* Residual BER (1 => 5*10-2 ), SDU ratio error (1=>1*10-2 ) */ PtQoS[8]= ((tcpTabQos[PdpCtxNb][13])<<2)| tcpTabQos[PdpCtxNb][14]; /* Transfer delay (0xF => 150ms), Traffic handling priority */ PtQoS[9] = tcpTabQos[PdpCtxNb][15]; /* Guaranted bit rate for uplink */ PtQoS[10]= tcpTabQos[PdpCtxNb][16]; /* Guaranted bit rate for downlink */ #endif SUL_MemSet8(&TempQos.QOS, 0x00, (UINT32)TempQos.Length); TempQos.QOS.MeanThroughput = 0x1F;//modify by wuys 2010-09-20, refer to Nokia SUL_MemCopy8(ApiQos, &TempQos.QOS, (UINT32)TempQos.Length); *pQosLength = TempQos.Length; }