Line 37... |
Line 37... |
static dev_t devno = MKDEV(0, 0);
|
static dev_t devno = MKDEV(0, 0);
|
static struct class *pex_class = NULL;
|
static struct class *pex_class = NULL;
|
static LIST_HEAD(device_list);
|
static LIST_HEAD(device_list);
|
static int boards_count = 0;
|
static int boards_count = 0;
|
static struct mutex pex_mutex;
|
static struct mutex pex_mutex;
|
int dbg_trace = 0;
|
int dbg_trace = 1;
|
int err_trace = 1;
|
int err_trace = 1;
|
|
|
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
|
|
static int free_memory(struct pex_device *brd)
|
static int free_memory(struct pex_device *brd)
|
Line 471... |
Line 471... |
.vendor = INSYS_VENDOR_ID,
|
.vendor = INSYS_VENDOR_ID,
|
.device = AMBFMC106P_DEVID,
|
.device = AMBFMC106P_DEVID,
|
.subvendor = PCI_ANY_ID,
|
.subvendor = PCI_ANY_ID,
|
.subdevice = PCI_ANY_ID,
|
.subdevice = PCI_ANY_ID,
|
},
|
},
|
|
{
|
|
.vendor = INSYS_VENDOR_ID,
|
|
.device = AMBFMC114V_DEVID,
|
|
.subvendor = PCI_ANY_ID,
|
|
.subdevice = PCI_ANY_ID,
|
|
},
|
|
{
|
|
.vendor = INSYS_VENDOR_ID,
|
|
.device = AMBKU_SSCOS_DEVID,
|
|
.subvendor = PCI_ANY_ID,
|
|
.subdevice = PCI_ANY_ID,
|
|
},
|
{ },
|
{ },
|
};
|
};
|
|
|
MODULE_DEVICE_TABLE(pci, pex_device_id);
|
MODULE_DEVICE_TABLE(pci, pex_device_id);
|
|
|
Line 571... |
Line 583... |
}
|
}
|
|
|
dbg_msg(dbg_trace, "%s(): Add cdev %d\n", __FUNCTION__, boards_count);
|
dbg_msg(dbg_trace, "%s(): Add cdev %d\n", __FUNCTION__, boards_count);
|
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
|
brd->m_device = device_create(pex_class, NULL, brd->m_devno, "%s", brd->m_name);
|
brd->m_device = device_create(pex_class, NULL, brd->m_devno, "%s%d", "pexdrv", boards_count);
|
#else
|
#else
|
brd->m_device = device_create(pex_class, NULL, brd->m_devno, NULL, "%s", brd->m_name);
|
brd->m_device = device_create(pex_class, NULL, brd->m_devno, NULL, "%s%d", "pexdrv", boards_count);
|
#endif
|
#endif
|
if(!brd->m_device ) {
|
if(!brd->m_device ) {
|
err_msg(err_trace, "%s(): Error create device for board: %s\n", __FUNCTION__, brd->m_name);
|
err_msg(err_trace, "%s(): Error create device for board: %s\n", __FUNCTION__, brd->m_name);
|
error = -EINVAL;
|
error = -EINVAL;
|
goto do_delete_cdev;
|
goto do_delete_cdev;
|
Line 641... |
Line 653... |
|
|
static void __devexit pex_device_remove(struct pci_dev *dev)
|
static void __devexit pex_device_remove(struct pci_dev *dev)
|
{
|
{
|
struct list_head *pos, *n;
|
struct list_head *pos, *n;
|
struct pex_device *brd = NULL;
|
struct pex_device *brd = NULL;
|
|
int i = 0;
|
|
|
dbg_msg(dbg_trace, "%s(): device_id = %x, vendor_id = %x\n", __FUNCTION__, dev->device, dev->vendor);
|
dbg_msg(dbg_trace, "%s(): device_id = %x, vendor_id = %x\n", __FUNCTION__, dev->device, dev->vendor);
|
|
|
mutex_lock(&pex_mutex);
|
mutex_lock(&pex_mutex);
|
|
|
Line 656... |
Line 669... |
|
|
free_irq(brd->m_Interrupt, brd);
|
free_irq(brd->m_Interrupt, brd);
|
dbg_msg(dbg_trace, "%s(): free_irq() - complete\n", __FUNCTION__);
|
dbg_msg(dbg_trace, "%s(): free_irq() - complete\n", __FUNCTION__);
|
pex_remove_proc(brd->m_name);
|
pex_remove_proc(brd->m_name);
|
dbg_msg(dbg_trace, "%s(): pex_remove_proc() - complete\n", __FUNCTION__);
|
dbg_msg(dbg_trace, "%s(): pex_remove_proc() - complete\n", __FUNCTION__);
|
|
for(i = 0; i < MAX_NUMBER_OF_DMACHANNELS; i++) {
|
|
if(brd->m_DmaChannel[i]) {
|
|
CDmaChannelDelete(brd->m_DmaChannel[i]);
|
|
dbg_msg(dbg_trace, "%s(): free DMA channel %d - complete\n", __FUNCTION__, i);
|
|
}
|
|
}
|
free_memory(brd);
|
free_memory(brd);
|
dbg_msg(dbg_trace, "%s(): free_memory() - complete\n", __FUNCTION__);
|
dbg_msg(dbg_trace, "%s(): free_memory() - complete\n", __FUNCTION__);
|
device_destroy(pex_class, brd->m_devno);
|
device_destroy(pex_class, brd->m_devno);
|
dbg_msg(dbg_trace, "%s(): device_destroy() - complete\n", __FUNCTION__);
|
dbg_msg(dbg_trace, "%s(): device_destroy() - complete\n", __FUNCTION__);
|
cdev_del(&brd->m_cdev);
|
cdev_del(&brd->m_cdev);
|