示例#1
0
myAudioStream::myAudioStream(QString payload)
{
    if (!initialized) {
        ortp_set_log_level_mask(ORTP_DEBUG|ORTP_ERROR);
        ms_init();
        ortp_init();
        initialized = true;
    }

    if (!init_card()) {
        return;
    }
    if (!init_stream()) {
        return;
    }
    if (!init_filters(payload)) {
        return;
    }
    if (!link_filters()) {
        return;
    }
    if (!start_ticker()) {
        return;
    }
}
void read_from(enum eyefi_file __file)
{
	int tries = 0;
	int ret;
	int fd;
	char *file = eyefi_file(__file);
	int nr_fresh;

	init_card();

retry:
	fd = open(file, O_RDONLY);
	if (fd < 0)
		open_error(file, fd);
	fd_flush(fd);
	// fd_flush() does not appear to be working 100% of the
	// time.  It is not working on my Thinkpad, but works
	// fine on the same kernel on the Ideapad.  Bizarre.
	// This at least works around it by detecting when we
	// did and did not actually bring in pages from the
	// disk.
	nr_fresh = nr_fresh_pages(fd, EYEFI_BUF_SIZE);
	if (!nr_fresh) {
		tries++;
		debug_printf(2, "fd_flush(%d) was unsuccessful(%d), retrying (%d)...\n",
				fd, nr_fresh, tries);
		close(fd);
		goto retry;
	}
	ret = read(fd, eyefi_buf, EYEFI_BUF_SIZE);
	if ((eyefi_debug_level >= 3) ||
	    (eyefi_debug_level >= 2 && (__file == RSPM))) {
		printf("%s:", eyefi_file_name(__file));
		dumpbuf(eyefi_buf, 128);
	}
	if (ret < 0) {
		close(fd);
		perror("bad read, retrying...");
		goto retry;
		exit(1);
	}
	debug_printf(4, "read '%s': bytes: %d\n", file, ret);
	/*
	 * There was a time when I was carefully recording how each response
	 * looked, and I counted the zeros in each response.  I don't care
	 * any more.
	u8 c;
	int zeros = 0;
	int i;
	for (i=0; i < EYEFI_BUF_SIZE; i++) {
		c = ((char *)eyefi_buf)[i];
		if (c == '\0') {
			zeros++;
			continue;
		}
	}
	*/
	free(file);
	close(fd);
}
示例#3
0
int main() {

    SystemInit();
    SER_Init() ;
#if !defined(NO_FILESYSTEM)
    init_card () ;                                    /* initializing SD card */
#endif

    init_time() ;


#if defined(DEBUG_CYASSL)
    printf("Turning ON Debug message\n") ;
    CyaSSL_Debugging_ON() ;
#endif

#ifdef   HAVE_KEIL_RTX
    os_sys_init (main_task) ;
#else
    main_task() ;
#endif

    return 0 ; /* There should be no return here */

}
示例#4
0
文件: cards.c 项目: dblack/ccards
Card *create_card(char *rank, char *suit)
{
    Card *cp;
    init_card(&cp);
    set_rank(cp, rank);
    set_suit(cp, suit);
    return cp;
}
示例#5
0
void main(void)
    {
    char *fname = "NAMECARD.DAT";
    char name[NAME_SIZE];
    int i;
    card *t;
    init_card();
    while ((i = select_menu()) != 8)
        {
        switch (i)
            {
            case 1 : input_card();
                     break;
            case 2 : printf("\n    Input name to delete -> ");
                     gets(name);
                     if (!delete_card(name))
                         printf("\n        Can't find that name.");
                     break;
            case 3 : printf("\n    Input name to search -> ");
                     gets(name);
                     t = search_card(name);
                     if (t == NULL)
                         {
                         printf("\n        Can't find that name.");
                         break;
                         }
                     print_header(stdout);
                     print_card(t, stdout);
                     break;
            case 4 : load_cards(fname);
                     break;
            case 5 : save_cards(fname);
                     break;
            case 6 : t = head->next;
                     print_header(stdout);
                     while (t != tail)
                         {
                         print_card(t, stdout);
                         t = t->next;
                         }
                     break;
            case 7 : t = head->next;
                     print_header(stdprn);
                     while (t != tail)
                         {
                         print_card(t, stdprn);
                         t = t->next;
                         }
                     break;
            }
        }
    printf("\n\nProgram ends...");
    }
