summaryrefslogtreecommitdiff
path: root/fasthdlc.h
diff options
context:
space:
mode:
Diffstat (limited to 'fasthdlc.h')
-rwxr-xr-xfasthdlc.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/fasthdlc.h b/fasthdlc.h
index e6a149d..adb5597 100755
--- a/fasthdlc.h
+++ b/fasthdlc.h
@@ -206,6 +206,11 @@ static inline unsigned int hdlc_frame_precalc(unsigned char x, unsigned short c)
}
c <<= 1;
}
+ /* Consume the extra 0 now rather than later. */
+ if (ones == 5) {
+ ones = 0;
+ consumed++;
+ }
return HFP(STATUS_VALID, ones, consumed, data);
}
@@ -441,9 +446,10 @@ static inline int fasthdlc_rx_run(struct fasthdlc_state *h)
retval = (RETURN_COMPLETE_FLAG);
/* Stay in this state */
h->state = 1;
- } else
+ } else {
/* An abort (either out of sync of explicit) */
retval = (RETURN_DISCARD_FLAG);
+ }
break;
case STATUS_VALID:
retval = (next & DATA_MASK);