1 /*****************************************************************************/
4 * baycom_ser_fdx.c -- baycom ser12 fullduplex radio modem driver.
6 * Copyright (C) 1997-1998 Thomas Sailer (sailer@ife.ee.ethz.ch)
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * Please note that the GPL allows you to use the driver, NOT the radio.
23 * In order to use the radio, you need a license from the communications
24 * authority of your country.
29 * ser12: This is a very simple 1200 baud AFSK modem. The modem consists only
30 * of a modulator/demodulator chip, usually a TI TCM3105. The computer
31 * is responsible for regenerating the receiver bit clock, as well as
32 * for handling the HDLC protocol. The modem connects to a serial port,
33 * hence the name. Since the serial port is not used as an async serial
34 * port, the kernel driver for serial ports cannot be used, and this
35 * driver only supports standard serial hardware (8250, 16450, 16550A)
37 * This modem usually draws its supply current out of the otherwise unused
38 * TXD pin of the serial port. Thus a contignuous stream of 0x00-bytes
39 * is transmitted to achieve a positive supply voltage.
41 * hsk: This is a 4800 baud FSK modem, designed for TNC use. It works fine
42 * in 'baycom-mode' :-) In contrast to the TCM3105 modem, power is
43 * externally supplied. So there's no need to provide the 0x00-byte-stream
44 * when receiving or idle, which drastically reduces interrupt load.
46 * Command line options (insmod command line)
48 * mode * enables software DCD.
49 * iobase base address of the port; common values are 0x3f8, 0x2f8, 0x3e8, 0x2e8
50 * baud baud rate (between 300 and 4800)
51 * irq interrupt line of the port; common values are 4,3
55 * 0.1 26.06.96 Adapted from baycom.c and made network driver interface
56 * 18.10.96 Changed to new user space access routines (copy_{to,from}_user)
57 * 0.3 26.04.97 init code/data tagged
58 * 0.4 08.07.97 alternative ser12 decoding algorithm (uses delta CTS ints)
59 * 0.5 11.11.97 ser12/par96 split into separate files
60 * 0.6 24.01.98 Thorsten Kranzkowski, dl8bcu and Thomas Sailer:
61 * reduced interrupt load in transmit case
65 /*****************************************************************************/
67 #include <linux/module.h>
68 #include <linux/kernel.h>
69 #include <linux/sched.h>
70 #include <linux/types.h>
71 #include <linux/fcntl.h>
72 #include <linux/interrupt.h>
73 #include <linux/ioport.h>
75 #include <linux/string.h>
76 #include <linux/init.h>
77 #include <linux/bitops.h>
78 #include <asm/uaccess.h>
79 #include <asm/system.h>
81 #include <linux/delay.h>
82 #include <linux/errno.h>
83 #include <linux/netdevice.h>
84 #include <linux/hdlcdrv.h>
85 #include <linux/baycom.h>
86 #include <linux/version.h>
88 /* --------------------------------------------------------------------- */
93 * modem options; bit mask
95 #define BAYCOM_OPTIONS_SOFTDCD 1
97 /* --------------------------------------------------------------------- */
99 static const char bc_drvname
[] = "baycom_ser_fdx";
100 static const char bc_drvinfo
[] = KERN_INFO
"baycom_ser_fdx: (C) 1997-1998 Thomas Sailer, HB9JNX/AE4WA\n"
101 KERN_INFO
"baycom_ser_fdx: version 0.6 compiled " __TIME__
" " __DATE__
"\n";
103 /* --------------------------------------------------------------------- */
107 static struct device baycom_device
[NR_PORTS
];
111 int iobase
, irq
, baud
;
112 } baycom_ports
[NR_PORTS
] = { { NULL
, 0, 0 }, };
114 /* --------------------------------------------------------------------- */
116 #define RBR(iobase) (iobase+0)
117 #define THR(iobase) (iobase+0)
118 #define IER(iobase) (iobase+1)
119 #define IIR(iobase) (iobase+2)
120 #define FCR(iobase) (iobase+2)
121 #define LCR(iobase) (iobase+3)
122 #define MCR(iobase) (iobase+4)
123 #define LSR(iobase) (iobase+5)
124 #define MSR(iobase) (iobase+6)
125 #define SCR(iobase) (iobase+7)
126 #define DLL(iobase) (iobase+0)
127 #define DLM(iobase) (iobase+1)
129 #define SER12_EXTENT 8
131 /* ---------------------------------------------------------------------- */
133 * Information that need to be kept for each board.
136 struct baycom_state
{
137 struct hdlcdrv_state hdrv
;
139 unsigned int baud
, baud_us
, baud_arbdiv
, baud_uartdiv
, baud_dcdtimeout
;
140 unsigned int options
;
146 struct modem_state_ser12
{
147 unsigned char tx_bit
;
148 unsigned char last_rxbit
;
149 int dcd_sum0
, dcd_sum1
, dcd_sum2
;
151 unsigned int pll_time
;
152 unsigned int txshreg
;
158 unsigned long last_jiffies
;
160 unsigned last_intcnt
;
164 #endif /* BAYCOM_DEBUG */
167 /* --------------------------------------------------------------------- */
169 #define min(a, b) (((a) < (b)) ? (a) : (b))
170 #define max(a, b) (((a) > (b)) ? (a) : (b))
172 /* --------------------------------------------------------------------- */
174 static void inline baycom_int_freq(struct baycom_state
*bc
)
177 unsigned long cur_jiffies
= jiffies
;
179 * measure the interrupt frequency
181 bc
->debug_vals
.cur_intcnt
++;
182 if ((cur_jiffies
- bc
->debug_vals
.last_jiffies
) >= HZ
) {
183 bc
->debug_vals
.last_jiffies
= cur_jiffies
;
184 bc
->debug_vals
.last_intcnt
= bc
->debug_vals
.cur_intcnt
;
185 bc
->debug_vals
.cur_intcnt
= 0;
186 bc
->debug_vals
.last_pllcorr
= bc
->debug_vals
.cur_pllcorr
;
187 bc
->debug_vals
.cur_pllcorr
= 0;
189 #endif /* BAYCOM_DEBUG */
192 /* --------------------------------------------------------------------- */
194 * ===================== SER12 specific routines =========================
197 /* --------------------------------------------------------------------- */
199 static inline void ser12_set_divisor(struct device
*dev
,
200 unsigned int divisor
)
202 outb(0x81, LCR(dev
->base_addr
)); /* DLAB = 1 */
203 outb(divisor
, DLL(dev
->base_addr
));
204 outb(divisor
>> 8, DLM(dev
->base_addr
));
205 outb(0x01, LCR(dev
->base_addr
)); /* word length = 6 */
207 * make sure the next interrupt is generated;
208 * 0 must be used to power the modem; the modem draws its
209 * power from the TxD line
211 outb(0x00, THR(dev
->base_addr
));
213 * it is important not to set the divider while transmitting;
214 * this reportedly makes some UARTs generating interrupts
215 * in the hundredthousands per second region
216 * Reported by: Ignacio.Arenaza@studi.epfl.ch (Ignacio Arenaza Nuno)
220 /* --------------------------------------------------------------------- */
223 extern inline unsigned int hweight16(unsigned int w
)
224 __attribute__ ((unused
));
225 extern inline unsigned int hweight8(unsigned int w
)
226 __attribute__ ((unused
));
228 extern inline unsigned int hweight16(unsigned int w
)
230 unsigned short res
= (w
& 0x5555) + ((w
>> 1) & 0x5555);
231 res
= (res
& 0x3333) + ((res
>> 2) & 0x3333);
232 res
= (res
& 0x0F0F) + ((res
>> 4) & 0x0F0F);
233 return (res
& 0x00FF) + ((res
>> 8) & 0x00FF);
236 extern inline unsigned int hweight8(unsigned int w
)
238 unsigned short res
= (w
& 0x55) + ((w
>> 1) & 0x55);
239 res
= (res
& 0x33) + ((res
>> 2) & 0x33);
240 return (res
& 0x0F) + ((res
>> 4) & 0x0F);
244 /* --------------------------------------------------------------------- */
246 static __inline__
void ser12_rx(struct device
*dev
, struct baycom_state
*bc
, struct timeval
*tv
, unsigned char curs
)
249 int bdus8
= bc
->baud_us
>> 3;
250 int bdus4
= bc
->baud_us
>> 2;
251 int bdus2
= bc
->baud_us
>> 1;
253 timediff
= 1000000 + tv
->tv_usec
- bc
->modem
.ser12
.pll_time
;
254 while (timediff
>= 500000)
256 while (timediff
>= bdus2
) {
257 timediff
-= bc
->baud_us
;
258 bc
->modem
.ser12
.pll_time
+= bc
->baud_us
;
259 bc
->modem
.ser12
.dcd_time
--;
260 /* first check if there is room to add a bit */
261 if (bc
->modem
.shreg
& 1) {
262 hdlcdrv_putbits(&bc
->hdrv
, (bc
->modem
.shreg
>> 1) ^ 0xffff);
263 bc
->modem
.shreg
= 0x10000;
266 bc
->modem
.shreg
>>= 1;
268 if (bc
->modem
.ser12
.dcd_time
<= 0) {
269 if (bc
->options
& BAYCOM_OPTIONS_SOFTDCD
)
270 hdlcdrv_setdcd(&bc
->hdrv
, (bc
->modem
.ser12
.dcd_sum0
+
271 bc
->modem
.ser12
.dcd_sum1
+
272 bc
->modem
.ser12
.dcd_sum2
) < 0);
273 bc
->modem
.ser12
.dcd_sum2
= bc
->modem
.ser12
.dcd_sum1
;
274 bc
->modem
.ser12
.dcd_sum1
= bc
->modem
.ser12
.dcd_sum0
;
275 bc
->modem
.ser12
.dcd_sum0
= 2; /* slight bias */
276 bc
->modem
.ser12
.dcd_time
+= 120;
278 if (bc
->modem
.ser12
.last_rxbit
!= curs
) {
279 bc
->modem
.ser12
.last_rxbit
= curs
;
280 bc
->modem
.shreg
|= 0x10000;
283 bc
->modem
.ser12
.pll_time
+= bdus8
;
285 bc
->modem
.ser12
.pll_time
+= 1000000 - bdus8
;
287 if (abs(timediff
) > bdus4
)
288 bc
->modem
.ser12
.dcd_sum0
+= 4;
290 bc
->modem
.ser12
.dcd_sum0
--;
292 bc
->debug_vals
.cur_pllcorr
= timediff
;
293 #endif /* BAYCOM_DEBUG */
295 while (bc
->modem
.ser12
.pll_time
>= 1000000)
296 bc
->modem
.ser12
.pll_time
-= 1000000;
299 /* --------------------------------------------------------------------- */
301 static void ser12_interrupt(int irq
, void *dev_id
, struct pt_regs
*regs
)
303 struct device
*dev
= (struct device
*)dev_id
;
304 struct baycom_state
*bc
= (struct baycom_state
*)dev
->priv
;
306 unsigned char iir
, msr
;
307 unsigned int txcount
= 0;
309 if (!bc
|| bc
->hdrv
.magic
!= HDLCDRV_MAGIC
)
311 /* fast way out for shared irq */
312 if ((iir
= inb(IIR(dev
->base_addr
))) & 1)
314 /* get current time */
315 do_gettimeofday(&tv
);
316 msr
= inb(MSR(dev
->base_addr
));
318 if ((msr
& 8) && !(bc
->options
& BAYCOM_OPTIONS_SOFTDCD
))
319 hdlcdrv_setdcd(&bc
->hdrv
, !(msr
& 0x80));
323 inb(LSR(dev
->base_addr
));
327 inb(RBR(dev
->base_addr
));
332 * make sure the next interrupt is generated;
333 * 0 must be used to power the modem; the modem draws its
334 * power from the TxD line
336 outb(0x00, THR(dev
->base_addr
));
340 * first output the last bit (!) then call HDLC transmitter,
341 * since this may take quite long
344 outb(0x0e | (!!bc
->modem
.ser12
.tx_bit
), MCR(dev
->base_addr
));
346 outb(0x0d, MCR(dev
->base_addr
)); /* transmitter off */
350 msr
= inb(MSR(dev
->base_addr
));
352 if ((msr
& 8) && !(bc
->options
& BAYCOM_OPTIONS_SOFTDCD
))
353 hdlcdrv_setdcd(&bc
->hdrv
, !(msr
& 0x80));
356 iir
= inb(IIR(dev
->base_addr
));
357 } while (!(iir
& 1));
358 ser12_rx(dev
, bc
, &tv
, msr
& 0x10); /* CTS */
359 if (bc
->modem
.ptt
&& txcount
) {
360 if (bc
->modem
.ser12
.txshreg
<= 1) {
361 bc
->modem
.ser12
.txshreg
= 0x10000 | hdlcdrv_getbits(&bc
->hdrv
);
362 if (!hdlcdrv_ptt(&bc
->hdrv
)) {
363 ser12_set_divisor(dev
, 115200/100/8);
368 bc
->modem
.ser12
.tx_bit
= !(bc
->modem
.ser12
.tx_bit
^ (bc
->modem
.ser12
.txshreg
& 1));
369 bc
->modem
.ser12
.txshreg
>>= 1;
373 if (!bc
->modem
.ptt
&& txcount
) {
374 hdlcdrv_arbitrate(dev
, &bc
->hdrv
);
375 if (hdlcdrv_ptt(&bc
->hdrv
)) {
376 ser12_set_divisor(dev
, bc
->baud_uartdiv
);
377 bc
->modem
.ser12
.txshreg
= 1;
381 hdlcdrv_transmitter(dev
, &bc
->hdrv
);
382 hdlcdrv_receiver(dev
, &bc
->hdrv
);
386 /* --------------------------------------------------------------------- */
388 enum uart
{ c_uart_unknown
, c_uart_8250
,
389 c_uart_16450
, c_uart_16550
, c_uart_16550A
};
390 static const char *uart_str
[] = {
391 "unknown", "8250", "16450", "16550", "16550A"
394 static enum uart
ser12_check_uart(unsigned int iobase
)
396 unsigned char b1
,b2
,b3
;
398 enum uart uart_tab
[] =
399 { c_uart_16450
, c_uart_unknown
, c_uart_16550
, c_uart_16550A
};
401 b1
= inb(MCR(iobase
));
402 outb(b1
| 0x10, MCR(iobase
)); /* loopback mode */
403 b2
= inb(MSR(iobase
));
404 outb(0x1a, MCR(iobase
));
405 b3
= inb(MSR(iobase
)) & 0xf0;
406 outb(b1
, MCR(iobase
)); /* restore old values */
407 outb(b2
, MSR(iobase
));
409 return c_uart_unknown
;
412 outb(0x01, FCR(iobase
)); /* enable FIFOs */
413 u
= uart_tab
[(inb(IIR(iobase
)) >> 6) & 3];
414 if (u
== c_uart_16450
) {
415 outb(0x5a, SCR(iobase
));
416 b1
= inb(SCR(iobase
));
417 outb(0xa5, SCR(iobase
));
418 b2
= inb(SCR(iobase
));
419 if ((b1
!= 0x5a) || (b2
!= 0xa5))
425 /* --------------------------------------------------------------------- */
427 static int ser12_open(struct device
*dev
)
429 struct baycom_state
*bc
= (struct baycom_state
*)dev
->priv
;
434 if (!dev
->base_addr
|| dev
->base_addr
> 0x1000-SER12_EXTENT
||
435 dev
->irq
< 2 || dev
->irq
> 15)
437 if (bc
->baud
< 300 || bc
->baud
> 4800)
439 if (check_region(dev
->base_addr
, SER12_EXTENT
))
441 memset(&bc
->modem
, 0, sizeof(bc
->modem
));
442 bc
->hdrv
.par
.bitrate
= bc
->baud
;
443 bc
->baud_us
= 1000000/bc
->baud
;
444 bc
->baud_uartdiv
= (115200/8)/bc
->baud
;
445 if ((u
= ser12_check_uart(dev
->base_addr
)) == c_uart_unknown
)
447 outb(0, FCR(dev
->base_addr
)); /* disable FIFOs */
448 outb(0x0d, MCR(dev
->base_addr
));
449 outb(0, IER(dev
->base_addr
));
450 if (request_irq(dev
->irq
, ser12_interrupt
, SA_INTERRUPT
| SA_SHIRQ
,
451 "baycom_ser_fdx", dev
))
453 request_region(dev
->base_addr
, SER12_EXTENT
, "baycom_ser_fdx");
455 * set the SIO to 6 Bits/character; during receive,
456 * the baud rate is set to produce 100 ints/sec
457 * to feed the channel arbitration process,
458 * during transmit to baud ints/sec to run
461 ser12_set_divisor(dev
, 115200/100/8);
463 * enable transmitter empty interrupt and modem status interrupt
465 outb(0x0a, IER(dev
->base_addr
));
467 * make sure the next interrupt is generated;
468 * 0 must be used to power the modem; the modem draws its
469 * power from the TxD line
471 outb(0x00, THR(dev
->base_addr
));
472 hdlcdrv_setdcd(&bc
->hdrv
, 0);
473 printk(KERN_INFO
"%s: ser_fdx at iobase 0x%lx irq %u options "
474 "0x%x baud %u uart %s\n", bc_drvname
, dev
->base_addr
, dev
->irq
,
475 bc
->options
, bc
->baud
, uart_str
[u
]);
480 /* --------------------------------------------------------------------- */
482 static int ser12_close(struct device
*dev
)
484 struct baycom_state
*bc
= (struct baycom_state
*)dev
->priv
;
491 outb(0, IER(dev
->base_addr
));
492 outb(1, MCR(dev
->base_addr
));
493 free_irq(dev
->irq
, dev
);
494 release_region(dev
->base_addr
, SER12_EXTENT
);
495 printk(KERN_INFO
"%s: close ser_fdx at iobase 0x%lx irq %u\n",
496 bc_drvname
, dev
->base_addr
, dev
->irq
);
501 /* --------------------------------------------------------------------- */
503 * ===================== hdlcdrv driver interface =========================
506 /* --------------------------------------------------------------------- */
508 static int baycom_ioctl(struct device
*dev
, struct ifreq
*ifr
,
509 struct hdlcdrv_ioctl
*hi
, int cmd
);
511 /* --------------------------------------------------------------------- */
513 static struct hdlcdrv_ops ser12_ops
= {
521 /* --------------------------------------------------------------------- */
523 static int baycom_setmode(struct baycom_state
*bc
, const char *modestr
)
527 if (!strncmp(modestr
, "ser", 3)) {
528 baud
= simple_strtoul(modestr
+3, NULL
, 10);
529 if (baud
>= 3 && baud
<= 48)
532 bc
->options
= !!strchr(modestr
, '*');
536 /* --------------------------------------------------------------------- */
538 static int baycom_ioctl(struct device
*dev
, struct ifreq
*ifr
,
539 struct hdlcdrv_ioctl
*hi
, int cmd
)
541 struct baycom_state
*bc
;
542 struct baycom_ioctl bi
;
545 if (!dev
|| !dev
->priv
||
546 ((struct baycom_state
*)dev
->priv
)->hdrv
.magic
!= HDLCDRV_MAGIC
) {
547 printk(KERN_ERR
"bc_ioctl: invalid device struct\n");
550 bc
= (struct baycom_state
*)dev
->priv
;
552 if (cmd
!= SIOCDEVPRIVATE
)
554 if (get_user(cmd2
, (int *)ifr
->ifr_data
))
560 case HDLCDRVCTL_GETMODE
:
561 sprintf(hi
->data
.modename
, "ser%u", bc
->baud
/ 100);
563 strcat(hi
->data
.modename
, "*");
564 if (copy_to_user(ifr
->ifr_data
, hi
, sizeof(struct hdlcdrv_ioctl
)))
568 case HDLCDRVCTL_SETMODE
:
569 if (dev
->start
|| !suser())
571 hi
->data
.modename
[sizeof(hi
->data
.modename
)-1] = '\0';
572 return baycom_setmode(bc
, hi
->data
.modename
);
574 case HDLCDRVCTL_MODELIST
:
575 strcpy(hi
->data
.modename
, "ser12,ser3,ser24");
576 if (copy_to_user(ifr
->ifr_data
, hi
, sizeof(struct hdlcdrv_ioctl
)))
580 case HDLCDRVCTL_MODEMPARMASK
:
581 return HDLCDRV_PARMASK_IOBASE
| HDLCDRV_PARMASK_IRQ
;
585 if (copy_from_user(&bi
, ifr
->ifr_data
, sizeof(bi
)))
592 case BAYCOMCTL_GETDEBUG
:
593 bi
.data
.dbg
.debug1
= bc
->hdrv
.ptt_keyed
;
594 bi
.data
.dbg
.debug2
= bc
->debug_vals
.last_intcnt
;
595 bi
.data
.dbg
.debug3
= bc
->debug_vals
.last_pllcorr
;
597 #endif /* BAYCOM_DEBUG */
600 if (copy_to_user(ifr
->ifr_data
, &bi
, sizeof(bi
)))
606 /* --------------------------------------------------------------------- */
608 int __init
baycom_ser_fdx_init(void)
612 struct baycom_state
*bc
;
613 char ifname
[HDLCDRV_IFNAMELEN
];
618 * register net devices
620 for (i
= 0; i
< NR_PORTS
; i
++) {
621 struct device
*dev
= baycom_device
+i
;
622 sprintf(ifname
, "bcsf%d", i
);
624 if (!baycom_ports
[i
].mode
)
627 baycom_ports
[i
].iobase
= baycom_ports
[i
].irq
= 0;
628 j
= hdlcdrv_register_hdlcdrv(dev
, &ser12_ops
,
629 sizeof(struct baycom_state
),
630 ifname
, baycom_ports
[i
].iobase
,
631 baycom_ports
[i
].irq
, 0);
633 bc
= (struct baycom_state
*)dev
->priv
;
634 if (set_hw
&& baycom_setmode(bc
, baycom_ports
[i
].mode
))
636 bc
->baud
= baycom_ports
[i
].baud
;
639 printk(KERN_WARNING
"%s: cannot register net device\n",
648 /* --------------------------------------------------------------------- */
653 * command line settable parameters
655 static char *mode
[NR_PORTS
] = { "ser12*", };
656 static int iobase
[NR_PORTS
] = { 0x3f8, };
657 static int irq
[NR_PORTS
] = { 4, };
658 static int baud
[NR_PORTS
] = { [0 ... NR_PORTS
-1] = 1200 };
660 #if LINUX_VERSION_CODE >= 0x20115
662 MODULE_PARM(mode
, "1-" __MODULE_STRING(NR_PORTS
) "s");
663 MODULE_PARM_DESC(mode
, "baycom operating mode; * for software DCD");
664 MODULE_PARM(iobase
, "1-" __MODULE_STRING(NR_PORTS
) "i");
665 MODULE_PARM_DESC(iobase
, "baycom io base address");
666 MODULE_PARM(irq
, "1-" __MODULE_STRING(NR_PORTS
) "i");
667 MODULE_PARM_DESC(irq
, "baycom irq number");
668 MODULE_PARM(baud
, "1-" __MODULE_STRING(NR_PORTS
) "i");
669 MODULE_PARM_DESC(baud
, "baycom baud rate (300 to 4800)");
671 MODULE_AUTHOR("Thomas M. Sailer, sailer@ife.ee.ethz.ch, hb9jnx@hb9w.che.eu");
672 MODULE_DESCRIPTION("Baycom ser12 full duplex amateur radio modem driver");
676 int __init
init_module(void)
680 for (i
= 0; (i
< NR_PORTS
) && (mode
[i
]); i
++) {
681 baycom_ports
[i
].mode
= mode
[i
];
682 baycom_ports
[i
].iobase
= iobase
[i
];
683 baycom_ports
[i
].irq
= irq
[i
];
684 baycom_ports
[i
].baud
= baud
[i
];
687 baycom_ports
[i
+1].mode
= NULL
;
688 return baycom_ser_fdx_init();
691 /* --------------------------------------------------------------------- */
693 void cleanup_module(void)
697 for(i
= 0; i
< NR_PORTS
; i
++) {
698 struct device
*dev
= baycom_device
+i
;
699 struct baycom_state
*bc
= (struct baycom_state
*)dev
->priv
;
702 if (bc
->hdrv
.magic
!= HDLCDRV_MAGIC
)
703 printk(KERN_ERR
"baycom: invalid magic in "
706 hdlcdrv_unregister_hdlcdrv(dev
);
712 /* --------------------------------------------------------------------- */
714 * format: baycom_ser_fdx=io,irq,mode
716 * * indicates sofware DCD
719 void __init
baycom_ser_fdx_setup(char *str
, int *ints
)
723 for (i
= 0; (i
< NR_PORTS
) && (baycom_ports
[i
].mode
); i
++);
724 if ((i
>= NR_PORTS
) || (ints
[0] < 2)) {
725 printk(KERN_INFO
"%s: too many or invalid interface "
726 "specifications\n", bc_drvname
);
729 baycom_ports
[i
].mode
= str
;
730 baycom_ports
[i
].iobase
= ints
[1];
731 baycom_ports
[i
].irq
= ints
[2];
733 baycom_ports
[i
].baud
= ints
[3];
735 baycom_ports
[i
].baud
= 1200;
737 baycom_ports
[i
+1].mode
= NULL
;
741 /* --------------------------------------------------------------------- */