示例#6
0
/*----------------------------------------------------------------------------
 *        Main: 
 *---------------------------------------------------------------------------*/
int main (void) {
  char *sp,*cp,*next;
  U32 i;

  SystemInit();                               /* initialize clocks           */
  init_display();                             /* initialize the display      */
  SER_init (0);                               /* initialize serial interface */

  printf (intro);                             /* display example info        */
  printf (help);

  init_card ();
  while (1) {
    printf ("\nCmd> ");                       /* display prompt              */
    fflush (stdout);
                                              /* get command line input      */
    if (getline (in_line, sizeof (in_line)) == __FALSE) {
      continue;
    }

    sp = get_entry (&in_line[0], &next);
    if (*sp == 0) {
      continue;
    }
    for (cp = sp; *cp && *cp != ' '; cp++) {
      *cp = toupper (*cp);                    /* command to upper-case       */
    }
    for (i = 0; i < CMD_COUNT; i++) {
      if (strcmp (sp, (const char *)&cmd[i].val)) {
        continue;
      }
      init_card();                            /* check if card is removed    */
      cmd[i].func (next);                     /* execute command function    */
      break;
    }
    if (i == CMD_COUNT) {
      printf ("\nCommand error\n");
    }
  }
}
示例#7
0
文件: config.c 项目: asmalldev/linux
static int hisax_cs_setup(int cardnr, struct IsdnCard *card,
			  struct IsdnCardState *cs)
{
	int ret;

	if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) {
		printk(KERN_WARNING "HiSax: No memory for isac rcvbuf\n");
		ll_unload(cs);
		goto outf_cs;
	}
	cs->rcvidx = 0;
	cs->tx_skb = NULL;
	cs->tx_cnt = 0;
	cs->event = 0;

	skb_queue_head_init(&cs->rq);
	skb_queue_head_init(&cs->sq);

	init_bcstate(cs, 0);
	init_bcstate(cs, 1);

	/* init_card only handles interrupts which are not */
	/* used here for the loadable driver */
	switch (card->typ) {
	case ISDN_CTYPE_DYNAMIC:
		ret = 0;
		break;
	default:
		ret = init_card(cs);
		break;
	}
	if (ret) {
		closecard(cardnr);
		goto outf_cs;
	}
	init_tei(cs, cs->protocol);
	ret = CallcNewChan(cs);
	if (ret) {
		closecard(cardnr);
		goto outf_cs;
	}
	/* ISAR needs firmware download first */
	if (!test_bit(HW_ISAR, &cs->HW_Flags))
		ll_run(cs, 0);

	return 1;

