162306a36Sopenharmony_ci/* SPDX-License-Identifier: MIT */
262306a36Sopenharmony_ci#ifndef __NVIF_EVENT_H__
362306a36Sopenharmony_ci#define __NVIF_EVENT_H__
462306a36Sopenharmony_ci#include <nvif/object.h>
562306a36Sopenharmony_ci#include <nvif/if000e.h>
662306a36Sopenharmony_cistruct nvif_event;
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#define NVIF_EVENT_KEEP 0
962306a36Sopenharmony_ci#define NVIF_EVENT_DROP 1
1062306a36Sopenharmony_citypedef int (*nvif_event_func)(struct nvif_event *, void *repv, u32 repc);
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cistruct nvif_event {
1362306a36Sopenharmony_ci	struct nvif_object object;
1462306a36Sopenharmony_ci	nvif_event_func func;
1562306a36Sopenharmony_ci};
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_cistatic inline bool
1862306a36Sopenharmony_cinvif_event_constructed(struct nvif_event *event)
1962306a36Sopenharmony_ci{
2062306a36Sopenharmony_ci	return nvif_object_constructed(&event->object);
2162306a36Sopenharmony_ci}
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ciint nvif_event_ctor_(struct nvif_object *, const char *, u32, nvif_event_func, bool,
2462306a36Sopenharmony_ci		     struct nvif_event_v0 *, u32, bool, struct nvif_event *);
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_cistatic inline int
2762306a36Sopenharmony_cinvif_event_ctor(struct nvif_object *parent, const char *name, u32 handle, nvif_event_func func,
2862306a36Sopenharmony_ci		bool wait, struct nvif_event_v0 *args, u32 argc, struct nvif_event *event)
2962306a36Sopenharmony_ci{
3062306a36Sopenharmony_ci	return nvif_event_ctor_(parent, name, handle, func, wait, args, argc, true, event);
3162306a36Sopenharmony_ci}
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_civoid nvif_event_dtor(struct nvif_event *);
3462306a36Sopenharmony_ciint nvif_event_allow(struct nvif_event *);
3562306a36Sopenharmony_ciint nvif_event_block(struct nvif_event *);
3662306a36Sopenharmony_ci#endif
37