Lab2_web / Mbed 2 deprecated webserverBlinky

Dependencies:   mbed

Fork of webserverBlinky by RealTimeCompLab2

Revision:
75:0d513869231f
Parent:
74:7409fbeabb2e
Child:
76:00e208cceb8b
diff -r 7409fbeabb2e -r 0d513869231f main.cpp
--- a/main.cpp	Wed Jun 28 18:36:05 2017 +0000
+++ b/main.cpp	Tue Jul 04 18:35:43 2017 +0000
@@ -331,9 +331,9 @@
     }
 }
 
-int dataCheckSum(char * ptr, int len)
+unsigned int dataCheckSum(char * ptr, int len)
 {
-    int sum=0;
+    unsigned int sum=0;
     int placeHolder;
     if (len&1) {
         placeHolder = ptr[len-1];    // when length is odd stuff in a zero byte
@@ -697,7 +697,7 @@
 
     checksumtcp[0]=0;
     checksumtcp[1]=0;
-    int pseudoHeaderSum=dataCheckSum(pseudoHeader,tcpSize+12); // calculate the TCP checksum starting at the pseudo-header
+    unsigned int pseudoHeaderSum=dataCheckSum(pseudoHeader,tcpSize+12); // calculate the TCP checksum starting at the pseudo-header
     checksumtcp[0]=pseudoHeaderSum>>8;
     checksumtcp[1]=pseudoHeaderSum;
     memcpy( s-12, tempHold, 12); // restore the 12 bytes that the pseudo-header overwrote
@@ -896,14 +896,13 @@
         int rx = pc_getBuf();
         if (ppp.hdlc.frameBusy) {
             if (rx==FRAME_7E) {
-                ppp.hdlc.frameBusy=0; // done gathering frame
                 if (ppp.rx.tail == 0) { // did we just wrap around?
                     ppp.hdlc.frameEndIndex=BUFLEN-1; // wrap back to end of buffer
                 } else {
                     ppp.hdlc.frameEndIndex=ppp.rx.tail-1; // remember where frame ends
                 }
                 processHDLCFrame(ppp.hdlc.frameStartIndex, ppp.hdlc.frameEndIndex);
-                ppp.hdlc.frameStartIndex = ppp.hdlc.frameEndIndex;
+                ppp.hdlc.frameStartIndex = ppp.rx.tail; // where next frame will start
             }
         } else {
             if (rx==FRAME_7E) {