2 Incheckningar 2ac6220b6e ... 5e059babab

Upphovsman SHA1 Meddelande Datum
  wulianwei 5e059babab Merge branch 'master' of http://192.168.100.32:3000/wulianwei/NIM_DSP6748 1 månad sedan
  wulianwei 971ad9b98c edit:修复以太网分片bug 1 månad sedan

+ 7 - 1
code/device/lwip.c

@@ -16,6 +16,10 @@
 
 #define MAX_SIZE                          4096
 
+#define SEND_SIZE                          5*1024
+
+static unsigned char send_data[SEND_SIZE];
+
 
 static err_t tcp_accept_handle(void *arg, struct tcp_pcb *pcb, err_t err);
 static err_t tcp_recv_handle(void *arg, struct tcp_pcb *pcb, struct pbuf *p,
@@ -232,10 +236,11 @@ void lwip_udp_sendto(struct udp_pcb *pcb, unsigned int ip, int port,
 /**
  * udp Ïògui·¢ËÍÊý¾Ý
  */
+
 void lwip_udp_send_gui(unsigned char *data, int len)
 {
     struct pbuf *pbuf = pbuf_alloc(PBUF_TRANSPORT, len,
-                                   PBUF_REF);
+                                          PBUF_REF);
     pbuf->payload = data;
     udp_send(gui_udp_pcb, pbuf);
     pbuf_free(pbuf);
@@ -320,6 +325,7 @@ void lwip_udp_send_vofa(float *data, int len)
  */
 void lwip_udp_send_vofa2(float *data1, float *data2, int len)
 {
+    ConsolePuts("lwip send data", -1);
     int i = 0;
     char tail[4] = {0x00, 0x00, 0x80, 0x7f};
     int flen = (sizeof(float)*2+4)*len;

+ 2 - 2
code/lib/lwip/lwipopts.h

@@ -74,7 +74,7 @@
 **                          Memory Options
 *****************************************************************************/
 #define MEM_ALIGNMENT                   4         
-#define MEM_SIZE                        (30 * 1024) /* 30K */
+#define MEM_SIZE                        (50 * 1024) /* 50K */
 
 /*****************************************************************************
 **                          Memory Options
@@ -86,7 +86,7 @@
 /*****************************************************************************
 **                          Memory Options
 *****************************************************************************/
-#define IP_REASSEMBLY                     0
+#define IP_REASSEMBLY                     1
 #define IP_FRAG                           1
 
 /*****************************************************************************

+ 1 - 2
code/lib/lwip/src/core/dhcp.c

@@ -166,8 +166,7 @@ static void
 dhcp_handle_nak(struct netif *netif)
 {
   struct dhcp *dhcp = netif->dhcp;
-  LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_handle_nak(netif=%p) %c%c%"U16_F"\n", 
-    (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
+  LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_handle_nak(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
   /* Set the interface down since the address must no longer be used, as per RFC2131 */
   netif_set_down(netif);
   /* remove IP address from interface */

+ 4 - 3
code/lib/lwip/src/core/ipv4/ip_frag.c

@@ -48,8 +48,8 @@
 #include "lwip/stats.h"
 #include "lwip/icmp.h"
 
-#include <string.h>
-
+#include <stdio.h>
+#include "util/sys_util.h"
 #if IP_REASSEMBLY
 /**
  * The IP reassembly code currently has the following limitations:
@@ -677,7 +677,6 @@ ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest)
   left = p->tot_len - IP_HLEN;
 
   nfb = (mtu - IP_HLEN) / 8;
-
   while (left) {
     last = (left <= mtu - IP_HLEN);
 
@@ -756,6 +755,7 @@ ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest)
     if (header != NULL) {
       pbuf_chain(header, rambuf);
       netif->output(netif, header, dest);
+      delay_us(100);//保证DMA发送完数据包
       IPFRAG_STATS_INC(ip_frag.xmit);
       snmp_inc_ipfragcreates();
       pbuf_free(header);
@@ -769,6 +769,7 @@ ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest)
      * when allocated.
      */
     netif->output(netif, rambuf, dest);
+    delay_us(300);//保证DMA发送完数据包
     IPFRAG_STATS_INC(ip_frag.xmit);
 
     /* Unfortunately we can't reuse rambuf - the hardware may still be

+ 1 - 1
code/lib/lwip/src/include/lwip/debug.h

@@ -91,7 +91,7 @@
                              } while(0)
 
 #else  /* LWIP_DEBUG */
-#define LWIP_DEBUGF(debug, message) 
+#define LWIP_DEBUGF(debug, message)
 #endif /* LWIP_DEBUG */
 
 #endif /* __LWIP_DEBUG_H__ */

+ 1 - 1
code/lib/lwip/src/include/lwip/opt.h

@@ -442,7 +442,7 @@
  * packet data to be fragmented.
  */
 #ifndef IP_FRAG_USES_STATIC_BUF
-#define IP_FRAG_USES_STATIC_BUF         1
+#define IP_FRAG_USES_STATIC_BUF         0
 #endif
 
 /**

+ 1 - 1
code/util/sys_util.h

@@ -10,6 +10,6 @@
 
 void delay_ms(unsigned int ms);
 
-void delay_ms(unsigned int us);
+void delay_us(unsigned int us);
 
 #endif /* UITL_SYS_UTIL_H_ */

+ 9 - 5
main.c

@@ -5,6 +5,7 @@
 #include "hlx.h"
 
 
+
 #define LEN_IP_ADDR                    (4u)
 #define ASCII_NUM_IDX                  (48u)
 
@@ -13,17 +14,16 @@ void DeviceInit();
 char* dd;
 int main()
 {
-
     DeviceInit();
     ConsolePuts("\r\n ============NIM DSP START===========.\r\n", -1);
     lwip_tcp_init(TCP_SERVER_PORT); //开启本设备TCP服务器
 
     // 主循环
     float t = 0;
-#define ALGORITHM_SIZE  120
+#define ALGORITHM_SIZE  1000
     for (;;)
     {
-        /*if(t>2){
+        if(t>2){
             t=0;
         }
         t += 0.1;
@@ -39,7 +39,6 @@ int main()
 
             // 发送帧尾
             lwip_udp_send_vofa2(ch1,ch2,sizeof(ch1)/sizeof(float));
-            delay_ms(10);*/
 //        ConsoleRecvWait(10);
 //        if (ConsoleRecvFlag() == REV_OK)
 //        {
@@ -48,7 +47,12 @@ int main()
 //            ConsolePrintf("data %s,len %d,%d",sdata,sizeof(sdata),sizeof(struct pbuf));
 //            ConsoleRecvClear();
 //        }
-
+            short s1[ALGORITHM_SIZE] = {0};
+            for(i = 0;i<ALGORITHM_SIZE;i++)
+            {
+                s1[i] = i;
+            }
+            //lwip_udp_send_gui((unsigned char*)s1,sizeof(s1));
         HlxMain();
     }
 }

+ 2 - 1
nim_config.h

@@ -9,6 +9,7 @@
 #define NIM_CONFIG_H_
 
 #include <string.h>
+#include <stdio.h>
 
 #include "hw_types.h"
 #include "soc_C6748.h"
@@ -35,7 +36,7 @@
 //#define STATIC_IP_ADDRESS               0xC0A801C8  //192.168.1.200
 
 //#define UI_IP_ADDRESS               0xC0A801C9  //192.168.1.201
-#define UI_IP_ADDRESS               0xC0A80143  //192.168.1.101
+#define UI_IP_ADDRESS               0xC0A80164  //192.168.1.101
 
 #define UI_UDP_PORT                 8000