iso-resources.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED
  2. #define SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED
  3. #include <linux/mutex.h>
  4. #include <linux/types.h>
  5. struct fw_unit;
  6. /**
  7. * struct fw_iso_resources - manages channel/bandwidth allocation
  8. * @channels_mask: if the device does not support all channel numbers, set this
  9. * bit mask to something else than the default (all ones)
  10. *
  11. * This structure manages (de)allocation of isochronous resources (channel and
  12. * bandwidth) for one isochronous stream.
  13. */
  14. struct fw_iso_resources {
  15. u64 channels_mask;
  16. /* private: */
  17. struct fw_unit *unit;
  18. struct mutex mutex;
  19. unsigned int channel;
  20. unsigned int bandwidth; /* in bandwidth units, without overhead */
  21. unsigned int bandwidth_overhead;
  22. int generation; /* in which allocation is valid */
  23. bool allocated;
  24. };
  25. int fw_iso_resources_init(struct fw_iso_resources *r,
  26. struct fw_unit *unit);
  27. void fw_iso_resources_destroy(struct fw_iso_resources *r);
  28. int fw_iso_resources_allocate(struct fw_iso_resources *r,
  29. unsigned int max_payload_bytes, int speed);
  30. int fw_iso_resources_update(struct fw_iso_resources *r);
  31. void fw_iso_resources_free(struct fw_iso_resources *r);
  32. #endif