Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED
0003 #define SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED
0004 
0005 #include <linux/mutex.h>
0006 #include <linux/types.h>
0007 
0008 struct fw_unit;
0009 
0010 /**
0011  * struct fw_iso_resources - manages channel/bandwidth allocation
0012  * @channels_mask: if the device does not support all channel numbers, set this
0013  *                 bit mask to something else than the default (all ones)
0014  *
0015  * This structure manages (de)allocation of isochronous resources (channel and
0016  * bandwidth) for one isochronous stream.
0017  */
0018 struct fw_iso_resources {
0019     u64 channels_mask;
0020     /* private: */
0021     struct fw_unit *unit;
0022     struct mutex mutex;
0023     unsigned int channel;
0024     unsigned int bandwidth; /* in bandwidth units, without overhead */
0025     unsigned int bandwidth_overhead;
0026     int generation; /* in which allocation is valid */
0027     bool allocated;
0028 };
0029 
0030 int fw_iso_resources_init(struct fw_iso_resources *r,
0031               struct fw_unit *unit);
0032 void fw_iso_resources_destroy(struct fw_iso_resources *r);
0033 
0034 int fw_iso_resources_allocate(struct fw_iso_resources *r,
0035                   unsigned int max_payload_bytes, int speed);
0036 int fw_iso_resources_update(struct fw_iso_resources *r);
0037 void fw_iso_resources_free(struct fw_iso_resources *r);
0038 
0039 #endif