base.h 3.2 KB

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