diff options
author | hm <hm@FreeBSD.org> | 2000-10-20 11:20:58 +0000 |
---|---|---|
committer | hm <hm@FreeBSD.org> | 2000-10-20 11:20:58 +0000 |
commit | 0660ded96619d9701942d2d30e53a7a4f39a4237 (patch) | |
tree | 3287f7aa00632f4e130e2b0a476d7043a0f4fe38 /sys/i4b/layer1 | |
parent | a961cceaf1336a3d72d56b73eeb93d908be68c0c (diff) | |
download | FreeBSD-src-0660ded96619d9701942d2d30e53a7a4f39a4237.zip FreeBSD-src-0660ded96619d9701942d2d30e53a7a4f39a4237.tar.gz |
Submitted by: Hans Petter Selasky <hselasky@c2i.net>
Remove double 0x7e flags between hdlc-frames.
Diffstat (limited to 'sys/i4b/layer1')
-rw-r--r-- | sys/i4b/layer1/i4b_hdlc.h | 30 | ||||
-rw-r--r-- | sys/i4b/layer1/ihfc/i4b_ihfc_drv.c | 20 |
2 files changed, 33 insertions, 17 deletions
diff --git a/sys/i4b/layer1/i4b_hdlc.h b/sys/i4b/layer1/i4b_hdlc.h index a34fb03..ebd48c1 100644 --- a/sys/i4b/layer1/i4b_hdlc.h +++ b/sys/i4b/layer1/i4b_hdlc.h @@ -33,6 +33,11 @@ * * last edit-date: [Wed Jul 19 09:41:13 2000] * + * NOTE: + * - October 19th: made minor changes to HDLC_ENCODE macro + * Please conform "ihfc/i4b_ihfc_drv.c" (ihfc_hdlc_Bwrite) + * for correct usage! (-hp) + * *---------------------------------------------------------------------------*/ #ifndef _I4B_HDLC_H_ @@ -309,24 +314,27 @@ const u_short HDLC_BIT_TAB[256] = { 0x0100, tmp2 = 0x7e; \ goto j3##d; \ case 3: /* get new frame */ \ - flag--; \ gfrcmd; \ - flag++; \ - crc = -1; \ - ib = 0; \ - if (!len--) { len++; flag++; goto j0##d; } \ - goto j1##d; /* first byte */ \ + if (!len--) \ + { \ + len++; \ + flag--; /* don't proceed */ \ + tmp2 = 0x7e; \ + goto j3##d; /* final FS */ \ + } \ + else \ + { \ + crc = -1; \ + ib = 0; \ + goto j1##d; /* first byte */ \ + } \ case 4: /* CRC (lsb's) */ \ - j0##d: \ crc ^= -1; \ case 5: /* CRC (msb's) */ \ tmp2 = (u_char)crc; \ crc >>= 8; \ + flag = 1; \ goto j2##d; /* CRC stuff */ \ - case 6: /* frame done */ \ - tmp2 = 0x7e; /* end FS */ \ - flag = 1; \ - goto j3##d; \ } \ } \ else \ diff --git a/sys/i4b/layer1/ihfc/i4b_ihfc_drv.c b/sys/i4b/layer1/ihfc/i4b_ihfc_drv.c index c0f436a..3fb4daf 100644 --- a/sys/i4b/layer1/ihfc/i4b_ihfc_drv.c +++ b/sys/i4b/layer1/ihfc/i4b_ihfc_drv.c @@ -233,8 +233,9 @@ ihfc_control(ihfc_sc_t *sc, int flag) else { S_SCTRL &= ~0x04; /* TE mode */ + S_STDEL &= 0x7f; /* use mask! */ S_CLKDEL &= ~0x7f; /* clear delay */ - S_CLKDEL |= S_STDEL; /* set delay */ + S_CLKDEL |= S_STDEL; /* set delay */ } if (S_DLP) /* configure D-priority */ { @@ -1419,10 +1420,18 @@ ihfc_hdlc_Bwrite (ihfc_sc_t *sc, u_char chan) i4b_Bfreembuf(S_MBUF); S_MBUF = ihfc_getmbuf(sc, chan); - if (!S_MBUF) goto d0; - - src = S_MBUFDATA; - len = S_MBUFLEN; + if (S_MBUF) + { + src = S_MBUFDATA; + len = S_MBUFLEN; + } + else + { + sendlen = 0; /* Exit after final FS, * + * else the buffer will * + * only be filled with * + * "0x7e"-bytes! */ + } }, {/* wrd */ @@ -1437,7 +1446,6 @@ ihfc_hdlc_Bwrite (ihfc_sc_t *sc, u_char chan) S_MBUFLEN = len; } - d0: S_HDLC_IB = ib; S_HDLC_BLEVEL = blevel; S_HDLC_TMP = tmp; |