Lines Matching refs:bc
160 static void __inline__ baycom_int_freq(struct baycom_state *bc)
167 bc->debug_vals.cur_intcnt++;
168 if (time_after_eq(cur_jiffies, bc->debug_vals.last_jiffies + HZ)) {
169 bc->debug_vals.last_jiffies = cur_jiffies;
170 bc->debug_vals.last_intcnt = bc->debug_vals.cur_intcnt;
171 bc->debug_vals.cur_intcnt = 0;
172 bc->debug_vals.last_pllcorr = bc->debug_vals.cur_pllcorr;
173 bc->debug_vals.cur_pllcorr = 0;
196 static __inline__ void par96_tx(struct net_device *dev, struct baycom_state *bc)
199 unsigned int data = hdlcdrv_getbits(&bc->hdrv);
200 struct parport *pp = bc->pdev->port;
204 bc->modem.par96.scram = ((bc->modem.par96.scram << 1) |
205 (bc->modem.par96.scram & 1));
207 bc->modem.par96.scram ^= 1;
208 if (bc->modem.par96.scram & (PAR96_SCRAM_TAP1 << 1))
209 bc->modem.par96.scram ^=
211 if (bc->modem.par96.scram & (PAR96_SCRAM_TAP1 << 2))
220 static __inline__ void par96_rx(struct net_device *dev, struct baycom_state *bc)
224 struct parport *pp = bc->pdev->port;
230 bc->modem.par96.descram = (bc->modem.par96.descram << 1);
232 bc->modem.par96.descram |= 1;
233 descx = bc->modem.par96.descram ^
234 (bc->modem.par96.descram >> 1);
244 hdlcdrv_putbits(&bc->hdrv, data);
248 if (bc->options & BAYCOM_OPTIONS_SOFTDCD) {
249 bc->modem.par96.dcd_shreg = (bc->modem.par96.dcd_shreg >> 16)
254 if ((bc->modem.par96.dcd_shreg & mask) == mask2)
255 bc->modem.par96.dcd_count = HDLCDRV_MAXFLEN+4;
259 if (((bc->modem.par96.dcd_shreg & mask) == mask2) &&
260 (bc->modem.par96.dcd_count >= 0))
261 bc->modem.par96.dcd_count -= HDLCDRV_MAXFLEN-10;
263 if (bc->modem.par96.dcd_count >= 0)
264 bc->modem.par96.dcd_count -= 2;
265 hdlcdrv_setdcd(&bc->hdrv, bc->modem.par96.dcd_count > 0);
267 hdlcdrv_setdcd(&bc->hdrv, !!(pp->ops->read_status(pp) & PAR96_DCD));
276 struct baycom_state *bc = netdev_priv(dev);
278 baycom_int_freq(bc);
282 if (hdlcdrv_ptt(&bc->hdrv))
283 par96_tx(dev, bc);
285 par96_rx(dev, bc);
286 if (--bc->modem.arb_divider <= 0) {
287 bc->modem.arb_divider = 6;
289 hdlcdrv_arbitrate(dev, &bc->hdrv);
293 hdlcdrv_transmitter(dev, &bc->hdrv);
294 hdlcdrv_receiver(dev, &bc->hdrv);
303 struct baycom_state *bc = netdev_priv(dev);
306 if (!parport_claim(bc->pdev))
314 struct baycom_state *bc = netdev_priv(dev);
317 if (!dev || !bc)
334 memset(&bc->modem, 0, sizeof(bc->modem));
335 bc->hdrv.par.bitrate = 9600;
336 bc->pdev = parport_register_device(pp, dev->name, NULL, par96_wakeup,
339 if (!bc->pdev) {
343 if (parport_claim(bc->pdev)) {
345 parport_unregister_device(bc->pdev);
348 pp = bc->pdev->port;
351 bc->hdrv.par.bitrate = 9600;
355 bc_drvname, dev->base_addr, dev->irq, bc->options);
363 struct baycom_state *bc = netdev_priv(dev);
366 if (!dev || !bc)
368 pp = bc->pdev->port;
373 parport_release(bc->pdev);
374 parport_unregister_device(bc->pdev);
400 static int baycom_setmode(struct baycom_state *bc, const char *modestr)
403 bc->options = 0;
405 bc->options = BAYCOM_OPTIONS_SOFTDCD;
407 bc->options = !!strchr(modestr, '*');
416 struct baycom_state *bc;
422 bc = netdev_priv(dev);
423 BUG_ON(bc->hdrv.magic != HDLCDRV_MAGIC);
432 strcpy(hi->data.modename, bc->options ? "par96" : "picpar");
441 return baycom_setmode(bc, hi->data.modename);
462 bi.data.dbg.debug1 = bc->hdrv.ptt_keyed;
463 bi.data.dbg.debug2 = bc->debug_vals.last_intcnt;
464 bi.data.dbg.debug3 = bc->debug_vals.last_pllcorr;
505 struct baycom_state *bc;
521 bc = netdev_priv(dev);
522 if (set_hw && baycom_setmode(bc, mode[i]))