outf_cs:
	kfree(cs);
	card->cs = NULL;
	return 0;
}
void write_to(enum eyefi_file __file, void *stuff, int len)
{
	int ret;
	int wrote;
	int fd;
	char *file;

	if (fake_write)
		return;

	init_card();
	file = eyefi_file(__file);
	if (len == -1)
		len = strlen(stuff);

	memset(eyefi_buf, 0, EYEFI_BUF_SIZE);
	memcpy(eyefi_buf, stuff, len);
	fd = open(file, O_RDWR|O_CREAT, 0600);
	if (fd < 0 )
		open_error(file, fd);
	if ((eyefi_debug_level >= 3) ||
	    (eyefi_debug_level >= 2 && (__file == REQM))) {
		printf("%s:", eyefi_file_name(__file));
		dumpbuf(eyefi_buf, 128);
	}
	wrote = write(fd, eyefi_buf, EYEFI_BUF_SIZE);
	if (wrote < 0)
		open_error(file, wrote);
	ret = fd_flush(fd);
	if (ret < 0)
		open_error(file, ret);
	close(fd);
	debug_printf(3, "wrote %d bytes to '%s' (string was %d bytes)\n", wrote, file, len);
	if (ret < 0) {
		fprintf(stderr, "error writing to '%s': ", file);
		perror("");
		exit(ret);
	}
	free(file);
}
示例#9
0
static int __devinit snd_probe(struct usb_interface *intf, 
		     const struct usb_device_id *id)
{
	int ret;
	struct snd_card *card;
	struct usb_device *device = interface_to_usbdev(intf);
	
	card = create_card(device);
	
	if (!card)
		return -ENOMEM;
			
	dev_set_drvdata(&intf->dev, card);
	ret = init_card(caiaqdev(card));
	if (ret < 0) {
		log("unable to init card! (ret=%d)\n", ret);
		snd_card_free(card);
		return ret;
	}
	
	return 0;
}
示例#10
0
文件: device.c 项目: AiWinters/linux
static int snd_probe(struct usb_interface *intf,
		     const struct usb_device_id *id)
{
	int ret;
	struct snd_card *card = NULL;
	struct usb_device *device = interface_to_usbdev(intf);

	ret = create_card(device, intf, &card);

	if (ret < 0)
		return ret;

	usb_set_intfdata(intf, card);
	ret = init_card(caiaqdev(card));
	if (ret < 0) {
		log("unable to init card! (ret=%d)\n", ret);
		snd_card_free(card);
		return ret;
	}

	return 0;
}
示例#11
0
static int
sbsh_attach(device_t dev)
{
	struct sbsh_softc	*sc;
	struct ifnet		*ifp;
	int			unit, error = 0, rid;

	sc = device_get_softc(dev);
	unit = device_get_unit(dev);

	rid = PCIR_MAPS + 4;
	sc->mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
					0, ~0, 4096, RF_ACTIVE);

	if (sc->mem_res == NULL) {
		kprintf ("sbsh%d: couldn't map memory\n", unit);
		error = ENXIO;
		goto fail;
	}

	rid = 0;
	sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
	    RF_SHAREABLE | RF_ACTIVE);

	if (sc->irq_res == NULL) {
		kprintf("sbsh%d: couldn't map interrupt\n", unit);
		error = ENXIO;
		goto fail;
	}

	sc->mem_base = rman_get_virtual(sc->mem_res);
	init_card(sc);
	/* generate ethernet MAC address */
	*(u_int32_t *)sc->arpcom.ac_enaddr = htonl(0x00ff0192);
	read_random_unlimited(sc->arpcom.ac_enaddr + 4, 2);

	ifp = &sc->arpcom.ac_if;
	ifp->if_softc = sc;
	if_initname(ifp, "sbsh", unit);
	ifp->if_mtu = ETHERMTU;
	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
	ifp->if_ioctl = sbsh_ioctl;
	ifp->if_start = sbsh_start;
	ifp->if_watchdog = sbsh_watchdog;
	ifp->if_init = sbsh_init;
	ifp->if_baudrate = 4600000;
	ifq_set_maxlen(&ifp->if_snd, IFQ_MAXLEN);
	ifq_set_ready(&ifp->if_snd);

	ether_ifattach(ifp, sc->arpcom.ac_enaddr, NULL);

	ifq_set_cpuid(&ifp->if_snd, rman_get_cpuid(sc->irq_res));

	error = bus_setup_intr(dev, sc->irq_res, INTR_MPSAFE,
				sbsh_intr, sc, &sc->intr_hand, 
				ifp->if_serializer);
	if (error) {
		ether_ifdetach(ifp);
		kprintf("sbsh%d: couldn't set up irq\n", unit);
		goto fail;
	}

	return(0);

