Lines Matching refs:bc
143 static inline void baycom_int_freq(struct baycom_state *bc) in baycom_int_freq() argument
150 bc->debug_vals.cur_intcnt++; in baycom_int_freq()
151 if (time_after_eq(cur_jiffies, bc->debug_vals.last_jiffies + HZ)) { in baycom_int_freq()
152 bc->debug_vals.last_jiffies = cur_jiffies; in baycom_int_freq()
153 bc->debug_vals.last_intcnt = bc->debug_vals.cur_intcnt; in baycom_int_freq()
154 bc->debug_vals.cur_intcnt = 0; in baycom_int_freq()
155 bc->debug_vals.last_pllcorr = bc->debug_vals.cur_pllcorr; in baycom_int_freq()
156 bc->debug_vals.cur_pllcorr = 0; in baycom_int_freq()
179 static inline void par96_tx(struct net_device *dev, struct baycom_state *bc) in par96_tx() argument
182 unsigned int data = hdlcdrv_getbits(&bc->hdrv); in par96_tx()
183 struct parport *pp = bc->pdev->port; in par96_tx()
187 bc->modem.par96.scram = ((bc->modem.par96.scram << 1) | in par96_tx()
188 (bc->modem.par96.scram & 1)); in par96_tx()
190 bc->modem.par96.scram ^= 1; in par96_tx()
191 if (bc->modem.par96.scram & (PAR96_SCRAM_TAP1 << 1)) in par96_tx()
192 bc->modem.par96.scram ^= in par96_tx()
194 if (bc->modem.par96.scram & (PAR96_SCRAM_TAP1 << 2)) in par96_tx()
203 static inline void par96_rx(struct net_device *dev, struct baycom_state *bc) in par96_rx() argument
207 struct parport *pp = bc->pdev->port; in par96_rx()
213 bc->modem.par96.descram = (bc->modem.par96.descram << 1); in par96_rx()
215 bc->modem.par96.descram |= 1; in par96_rx()
216 descx = bc->modem.par96.descram ^ in par96_rx()
217 (bc->modem.par96.descram >> 1); in par96_rx()
227 hdlcdrv_putbits(&bc->hdrv, data); in par96_rx()
231 if (bc->options & BAYCOM_OPTIONS_SOFTDCD) { in par96_rx()
232 bc->modem.par96.dcd_shreg = (bc->modem.par96.dcd_shreg >> 16) in par96_rx()
237 if ((bc->modem.par96.dcd_shreg & mask) == mask2) in par96_rx()
238 bc->modem.par96.dcd_count = HDLCDRV_MAXFLEN+4; in par96_rx()
242 if (((bc->modem.par96.dcd_shreg & mask) == mask2) && in par96_rx()
243 (bc->modem.par96.dcd_count >= 0)) in par96_rx()
244 bc->modem.par96.dcd_count -= HDLCDRV_MAXFLEN-10; in par96_rx()
246 if (bc->modem.par96.dcd_count >= 0) in par96_rx()
247 bc->modem.par96.dcd_count -= 2; in par96_rx()
248 hdlcdrv_setdcd(&bc->hdrv, bc->modem.par96.dcd_count > 0); in par96_rx()
250 hdlcdrv_setdcd(&bc->hdrv, !!(pp->ops->read_status(pp) & PAR96_DCD)); in par96_rx()
259 struct baycom_state *bc = netdev_priv(dev); in par96_interrupt() local
261 baycom_int_freq(bc); in par96_interrupt()
265 if (hdlcdrv_ptt(&bc->hdrv)) in par96_interrupt()
266 par96_tx(dev, bc); in par96_interrupt()
268 par96_rx(dev, bc); in par96_interrupt()
269 if (--bc->modem.arb_divider <= 0) { in par96_interrupt()
270 bc->modem.arb_divider = 6; in par96_interrupt()
272 hdlcdrv_arbitrate(dev, &bc->hdrv); in par96_interrupt()
276 hdlcdrv_transmitter(dev, &bc->hdrv); in par96_interrupt()
277 hdlcdrv_receiver(dev, &bc->hdrv); in par96_interrupt()
286 struct baycom_state *bc = netdev_priv(dev); in par96_wakeup() local
289 if (!parport_claim(bc->pdev)) in par96_wakeup()
297 struct baycom_state *bc = netdev_priv(dev); in par96_open() local
302 if (!dev || !bc) in par96_open()
319 memset(&bc->modem, 0, sizeof(bc->modem)); in par96_open()
320 bc->hdrv.par.bitrate = 9600; in par96_open()
335 bc->pdev = parport_register_dev_model(pp, dev->name, &par_cb, i); in par96_open()
337 if (!bc->pdev) { in par96_open()
341 if (parport_claim(bc->pdev)) { in par96_open()
343 parport_unregister_device(bc->pdev); in par96_open()
346 pp = bc->pdev->port; in par96_open()
349 bc->hdrv.par.bitrate = 9600; in par96_open()
353 bc_drvname, dev->base_addr, dev->irq, bc->options); in par96_open()
361 struct baycom_state *bc = netdev_priv(dev); in par96_close() local
364 if (!dev || !bc) in par96_close()
366 pp = bc->pdev->port; in par96_close()
371 parport_release(bc->pdev); in par96_close()
372 parport_unregister_device(bc->pdev); in par96_close()
398 static int baycom_setmode(struct baycom_state *bc, const char *modestr) in baycom_setmode() argument
401 bc->options = 0; in baycom_setmode()
403 bc->options = BAYCOM_OPTIONS_SOFTDCD; in baycom_setmode()
405 bc->options = !!strchr(modestr, '*'); in baycom_setmode()
414 struct baycom_state *bc; in baycom_ioctl() local
420 bc = netdev_priv(dev); in baycom_ioctl()
421 BUG_ON(bc->hdrv.magic != HDLCDRV_MAGIC); in baycom_ioctl()
430 strcpy(hi->data.modename, bc->options ? "par96" : "picpar"); in baycom_ioctl()
439 return baycom_setmode(bc, hi->data.modename); in baycom_ioctl()
460 bi.data.dbg.debug1 = bc->hdrv.ptt_keyed; in baycom_ioctl()
461 bi.data.dbg.debug2 = bc->debug_vals.last_intcnt; in baycom_ioctl()
462 bi.data.dbg.debug3 = bc->debug_vals.last_pllcorr; in baycom_ioctl()
525 struct baycom_state *bc; in init_baycompar() local
541 bc = netdev_priv(dev); in init_baycompar()
542 if (set_hw && baycom_setmode(bc, mode[i])) in init_baycompar()