aboutsummaryrefslogtreecommitdiffstats
path: root/src/fw_iso_resource_private.h
blob: 46da23016c62fdd2bc01c35411154af3cbbe525a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef __HINOKO_FW_ISO_RESOURCE_PRIVATE_H__
#define __HINOKO_FW_ISO_RESOURCE_PRIVATE_H__

#include "hinoko.h"

#include <unistd.h>
#include <errno.h>

#define ALLOCATED_SIGNAL_NAME		"allocated"
#define DEALLOCATED_SIGNAL_NAME		"deallocated"

gboolean fw_iso_resource_open(int *fd, const gchar *path, gint open_flag, GError **error);
void hinoko_fw_iso_resource_ioctl(HinokoFwIsoResource *self,
				  unsigned long request, void *argp,
				  GError **error);

void fw_iso_resource_auto_handle_event(HinokoFwIsoResource *inst, const char *signal_name,
				       guint channel, guint bandwidth, const GError *error);

void fw_iso_resource_once_handle_event(HinokoFwIsoResource *inst, const char *signal_name,
				       guint channel, guint bandwidth, const GError *error);

struct fw_iso_resource_waiter {
	GMutex mutex;
	GCond cond;
	GError *error;
	gboolean handled;
	guint64 expiration;
	gulong handler_id;
};

void fw_iso_resource_waiter_init(HinokoFwIsoResource *self, struct fw_iso_resource_waiter *w,
				 const char *signal_name, guint timeout_ms);

void fw_iso_resource_waiter_wait(HinokoFwIsoResource *self, struct fw_iso_resource_waiter *w,
				 GError **error);

#endif