fail:
	sbsh_detach(dev);
	return (error);
}
示例#12
0
static int __devinit
setup_instance(struct sfax_hw *card)
{
	const struct firmware *firmware;
	int i, err;
	u_long flags;

	snprintf(card->name, MISDN_MAX_IDLEN - 1, "Speedfax.%d", sfax_cnt + 1);
	write_lock_irqsave(&card_lock, flags);
	list_add_tail(&card->list, &Cards);
	write_unlock_irqrestore(&card_lock, flags);
	_set_debug(card);
	spin_lock_init(&card->lock);
	card->isac.hwlock = &card->lock;
	card->isar.hwlock = &card->lock;
	card->isar.ctrl = (void *)&sfax_ctrl;
	card->isac.name = card->name;
	card->isar.name = card->name;
	card->isar.owner = THIS_MODULE;

	err = request_firmware(&firmware, "isdn/ISAR.BIN", &card->pdev->dev);
	if (err < 0) {
		pr_info("%s: firmware request failed %d\n",
			card->name, err);
		goto error_fw;
	}
	if (debug & DEBUG_HW)
		pr_notice("%s: got firmware %zu bytes\n",
			  card->name, firmware->size);

	mISDNisac_init(&card->isac, card);

	card->isac.dch.dev.D.ctrl = sfax_dctrl;
	card->isac.dch.dev.Bprotocols =
		mISDNisar_init(&card->isar, card);
	for (i = 0; i < 2; i++) {
		set_channelmap(i + 1, card->isac.dch.dev.channelmap);
		list_add(&card->isar.ch[i].bch.ch.list,
			 &card->isac.dch.dev.bchannels);
	}

	err = setup_speedfax(card);
	if (err)
		goto error_setup;
	err = card->isar.init(&card->isar);
	if (err)
		goto error;
	err = mISDN_register_device(&card->isac.dch.dev,
				    &card->pdev->dev, card->name);
	if (err)
		goto error;
	err = init_card(card);
	if (err)
		goto error_init;
	err = card->isar.firmware(&card->isar, firmware->data, firmware->size);
	if (!err)  {
		release_firmware(firmware);
		sfax_cnt++;
		pr_notice("SpeedFax %d cards installed\n", sfax_cnt);
		return 0;
	}
	disable_hwirq(card);
	free_irq(card->irq, card);
error_init:
	mISDN_unregister_device(&card->isac.dch.dev);
error:
	release_region(card->cfg, 256);
error_setup:
	card->isac.release(&card->isac);
	card->isar.release(&card->isar);
	release_firmware(firmware);
error_fw:
	pci_disable_device(card->pdev);
	write_lock_irqsave(&card_lock, flags);
	list_del(&card->list);
	write_unlock_irqrestore(&card_lock, flags);
	kfree(card);
	return err;
}
示例#13
0
static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner)
{
	int ret = 0;
	struct IsdnCard *card = cards + cardnr;
	struct IsdnCardState *cs;

	cs = kzalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
	if (!cs) {
		printk(KERN_WARNING
		       "HiSax: No memory for IsdnCardState(card %d)\n",
		       cardnr + 1);
		goto out;
	}
	card->cs = cs;
	spin_lock_init(&cs->statlock);
	spin_lock_init(&cs->lock);
	cs->chanlimit = 2;	/* maximum B-channel number */
	cs->logecho = 0;	/* No echo logging */
	cs->cardnr = cardnr;
	cs->debug = L1_DEB_WARN;
	cs->HW_Flags = 0;
	cs->busy_flag = busy_flag;
	cs->irq_flags = I4L_IRQ_FLAG;
#if TEI_PER_CARD
	if (card->protocol == ISDN_PTYPE_NI1)
		test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags);
#else
	test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags);
