base.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef _PCIDRIVER_BASE_H
  2. #define _PCIDRIVER_BASE_H
  3. #include "sysfs.h"
  4. /**
  5. *
  6. * This file contains prototypes and data structures for internal use of the pciDriver.
  7. *
  8. *
  9. */
  10. /* prototypes for file_operations */
  11. static struct file_operations pcidriver_fops;
  12. int pcidriver_mmap( struct file *filp, struct vm_area_struct *vmap );
  13. int pcidriver_open(struct inode *inode, struct file *filp );
  14. int pcidriver_release(struct inode *inode, struct file *filp);
  15. /* prototypes for device operations */
  16. #ifndef PCIDRIVER_DUMMY_DEVICE
  17. static struct pci_driver pcidriver_driver;
  18. #endif /* ! PCIDRIVER_DUMMY_DEVICE */
  19. static int __devinit pcidriver_probe(struct pci_dev *pdev, const struct pci_device_id *id);
  20. static void __devexit pcidriver_remove(struct pci_dev *pdev);
  21. /* prototypes for module operations */
  22. static int __init pcidriver_init(void);
  23. static void pcidriver_exit(void);
  24. /*
  25. * This is the table of PCI devices handled by this driver by default
  26. * If you want to add devices dynamically to this list, do:
  27. *
  28. * echo "vendor device" > /sys/bus/pci/drivers/pciDriver/new_id
  29. * where vendor and device are in hex, without leading '0x'.
  30. *
  31. * The IDs themselves can be found in common.h
  32. *
  33. * For more info, see <kernel-source>/Documentation/pci.txt
  34. *
  35. * __devinitdata is applied because the kernel does not need those
  36. * tables any more after boot is finished on systems which don't
  37. * support hotplug.
  38. *
  39. */
  40. static const __devinitdata struct pci_device_id pcidriver_ids[] = {
  41. { PCI_DEVICE( PCIE_XILINX_VENDOR_ID, PCIE_ML605_DEVICE_ID ) }, // PCI-E Xilinx ML605
  42. { PCI_DEVICE( PCIE_XILINX_VENDOR_ID, PCIE_IPECAMERA_DEVICE_ID ) }, // PCI-E IPE Camera
  43. { PCI_DEVICE( PCIE_XILINX_VENDOR_ID, PCIE_KAPTURE_DEVICE_ID ) }, // PCI-E KAPTURE board for HEB
  44. {0,0,0,0},
  45. };
  46. /* prototypes for internal driver functions */
  47. int pcidriver_pci_read( pcidriver_privdata_t *privdata, pci_cfg_cmd *pci_cmd );
  48. int pcidriver_pci_write( pcidriver_privdata_t *privdata, pci_cfg_cmd *pci_cmd );
  49. int pcidriver_pci_info( pcidriver_privdata_t *privdata, pcilib_board_info_t *pci_info );
  50. int pcidriver_mmap_pci( pcidriver_privdata_t *privdata, struct vm_area_struct *vmap , int bar );
  51. int pcidriver_mmap_kmem( pcidriver_privdata_t *privdata, struct vm_area_struct *vmap );
  52. /*************************************************************************/
  53. /* Static data */
  54. /* Hold the allocated major & minor numbers */
  55. static dev_t pcidriver_devt;
  56. /* Number of devices allocated */
  57. static atomic_t pcidriver_deviceCount;
  58. /* Sysfs attributes */
  59. static DEVICE_ATTR(mmap_mode, 0664, pcidriver_show_mmap_mode, pcidriver_store_mmap_mode);
  60. static DEVICE_ATTR(mmap_area, 0664, pcidriver_show_mmap_area, pcidriver_store_mmap_area);
  61. static DEVICE_ATTR(kmem_count, S_IRUGO, pcidriver_show_kmem_count, NULL);
  62. static DEVICE_ATTR(kbuffers, S_IRUGO, pcidriver_show_kbuffers, NULL);
  63. static DEVICE_ATTR(kmem_alloc, 0220, NULL, pcidriver_store_kmem_alloc);
  64. static DEVICE_ATTR(kmem_free, 0220, NULL, pcidriver_store_kmem_free);
  65. static DEVICE_ATTR(umappings, S_IRUGO, pcidriver_show_umappings, NULL);
  66. static DEVICE_ATTR(umem_unmap, 0220, NULL, pcidriver_store_umem_unmap);
  67. #ifdef ENABLE_IRQ
  68. static DEVICE_ATTR(irq_count, S_IRUGO, pcidriver_show_irq_count, NULL);
  69. static DEVICE_ATTR(irq_queues, S_IRUGO, pcidriver_show_irq_queues, NULL);
  70. #endif
  71. #endif