cal1.h
#define PCI_VENDOR_ID_ODR 0x10dc
#define PCI_DEVICE_ID_ODR 0x016a
/*original values: */
/*#define PCI_VENDOR_ID_ODR 0x1556
#define PCI_DEVICE_ID_ODR 0x1100*/
#define FIRSTMINOR 0
#define kdebug(x) {if (debug) printk x;}
#define kerror(x) {printk x;}
#define WritePointer_Address 0x17
#define WritePointerAddress_Address 0x18
#define WPDuplicatorTimeout_Address 0x19
int base_add_list[] = {PCI_BASE_ADDRESS_0,PCI_BASE_ADDRESS_1,PCI_BASE_ADDRESS_2,
PCI_BASE_ADDRESS_3,PCI_BASE_ADDRESS_4,PCI_BASE_ADDRESS_5};
/* ID tables: should this be in the header ? */
struct pci_device_id odrIds[] =
{
{ PCI_DEVICE(PCI_VENDOR_ID_ODR, PCI_DEVICE_ID_ODR) },
{ 0, },
};
/* the device name as it will appear in /proc/devices */
char *odrdevname = "/dev/odr_test";
int calicedriver_init(void);
void calicedriver_exit(void);
int odrProbe(struct pci_dev*, const struct pci_device_id*);
void odrRemove(struct pci_dev*);
int odr_mmap(struct file*, struct vm_area_struct*);
void odr_vmclose(struct vm_area_struct*);
int odr_ioctl(struct inode*, struct file*, u_int, u_long);
int odr_open(struct inode*, struct file*);
int odr_release(struct inode*, struct file*);
int check_slot_device(u_int);
/* needed to activate the device: cdev_add call, old, good file operatuions */
struct file_operations fops =
{
.owner = THIS_MODULE,
.mmap = odr_mmap,
.ioctl = odr_ioctl,
.open = odr_open,
.release = odr_release,
};
/* needed by pci_register_driver fcall */
struct pci_driver calicePciDriver =
{
.name = "cal1",
.id_table = odrIds,
.probe = odrProbe,
.remove = odrRemove,
};
/* memory handler functions used by mmap */
static struct vm_operations_struct odr_vm_ops =
{
.close = odr_vmclose, /* mmap-close */
};
--
TaoWu - 23 Apr 2008
Topic revision: r1 - 2008-04-23
- TaoWu