diff --git a/sys/i4b/layer1/i4b_hdlc.h b/sys/i4b/layer1/i4b_hdlc.h index a34fb03bc7ea..ebd48c12e98c 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 c0f436ab94c5..3fb4dafda082 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;