0001
0002 #ifndef __NVKM_EVENT_H__
0003 #define __NVKM_EVENT_H__
0004 #include <core/os.h>
0005 struct nvkm_notify;
0006 struct nvkm_object;
0007
0008 struct nvkm_event {
0009 const struct nvkm_event_func *func;
0010
0011 int types_nr;
0012 int index_nr;
0013
0014 spinlock_t refs_lock;
0015 spinlock_t list_lock;
0016 struct list_head list;
0017 int *refs;
0018 };
0019
0020 struct nvkm_event_func {
0021 int (*ctor)(struct nvkm_object *, void *data, u32 size,
0022 struct nvkm_notify *);
0023 void (*send)(void *data, u32 size, struct nvkm_notify *);
0024 void (*init)(struct nvkm_event *, int type, int index);
0025 void (*fini)(struct nvkm_event *, int type, int index);
0026 };
0027
0028 int nvkm_event_init(const struct nvkm_event_func *func, int types_nr,
0029 int index_nr, struct nvkm_event *);
0030 void nvkm_event_fini(struct nvkm_event *);
0031 void nvkm_event_get(struct nvkm_event *, u32 types, int index);
0032 void nvkm_event_put(struct nvkm_event *, u32 types, int index);
0033 void nvkm_event_send(struct nvkm_event *, u32 types, int index,
0034 void *data, u32 size);
0035 #endif