#endif
	cs->protocol = card->protocol;

	if (card->typ <= 0 || card->typ > ISDN_CTYPE_COUNT) {
		printk(KERN_WARNING
		       "HiSax: Card Type %d out of range\n", card->typ);
		goto outf_cs;
	}
	if (!(cs->dlog = kmalloc(MAX_DLOG_SPACE, GFP_ATOMIC))) {
		printk(KERN_WARNING
		       "HiSax: No memory for dlog(card %d)\n", cardnr + 1);
		goto outf_cs;
	}
	if (!(cs->status_buf = kmalloc(HISAX_STATUS_BUFSIZE, GFP_ATOMIC))) {
		printk(KERN_WARNING
		       "HiSax: No memory for status_buf(card %d)\n",
		       cardnr + 1);
		goto outf_dlog;
	}
	cs->stlist = NULL;
	cs->status_read = cs->status_buf;
	cs->status_write = cs->status_buf;
	cs->status_end = cs->status_buf + HISAX_STATUS_BUFSIZE - 1;
	cs->typ = card->typ;
#ifdef MODULE
	cs->iif.owner = lockowner;
#endif
	strcpy(cs->iif.id, id);
	cs->iif.channels = 2;
	cs->iif.maxbufsize = MAX_DATA_SIZE;
	cs->iif.hl_hdrlen = MAX_HEADER_LEN;
	cs->iif.features =
		ISDN_FEATURE_L2_X75I |
		ISDN_FEATURE_L2_HDLC |
		ISDN_FEATURE_L2_HDLC_56K |
		ISDN_FEATURE_L2_TRANS |
		ISDN_FEATURE_L3_TRANS |
#ifdef	CONFIG_HISAX_1TR6
		ISDN_FEATURE_P_1TR6 |
#endif
#ifdef	CONFIG_HISAX_EURO
		ISDN_FEATURE_P_EURO |
#endif
#ifdef	CONFIG_HISAX_NI1
		ISDN_FEATURE_P_NI1 |
