cmp.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef SOUND_FIREWIRE_CMP_H_INCLUDED
  3. #define SOUND_FIREWIRE_CMP_H_INCLUDED
  4. #include <linux/mutex.h>
  5. #include <linux/types.h>
  6. #include "iso-resources.h"
  7. struct fw_unit;
  8. enum cmp_direction {
  9. CMP_INPUT = 0,
  10. CMP_OUTPUT,
  11. };
  12. /**
  13. * struct cmp_connection - manages an isochronous connection to a device
  14. * @speed: the connection's actual speed
  15. *
  16. * This structure manages (using CMP) an isochronous stream between the local
  17. * computer and a device's input plug (iPCR) and output plug (oPCR).
  18. *
  19. * There is no corresponding oPCR created on the local computer, so it is not
  20. * possible to overlay connections on top of this one.
  21. */
  22. struct cmp_connection {
  23. int speed;
  24. /* private: */
  25. bool connected;
  26. struct mutex mutex;
  27. struct fw_iso_resources resources;
  28. __be32 last_pcr_value;
  29. unsigned int pcr_index;
  30. unsigned int max_speed;
  31. enum cmp_direction direction;
  32. };
  33. int cmp_connection_init(struct cmp_connection *connection,
  34. struct fw_unit *unit,
  35. enum cmp_direction direction,
  36. unsigned int pcr_index);
  37. int cmp_connection_check_used(struct cmp_connection *connection, bool *used);
  38. void cmp_connection_destroy(struct cmp_connection *connection);
  39. int cmp_connection_establish(struct cmp_connection *connection,
  40. unsigned int max_payload);
  41. int cmp_connection_update(struct cmp_connection *connection);
  42. void cmp_connection_break(struct cmp_connection *connection);
  43. #endif