RealtimeCompLab2
Dependencies: mbed
Fork of PPP-Blinky by
Diff: main.cpp
- Revision:
- 57:8deab70fef2e
- Parent:
- 56:b5b2e1c09f42
- Child:
- 58:8f39f28f9b14
--- a/main.cpp Sun Jan 29 23:07:53 2017 +0000 +++ b/main.cpp Tue Jan 31 13:41:00 2017 +0000 @@ -141,13 +141,11 @@ int pc_getBuf() // get one character from the buffer { - if ( rxbufNotEmpty() ) { __disable_irq(); // critical section start int x = ppp.rx.buf[ ppp.rx.tail ]; ppp.rx.tail=(ppp.rx.tail+1)&(BUFLEN-1); __enable_irq(); // critical section end return x; - } else return -1; } void processHDLCFrame(int start, int end) // process received frame @@ -677,7 +675,7 @@ memcpy( s-12, pseudoHeader, 12); // copy in the fake header checksumtcp[0]=0; checksumtcp[1]=0; - sum=dataCheckSum(s-12,tcpSize+12); // calculate the TCP checksum + sum=dataCheckSum(s-12,tcpSize+12); // calculate the TCP checksum with the fake header checksumtcp[0]=sum>>8; checksumtcp[1]=sum; memcpy( s-12, temp, 12); // restore the 12 bytes that the fake header overwrote @@ -869,7 +867,6 @@ void wait_for_HDLC_frame() { - while ( rxbufNotEmpty() ) { int rx = pc_getBuf(); if (ppp.hdlc.frameBusy) { @@ -896,7 +893,7 @@ if ( ppp.online==0 ) { char * clientFound = strstr( (char *)rxbufppp, "CLIENTCLIENT" ); // look for PC string if( clientFound ) { - strcpy( clientFound, "FOUND!FOUND!" ); // overwrite so we don't get fixated + strcpy( clientFound, "FOUND!FOUND!" ); // overwrite so we don't find it again pc.printf("CLIENTSERVER"); // respond to PC ppp.online=1; // we can stop looking for the string debug(("Connect string found\n"));