Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 75:0d513869231f, committed 2017-07-04
- Comitter:
- nixnax
- Date:
- Tue Jul 04 18:35:43 2017 +0000
- Parent:
- 74:7409fbeabb2e
- Child:
- 76:00e208cceb8b
- Commit message:
- PPP packet handler updated; CRC to unsigned int
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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) {