Lines Matching refs:hdlctx
261 if (test_and_set_bit(0, &s->hdlctx.in_hdlc_tx)) in hdlcdrv_transmitter()
264 if (s->hdlctx.numbits >= 16) { in hdlcdrv_transmitter()
265 if (hdlcdrv_hbuf_full(&s->hdlctx.hbuf)) { in hdlcdrv_transmitter()
266 clear_bit(0, &s->hdlctx.in_hdlc_tx); in hdlcdrv_transmitter()
269 hdlcdrv_hbuf_put(&s->hdlctx.hbuf, s->hdlctx.bitbuf); in hdlcdrv_transmitter()
270 s->hdlctx.bitbuf >>= 16; in hdlcdrv_transmitter()
271 s->hdlctx.numbits -= 16; in hdlcdrv_transmitter()
273 switch (s->hdlctx.tx_state) { in hdlcdrv_transmitter()
275 clear_bit(0, &s->hdlctx.in_hdlc_tx); in hdlcdrv_transmitter()
279 if (s->hdlctx.numflags) { in hdlcdrv_transmitter()
280 s->hdlctx.numflags--; in hdlcdrv_transmitter()
281 s->hdlctx.bitbuf |= in hdlcdrv_transmitter()
282 0x7e7e << s->hdlctx.numbits; in hdlcdrv_transmitter()
283 s->hdlctx.numbits += 16; in hdlcdrv_transmitter()
286 if (s->hdlctx.tx_state == 1) { in hdlcdrv_transmitter()
287 clear_bit(0, &s->hdlctx.in_hdlc_tx); in hdlcdrv_transmitter()
294 s->hdlctx.tx_state = 1; in hdlcdrv_transmitter()
295 s->hdlctx.numflags = flgs; in hdlcdrv_transmitter()
302 s->hdlctx.tx_state = 0; in hdlcdrv_transmitter()
303 s->hdlctx.numflags = 1; in hdlcdrv_transmitter()
308 s->hdlctx.buffer, in hdlcdrv_transmitter()
311 s->hdlctx.bp = s->hdlctx.buffer; in hdlcdrv_transmitter()
312 append_crc_ccitt(s->hdlctx.buffer, pkt_len); in hdlcdrv_transmitter()
313 s->hdlctx.len = pkt_len+2; /* the appended CRC */ in hdlcdrv_transmitter()
314 s->hdlctx.tx_state = 2; in hdlcdrv_transmitter()
315 s->hdlctx.bitstream = 0; in hdlcdrv_transmitter()
319 if (!s->hdlctx.len) { in hdlcdrv_transmitter()
320 s->hdlctx.tx_state = 0; in hdlcdrv_transmitter()
321 s->hdlctx.numflags = 1; in hdlcdrv_transmitter()
324 s->hdlctx.len--; in hdlcdrv_transmitter()
325 s->hdlctx.bitbuf |= *s->hdlctx.bp << in hdlcdrv_transmitter()
326 s->hdlctx.numbits; in hdlcdrv_transmitter()
327 s->hdlctx.bitstream >>= 8; in hdlcdrv_transmitter()
328 s->hdlctx.bitstream |= (*s->hdlctx.bp++) << 16; in hdlcdrv_transmitter()
331 mask3 = 0xffffffff >> (31-s->hdlctx.numbits); in hdlcdrv_transmitter()
332 s->hdlctx.numbits += 8; in hdlcdrv_transmitter()
335 if ((s->hdlctx.bitstream & mask1) != mask1) in hdlcdrv_transmitter()
337 s->hdlctx.bitstream &= ~mask2; in hdlcdrv_transmitter()
338 s->hdlctx.bitbuf = in hdlcdrv_transmitter()
339 (s->hdlctx.bitbuf & mask3) | in hdlcdrv_transmitter()
340 ((s->hdlctx.bitbuf & in hdlcdrv_transmitter()
342 s->hdlctx.numbits++; in hdlcdrv_transmitter()
354 s->hdlctx.tx_state = 0; in start_tx()
355 s->hdlctx.numflags = tenms_to_2flags(s, s->ch_params.tx_delay); in start_tx()
356 s->hdlctx.bitbuf = s->hdlctx.bitstream = s->hdlctx.numbits = 0; in start_tx()
358 s->hdlctx.ptt = 1; in start_tx()
366 if (!s || s->magic != HDLCDRV_MAGIC || s->hdlctx.ptt || !s->skb) in hdlcdrv_arbitrate()
373 s->hdlctx.slotcnt = s->ch_params.slottime; in hdlcdrv_arbitrate()
376 if ((--s->hdlctx.slotcnt) > 0) in hdlcdrv_arbitrate()
378 s->hdlctx.slotcnt = s->ch_params.slottime; in hdlcdrv_arbitrate()
448 s->hdlctx.hbuf.rd = s->hdlctx.hbuf.wr = 0; in hdlcdrv_open()
449 s->hdlctx.in_hdlc_tx = 0; in hdlcdrv_open()
450 s->hdlctx.tx_state = 1; in hdlcdrv_open()
451 s->hdlctx.numflags = 0; in hdlcdrv_open()
452 s->hdlctx.bitstream = s->hdlctx.bitbuf = s->hdlctx.numbits = 0; in hdlcdrv_open()
453 s->hdlctx.ptt = 0; in hdlcdrv_open()
454 s->hdlctx.slotcnt = s->ch_params.slottime; in hdlcdrv_open()
455 s->hdlctx.calibrate = 0; in hdlcdrv_open()
521 s->hdlctx.slotcnt = 1; in hdlcdrv_ioctl()
569 s->hdlctx.calibrate = bi.data.calibrate * s->par.bitrate / 16; in hdlcdrv_ioctl()
645 spin_lock_init(&s->hdlctx.hbuf.lock); in hdlcdrv_setup()
646 s->hdlctx.hbuf.rd = s->hdlctx.hbuf.wr = 0; in hdlcdrv_setup()
647 s->hdlctx.in_hdlc_tx = 0; in hdlcdrv_setup()
648 s->hdlctx.tx_state = 1; in hdlcdrv_setup()
649 s->hdlctx.numflags = 0; in hdlcdrv_setup()
650 s->hdlctx.bitstream = s->hdlctx.bitbuf = s->hdlctx.numbits = 0; in hdlcdrv_setup()
651 s->hdlctx.ptt = 0; in hdlcdrv_setup()
652 s->hdlctx.slotcnt = s->ch_params.slottime; in hdlcdrv_setup()
653 s->hdlctx.calibrate = 0; in hdlcdrv_setup()