#endif
		0;

	cs->iif.command = HiSax_command;
	cs->iif.writecmd = NULL;
	cs->iif.writebuf_skb = HiSax_writebuf_skb;
	cs->iif.readstat = HiSax_readstatus;
	register_isdn(&cs->iif);
	cs->myid = cs->iif.channels;
	printk(KERN_INFO
	       "HiSax: Card %d Protocol %s Id=%s (%d)\n", cardnr + 1,
	       (card->protocol == ISDN_PTYPE_1TR6) ? "1TR6" :
	       (card->protocol == ISDN_PTYPE_EURO) ? "EDSS1" :
	       (card->protocol == ISDN_PTYPE_LEASED) ? "LEASED" :
	       (card->protocol == ISDN_PTYPE_NI1) ? "NI1" :
	       "NONE", cs->iif.id, cs->myid);
	switch (card->typ) {
#if CARD_TELES0
	case ISDN_CTYPE_16_0:
	case ISDN_CTYPE_8_0:
		ret = setup_teles0(card);
		break;
#endif
#if CARD_TELES3
	case ISDN_CTYPE_16_3:
	case ISDN_CTYPE_PNP:
	case ISDN_CTYPE_TELESPCMCIA:
	case ISDN_CTYPE_COMPAQ_ISA:
		ret = setup_teles3(card);
		break;
#endif
#if CARD_S0BOX
	case ISDN_CTYPE_S0BOX:
		ret = setup_s0box(card);
		break;
#endif
#if CARD_TELESPCI
	case ISDN_CTYPE_TELESPCI:
		ret = setup_telespci(card);
		break;
#endif
#if CARD_AVM_A1
	case ISDN_CTYPE_A1:
		ret = setup_avm_a1(card);
		break;
#endif
#if CARD_AVM_A1_PCMCIA
	case ISDN_CTYPE_A1_PCMCIA:
		ret = setup_avm_a1_pcmcia(card);
		break;
#endif
#if CARD_FRITZPCI
	case ISDN_CTYPE_FRITZPCI:
		ret = setup_avm_pcipnp(card);
		break;
#endif
#if CARD_ELSA
	case ISDN_CTYPE_ELSA:
	case ISDN_CTYPE_ELSA_PNP:
	case ISDN_CTYPE_ELSA_PCMCIA:
	case ISDN_CTYPE_ELSA_PCI:
		ret = setup_elsa(card);
		break;
#endif
#if CARD_IX1MICROR2
	case ISDN_CTYPE_IX1MICROR2:
		ret = setup_ix1micro(card);
		break;
#endif
#if CARD_DIEHLDIVA
	case ISDN_CTYPE_DIEHLDIVA:
		ret = setup_diva(card);
		break;
#endif
#if CARD_ASUSCOM
	case ISDN_CTYPE_ASUSCOM:
		ret = setup_asuscom(card);
		break;
#endif
#if CARD_TELEINT
	case ISDN_CTYPE_TELEINT:
		ret = setup_TeleInt(card);
		break;
#endif
#if CARD_SEDLBAUER
	case ISDN_CTYPE_SEDLBAUER:
	case ISDN_CTYPE_SEDLBAUER_PCMCIA:
	case ISDN_CTYPE_SEDLBAUER_FAX:
		ret = setup_sedlbauer(card);
		break;
#endif
#if CARD_SPORTSTER
	case ISDN_CTYPE_SPORTSTER:
		ret = setup_sportster(card);
		break;
#endif
#if CARD_MIC
	case ISDN_CTYPE_MIC:
		ret = setup_mic(card);
		break;
#endif
#if CARD_NETJET_S
	case ISDN_CTYPE_NETJET_S:
		ret = setup_netjet_s(card);
		break;
#endif
#if CARD_HFCS
	case ISDN_CTYPE_TELES3C:
	case ISDN_CTYPE_ACERP10:
		ret = setup_hfcs(card);
		break;
#endif
#if CARD_HFC_PCI
	case ISDN_CTYPE_HFC_PCI:
		ret = setup_hfcpci(card);
		break;
#endif
#if CARD_HFC_SX
	case ISDN_CTYPE_HFC_SX:
		ret = setup_hfcsx(card);
		break;
#endif
#if CARD_NICCY
	case ISDN_CTYPE_NICCY:
		ret = setup_niccy(card);
		break;
#endif
#if CARD_ISURF
	case ISDN_CTYPE_ISURF:
		ret = setup_isurf(card);
		break;
#endif
#if CARD_HSTSAPHIR
	case ISDN_CTYPE_HSTSAPHIR:
		ret = setup_saphir(card);
		break;
#endif
#if	CARD_BKM_A4T
	case ISDN_CTYPE_BKM_A4T:
		ret = setup_bkm_a4t(card);
		break;
#endif
#if	CARD_SCT_QUADRO
	case ISDN_CTYPE_SCT_QUADRO:
		ret = setup_sct_quadro(card);
		break;
#endif
#if CARD_GAZEL
	case ISDN_CTYPE_GAZEL:
		ret = setup_gazel(card);
		break;
#endif
#if CARD_W6692
	case ISDN_CTYPE_W6692:
		ret = setup_w6692(card);
		break;
#endif
#if CARD_NETJET_U
	case ISDN_CTYPE_NETJET_U:
		ret = setup_netjet_u(card);
		break;
#endif
#if CARD_FN_ENTERNOW_PCI
	case ISDN_CTYPE_ENTERNOW:
		ret = setup_enternow_pci(card);
		break;
#endif
	case ISDN_CTYPE_DYNAMIC:
		ret = 2;
		break;
	default:
		printk(KERN_WARNING
		       "HiSax: Support for %s Card not selected\n",
		       CardType[card->typ]);
		ll_unload(cs);
		goto outf_cs;
	}
	if (!ret) {
		ll_unload(cs);
		goto outf_cs;
	}
	if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) {
		printk(KERN_WARNING "HiSax: No memory for isac rcvbuf\n");
		ll_unload(cs);
		goto outf_cs;
	}
	cs->rcvidx = 0;
	cs->tx_skb = NULL;
	cs->tx_cnt = 0;
	cs->event = 0;

	skb_queue_head_init(&cs->rq);
	skb_queue_head_init(&cs->sq);

	init_bcstate(cs, 0);
	init_bcstate(cs, 1);

	/* init_card only handles interrupts which are not */
	/* used here for the loadable driver */
	switch (card->typ) {
		case ISDN_CTYPE_DYNAMIC:
			ret = 0;
			break;
		default:
			ret = init_card(cs);
			break;
	}
	if (ret) {
		closecard(cardnr);
		ret = 0;
		goto outf_cs;
	}
	init_tei(cs, cs->protocol);
	ret = CallcNewChan(cs);
	if (ret) {
		closecard(cardnr);
		ret = 0;
		goto outf_cs;
	}
	/* ISAR needs firmware download first */
	if (!test_bit(HW_ISAR, &cs->HW_Flags))
		ll_run(cs, 0);

	ret = 1;
	goto out;

 outf_dlog:
	kfree(cs->dlog);
 outf_cs:
	kfree(cs);
	card->cs = NULL;
 out:
	return ret;
}
示例#14
0
static int
setup_instance(struct w6692_hw *card)
{
	int		i, err;
	u_long		flags;

	snprintf(card->name, MISDN_MAX_IDLEN - 1, "w6692.%d", w6692_cnt + 1);
	write_lock_irqsave(&card_lock, flags);
	list_add_tail(&card->list, &Cards);
	write_unlock_irqrestore(&card_lock, flags);
	card->fmask = (1 << w6692_cnt);
	_set_debug(card);
	spin_lock_init(&card->lock);
	mISDN_initdchannel(&card->dch, MAX_DFRAME_LEN_L1, W6692_ph_bh);
	card->dch.dev.Dprotocols = (1 << ISDN_P_TE_S0);
	card->dch.dev.D.send = w6692_l2l1D;
	card->dch.dev.D.ctrl = w6692_dctrl;
	card->dch.dev.Bprotocols = (1 << (ISDN_P_B_RAW & ISDN_P_B_MASK)) |
		(1 << (ISDN_P_B_HDLC & ISDN_P_B_MASK));
	card->dch.hw = card;
	card->dch.dev.nrbchan = 2;
	for (i = 0; i < 2; i++) {
		mISDN_initbchannel(&card->bc[i].bch, MAX_DATA_MEM);
		card->bc[i].bch.hw = card;
		card->bc[i].bch.nr = i + 1;
		card->bc[i].bch.ch.nr = i + 1;
		card->bc[i].bch.ch.send = w6692_l2l1B;
		card->bc[i].bch.ch.ctrl = w6692_bctrl;
		set_channelmap(i + 1, card->dch.dev.channelmap);
		list_add(&card->bc[i].bch.ch.list, &card->dch.dev.bchannels);
	}
	err = setup_w6692(card);
	if (err)
		goto error_setup;
	err = mISDN_register_device(&card->dch.dev, &card->pdev->dev,
		card->name);
	if (err)
		goto error_reg;
	err = init_card(card);
	if (err)
		goto error_init;
	err = create_l1(&card->dch, w6692_l1callback);
	if (!err) {
		w6692_cnt++;
		pr_notice("W6692 %d cards installed\n", w6692_cnt);
		return 0;
	}

	free_irq(card->irq, card);
error_init:
	mISDN_unregister_device(&card->dch.dev);
error_reg:
	release_region(card->addr, 256);
error_setup:
	mISDN_freebchannel(&card->bc[1].bch);
	mISDN_freebchannel(&card->bc[0].bch);
	mISDN_freedchannel(&card->dch);
	write_lock_irqsave(&card_lock, flags);
	list_del(&card->list);
	write_unlock_irqrestore(&card_lock, flags);
	kfree(card);
	return err;
}
示例#15
0
static char *eyefi_file(enum eyefi_file file)
{
	init_card();
	return eyefi_file_on(file, locate_eyefi_mount());
}