GVM User Suite
User tools for the GVM open source project.
api.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 2666680 Ontario Inc.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  */
19 #ifndef GPU_NVIDIA_RESMAN_API_H
20 #define GPU_NVIDIA_RESMAN_API_H
21 
22 #include <stdio.h>
23 #include <stdint.h>
24 
25 #include <gpu/nvidia/resources.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
42 uint8_t rm_version_check(int ctl_fd, uint8_t ignore_version, const char* version);
43 
60 struct NvResource* rm_alloc_res(
61  int fd,
62  struct NvResource* parent,
63  uint32_t object,
64  uint32_t rm_class,
65  void* data
66 );
67 
79 uint8_t rm_free_res(int fd, struct NvResource* object);
80 
90 void rm_free_tree(int fd, struct NvResource* root);
91 
101 uint8_t rm_alloc_os_event(int fd, uint32_t client_id, uint32_t device_id);
102 
119 void* rm_ctrl_res(int fd, uint32_t client, uint32_t device, uint32_t command, void* data, uint32_t size);
120 
133 #define RM_CTRL(fd, res, cmd, data) rm_ctrl_res(fd, res->client, res->object, cmd, &data, sizeof(data))
134 
148 #define _RM_CTRL(fd, client, object, cmd, data) rm_ctrl_res(fd, client, object, cmd, &data, sizeof(data))
149 
150 #ifdef __cplusplus
151 };
152 #endif
153 
154 #endif
uint8_t rm_alloc_os_event(int fd, uint32_t client_id, uint32_t device_id)
Allocates an Operating System Event.
Definition: api.c:208
void * rm_ctrl_res(int fd, uint32_t client, uint32_t device, uint32_t command, void *data, uint32_t size)
Control resource command.
Definition: api.c:164
void rm_free_tree(int fd, struct NvResource *root)
Frees a resource tree for the system.
Definition: api.c:138
uint8_t rm_version_check(int ctl_fd, uint8_t ignore_version, const char *version)
Version check for the RM API.
Definition: api.c:39
struct NvResource * rm_alloc_res(int fd, struct NvResource *parent, uint32_t object, uint32_t rm_class, void *data)
Allocates a Node for a resource.
Definition: api.c:65
uint8_t rm_free_res(int fd, struct NvResource *object)
Frees a Node for a Resource.
Definition: api.c:124
Resource for managing NVIDIA kernel module objects.
Definition: resources.h:39
uint32_t rm_class
Class of the resource.
Definition: resources.h:46
uint32_t client
All resources require a client/root.
Definition: resources.h:43
uint32_t parent
Parent of the resource.
Definition: resources.h:44