1/* SPDX-License-Identifier: MIT */
2#ifndef __NVIF_EVENT_H__
3#define __NVIF_EVENT_H__
4#include <nvif/object.h>
5#include <nvif/if000e.h>
6struct nvif_event;
7
8#define NVIF_EVENT_KEEP 0
9#define NVIF_EVENT_DROP 1
10typedef int (*nvif_event_func)(struct nvif_event *, void *repv, u32 repc);
11
12struct nvif_event {
13	struct nvif_object object;
14	nvif_event_func func;
15};
16
17static inline bool
18nvif_event_constructed(struct nvif_event *event)
19{
20	return nvif_object_constructed(&event->object);
21}
22
23int nvif_event_ctor_(struct nvif_object *, const char *, u32, nvif_event_func, bool,
24		     struct nvif_event_v0 *, u32, bool, struct nvif_event *);
25
26static inline int
27nvif_event_ctor(struct nvif_object *parent, const char *name, u32 handle, nvif_event_func func,
28		bool wait, struct nvif_event_v0 *args, u32 argc, struct nvif_event *event)
29{
30	return nvif_event_ctor_(parent, name, handle, func, wait, args, argc, true, event);
31}
32
33void nvif_event_dtor(struct nvif_event *);
34int nvif_event_allow(struct nvif_event *);
35int nvif_event_block(struct nvif_event *);
36#endif
37