The system reboots itself after module_init completes when I insmod my module. It appears to be about the time that the first interrupt should hit. If I do not startup interrupts this does not occur. Can anyone see an error in the following code, know of a bug I might have missed with RTAI 3.0, or give me some tips on attacking this.
SYSTEM INFO:
The system is a National Instruments PXI workstation running a PIII 700 MHz processor, 256 MB RAM and a PCI based homegrown board that I am writing this driver for. I started with RedHat 6.2 Standard and loaded RTAI 3.0 on top of it.
Linux cots6 2.2.16-ert #1 Wed Feb 14 14:33:36 EST 2001 i686 unknown
Module Size Used by
rtai_fifos 27024 0 (unused)
rtai_shm 6100 0 (unused)
rtai_sched 20828 0 (unused)
rtai 30000 2 [rtai_fifos rtai_shm rtai_sched]
lockd 31432 1 (autoclean)
sunrpc 52868 1 (autoclean) [lockd]
yellowfin 10952 1 (autoclean)
SOURCE:
- HEADER
#ifndef _EATGD_H_
#define _EATGD_H_
.
.
.
#define EATG_MIN_VERSION 020213 /* Min kernel revision needed for this driver */
.
.
.
struct sEATGDevice {
struct pci_dev *pdev; // Ptr to PCI info struct
unsigned int irq; // Irq used by board
void (*handler)(void); // irq handler
.
.
.
};
int init_module(void);
.
.
.
void cleanup_module(void);
#endif _EATGD_H_
- CODE
.
.
.
struct sEATGDevice eatgInfo; /* Information record of the ATG device */
// Interrupt Handler
static void eatgIrqHandler(void) {
static long int i = 0;
i++;
i = 0;
} // static void eatgIrqHandler(void)
int eatgConfigInit(struct pci_dev *eatg, int *errorStat)
{
.
.
.
/* Find the EATG device */
if((eatg = pci_find_device(EATG_VENDOR_ID, EATG_DEVICE_ID, eatg)) == NULL)
{
PRINTERR(KERN_EMERG, "EATG error: Device not found ");
*errorStat = -ENODEV;
return failedATGNotFound;
}
/* Report EATG board revision info */
pci_read_config_byte(eatg, PCI_REVISION_ID, revisionp);
eatgInfo.handler = eatgIrqHandler;
/* Preserve pointer to EATG device */
eatgInfo.pdev = eatg;
/* Preserve interrupt used by EATG device */
eatgInfo.irq = eatg->irq;
/* Install RT interrupt handler */
result = rt_request_global_irq (eatgInfo.irq, eatgInfo.handler);
if (result==-EINVAL)
{
PRINTERR(KERN_ERR, "EATG: Bad irq number %i or handler\n",eatgInfo.irq);
return(failedRequestIRQ);
}
if (result==-EBUSY)
{
PRINTERR(KERN_ERR, "EATG: IRQ %d busy, change your PnP config in BIOS\n",
eatgInfo.irq);
return(failedRequestIRQ);
}
.
.
.
return goodStatus;
} /* int eatgConfigInit(struct pci_dev *eatg, int *errorStat) */
#ifdef MODULE
int init_module(void)
{
.
.
.
/* Make sure that this system has a PCI bios and bus. */
if (!pci_present()) {
PRINTERR(KERN_CRIT, "No PCI bios present");
return -ENODEV;
}
/* Register your major, and accept a dynamic number */
.
.
.
/*
* Configure the device
*/
/* Configure and Initialize the card and devices, test the result */
switch (eatgConfigInit(eatg, &errorStat)) {
case failedATGNotFound:
goto failATG;
break;
case failedProgramFPGA:
PRINTERR(KERN_EMERG, "Going down . . . .");
goto failConfigInit;
break;
case failedRequestIRQ:
goto failIRQ;
break;
default:
// Don't do anything intentionally. Default response means that we have
// completed the configuration and Initialization successfully.
} // switch eatgConfigInit(eatg, &errorStat)
.
.
.
// Hookup fifos
// Transaction Processor IRQ Handler to Data Pump FIFO
if((errStat = rtf_create(EATG_TPIRQ2DP_FIFO, EATG_TPIRQ2DP_FIFO_SIZE)) < 0) {
PRINTERR(KERN_ALERT, "Unable to create TPIRQ2DP FIFO.\n");
goto failCreateTPIRQ2DPFIFO;
}
.
.
.
/* Start RT interrupt handler */
rt_startup_irq (eatgInfo.irq);
#ifndef EATG_DEBUG
register_symtab(NULL); // otherwise, leave global symbols visible
#endif
#ifdef EATG_USE_PROC /* only when available */
/* this is the last line in init_module */
proc_register(&proc_root, &eatgProcEntry);
#endif
/* Success */
return 0;
.
.
.
} /* int init_module(void) */
void cleanup_module(void) {
.
.
.
} // void cleanup_module(void)
#endif
Thank You.
Eric O. Heinicke [EMAIL PROTECTED]
BAE SYSTEMS Voice:631.262.8644
Fax: 631.262.8657
One Hazeltine Way, MS 1-78
Greenlawn, NY 11740-1606