API.txt 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Functions Exported by fmc.ko
  2. ****************************
  3. The FMC core exports the usual 4 functions that are needed for a bus to
  4. work, and a few more:
  5. int fmc_driver_register(struct fmc_driver *drv);
  6. void fmc_driver_unregister(struct fmc_driver *drv);
  7. int fmc_device_register(struct fmc_device *fmc);
  8. void fmc_device_unregister(struct fmc_device *fmc);
  9. int fmc_device_register_n(struct fmc_device **fmc, int n);
  10. void fmc_device_unregister_n(struct fmc_device **fmc, int n);
  11. uint32_t fmc_readl(struct fmc_device *fmc, int offset);
  12. void fmc_writel(struct fmc_device *fmc, uint32_t val, int off);
  13. void *fmc_get_drvdata(struct fmc_device *fmc);
  14. void fmc_set_drvdata(struct fmc_device *fmc, void *data);
  15. int fmc_reprogram(struct fmc_device *f, struct fmc_driver *d, char *gw,
  16. int sdb_entry);
  17. The data structure that describe a device is detailed in *note FMC
  18. Device::, the one that describes a driver is detailed in *note FMC
  19. Driver::. Please note that structures of type fmc_device must be
  20. allocated by the caller, but must not be released after unregistering.
  21. The fmc-bus itself takes care of releasing the structure when their use
  22. count reaches zero - actually, the device model does that in lieu of us.
  23. The functions to register and unregister n devices are meant to be used
  24. by carriers that host more than one mezzanine. The devices must all be
  25. registered at the same time because if the FPGA is reprogrammed, all
  26. devices in the array are affected. Usually, the driver matching the
  27. first device will reprogram the FPGA, so other devices must know they
  28. are already driven by a reprogrammed FPGA.
  29. If a carrier hosts slots that are driven by different FPGA devices, it
  30. should register as a group only mezzanines that are driven by the same
  31. FPGA, for the reason outlined above.
  32. Finally, the fmc_reprogram function calls the reprogram method (see
  33. *note The API Offered by Carriers:: and also scans the memory area for
  34. an SDB tree. You can pass -1 as sdb_entry to disable such scan.
  35. Otherwise, the function fails if no tree is found at the specified
  36. entry point. The function is meant to factorize common code, and by
  37. the time you read this it is already used by the spec-sw and fine-delay
  38. modules.