Esempio n. 1
0
__initfunc(static void output_check(struct hfmodem_state *dev))
{
    enum uart u = c_uart_unknown;

    if (((u = check_uart(dev->ptt_out.seriobase))) != c_uart_unknown)
        printk(KERN_INFO "%s: PTT output: uart found at address 0x%x type %s\n",
               hfmodem_drvname, dev->ptt_out.seriobase, uart_str[u]);
    else {
        if (dev->ptt_out.seriobase > 0)
            printk(KERN_WARNING "%s: PTT output: no uart found at address 0x%x\n",
                   hfmodem_drvname, dev->ptt_out.seriobase);
        dev->ptt_out.seriobase = 0;
    }
    if (check_lpt(dev, dev->ptt_out.pariobase))
        printk(KERN_INFO "%s: PTT output: parallel port found at address 0x%x\n",
               hfmodem_drvname, dev->ptt_out.pariobase);
    else {
        if (dev->ptt_out.pariobase > 0)
            printk(KERN_WARNING "%s: PTT output: no parallel port found at address 0x%x\n",
                   hfmodem_drvname, dev->ptt_out.pariobase);
        dev->ptt_out.pariobase = 0;
        dev->ptt_out.pardev = NULL;
    }
    if (dev->ptt_out.midiiobase > 0 && dev->ptt_out.midiiobase <= 0x1000-MIDI_EXTENT &&
            check_midi(dev->ptt_out.midiiobase))
        printk(KERN_INFO "%s: PTT output: midi port found at address 0x%x\n",
               hfmodem_drvname, dev->ptt_out.midiiobase);
    else {
        if (dev->ptt_out.midiiobase > 0)
            printk(KERN_WARNING "%s: PTT output: no midi port found at address 0x%x\n",
                   hfmodem_drvname, dev->ptt_out.midiiobase);
        dev->ptt_out.midiiobase = 0;
    }
}
Esempio n. 2
0
static void sm_output_open(struct sm_state *sm, const char *ifname)
{
	enum uart u = c_uart_unknown;
	struct parport *pp = NULL;

	sm->hdrv.ptt_out.flags = 0;
	if (sm->hdrv.ptt_out.seriobase > 0 &&
	    sm->hdrv.ptt_out.seriobase <= 0x1000-SER_EXTENT &&
	    ((u = check_uart(sm->hdrv.ptt_out.seriobase))) != c_uart_unknown) {
		sm->hdrv.ptt_out.flags |= SP_SER;
		request_region(sm->hdrv.ptt_out.seriobase, SER_EXTENT, "sm ser ptt");
		outb(0, UART_IER(sm->hdrv.ptt_out.seriobase));
		/* 5 bits, 1 stop, no parity, no break, Div latch access */
		outb(0x80, UART_LCR(sm->hdrv.ptt_out.seriobase));
		outb(0, UART_DLM(sm->hdrv.ptt_out.seriobase));
		outb(1, UART_DLL(sm->hdrv.ptt_out.seriobase)); /* as fast as possible */
		/* LCR and MCR set by output_status */
	}
	sm->pardev = NULL;
	if (sm->hdrv.ptt_out.pariobase > 0) {
		pp = parport_enumerate();
		while (pp && pp->base != sm->hdrv.ptt_out.pariobase) 
			pp = pp->next;
		if (!pp)
			printk(KERN_WARNING "%s: parport at address 0x%x not found\n", sm_drvname, sm->hdrv.ptt_out.pariobase);
		else if ((~pp->modes) & (PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT))
			printk(KERN_WARNING "%s: parport at address 0x%x cannot be used\n", sm_drvname, sm->hdrv.ptt_out.pariobase);
		else {
			sm->pardev = parport_register_device(pp, ifname, NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
			if (!sm->pardev) {
				pp = NULL;
				printk(KERN_WARNING "%s: cannot register parport device (address 0x%x)\n", sm_drvname, sm->hdrv.ptt_out.pariobase);
			} else {
				if (parport_claim(sm->pardev)) {
					parport_unregister_device(sm->pardev);
					sm->pardev = NULL;
					printk(KERN_WARNING "%s: cannot claim parport at address 0x%x\n", sm_drvname, sm->hdrv.ptt_out.pariobase);
				} else
					sm->hdrv.ptt_out.flags |= SP_PAR;
			}
		}
	}
	if (sm->hdrv.ptt_out.midiiobase > 0 &&
	    sm->hdrv.ptt_out.midiiobase <= 0x1000-MIDI_EXTENT &&
	    check_midi(sm->hdrv.ptt_out.midiiobase)) {
		sm->hdrv.ptt_out.flags |= SP_MIDI;
		request_region(sm->hdrv.ptt_out.midiiobase, MIDI_EXTENT,
			       "sm midi ptt");
	}
	sm_output_status(sm);

	printk(KERN_INFO "%s: ptt output:", sm_drvname);
	if (sm->hdrv.ptt_out.flags & SP_SER)
		printk(" serial interface at 0x%x, uart %s", sm->hdrv.ptt_out.seriobase,
		       uart_str[u]);
	if (sm->hdrv.ptt_out.flags & SP_PAR)
		printk(" parallel interface at 0x%x", sm->hdrv.ptt_out.pariobase);
	if (sm->hdrv.ptt_out.flags & SP_MIDI)
		printk(" mpu401 (midi) interface at 0x%x", sm->hdrv.ptt_out.midiiobase);
	if (!sm->hdrv.ptt_out.flags)
		printk(" none");
	printk("\n");
}