コード例 #1
0
int
ergo_inithardware(hysdn_card * card)
{
	if (!request_region(card->iobase + PCI9050_INTR_REG, 1, "HYSDN")) 
		return (-1);
	if (!request_region(card->iobase + PCI9050_USER_IO, 1, "HYSDN")) {
		release_region(card->iobase + PCI9050_INTR_REG, 1);
		return (-1);	
	}
	card->memend = card->membase + ERG_DPRAM_PAGE_SIZE - 1;
	if (!(card->dpram = ioremap(card->membase, ERG_DPRAM_PAGE_SIZE))) {
		release_region(card->iobase + PCI9050_INTR_REG, 1);
		release_region(card->iobase + PCI9050_USER_IO, 1);
		return (-1);
	}

	ergo_stopcard(card);	
	if (request_irq(card->irq, ergo_interrupt, IRQF_SHARED, "HYSDN", card)) {
		ergo_releasehardware(card); 
		return (-1);
	}
	
	card->stopcard = ergo_stopcard;
	card->releasehardware = ergo_releasehardware;
	card->testram = ergo_testram;
	card->writebootimg = ergo_writebootimg;
	card->writebootseq = ergo_writebootseq;
	card->waitpofready = ergo_waitpofready;
	card->set_errlog_state = ergo_set_errlog_state;
	INIT_WORK(&card->irq_queue, ergo_irq_bh);
	spin_lock_init(&card->hysdn_lock);

	return (0);
}				
コード例 #2
0
int
ergo_inithardware(hysdn_card * card)
{
	if (!request_region(card->iobase + PCI9050_INTR_REG, 1, "HYSDN")) 
		return (-1);
	if (!request_region(card->iobase + PCI9050_USER_IO, 1, "HYSDN")) {
		release_region(card->iobase + PCI9050_INTR_REG, 1);
		return (-1);	/* ports already in use */
	}
	card->memend = card->membase + ERG_DPRAM_PAGE_SIZE - 1;
	if (!(card->dpram = ioremap(card->membase, ERG_DPRAM_PAGE_SIZE))) {
		release_region(card->iobase + PCI9050_INTR_REG, 1);
		release_region(card->iobase + PCI9050_USER_IO, 1);
		return (-1);
	}

	ergo_stopcard(card);	/* disable interrupts */
	if (request_irq(card->irq, ergo_interrupt, IRQF_SHARED, "HYSDN", card)) {
		ergo_releasehardware(card); /* return the acquired hardware */
		return (-1);
	}
	/* success, now setup the function pointers */
	card->stopcard = ergo_stopcard;
	card->releasehardware = ergo_releasehardware;
	card->testram = ergo_testram;
	card->writebootimg = ergo_writebootimg;
	card->writebootseq = ergo_writebootseq;
	card->waitpofready = ergo_waitpofready;
	card->set_errlog_state = ergo_set_errlog_state;
	INIT_WORK(&card->irq_queue, ergo_irq_bh);
	card->hysdn_lock = SPIN_LOCK_UNLOCKED;

	return (0);
}				/* ergo_inithardware */
int
ergo_inithardware(hysdn_card * card)
{
	if (check_region(card->iobase + PCI9050_INTR_REG, 1) ||
	    check_region(card->iobase + PCI9050_USER_IO, 1))
		return (-1);	/* ports already in use */

	card->memend = card->membase + ERG_DPRAM_PAGE_SIZE - 1;
	if (!(card->dpram = ioremap(card->membase, ERG_DPRAM_PAGE_SIZE)))
		return (-1);

	request_region(card->iobase + PCI9050_INTR_REG, 1, "HYSDN");
	request_region(card->iobase + PCI9050_USER_IO, 1, "HYSDN");
	ergo_stopcard(card);	/* disable interrupts */
	if (request_irq(card->irq, ergo_interrupt, SA_SHIRQ, "HYSDN", card)) {
		ergo_releasehardware(card); /* return the acquired hardware */
		return (-1);
	}
	/* success, now setup the function pointers */
	card->stopcard = ergo_stopcard;
	card->releasehardware = ergo_releasehardware;
	card->testram = ergo_testram;
	card->writebootimg = ergo_writebootimg;
	card->writebootseq = ergo_writebootseq;
	card->waitpofready = ergo_waitpofready;
	card->set_errlog_state = ergo_set_errlog_state;
	card->irq_queue.sync = 0;
	card->irq_queue.data = card;	/* init task queue for interrupt */
	card->irq_queue.routine = (void *) (void *) ergo_irq_bh;

	return (0);
}				/* ergo_inithardware */