GVM User Suite
User tools for the GVM open source project.
|
Go to the source code of this file.
Macros | |
#define | RM_CTRL(fd, res, cmd, data) rm_ctrl_res(fd, res->client, res->object, cmd, &data, sizeof(data)) |
Controls a RM Resource. More... | |
#define | _RM_CTRL(fd, client, object, cmd, data) rm_ctrl_res(fd, client, object, cmd, &data, sizeof(data)) |
Controls a RM Resource. More... | |
Functions | |
uint8_t | rm_version_check (int ctl_fd, uint8_t ignore_version, const char *version) |
Version check for the RM API. More... | |
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. More... | |
uint8_t | rm_free_res (int fd, struct NvResource *object) |
Frees a Node for a Resource. More... | |
void | rm_free_tree (int fd, struct NvResource *root) |
Frees a resource tree for the system. More... | |
uint8_t | rm_alloc_os_event (int fd, uint32_t client_id, uint32_t device_id) |
Allocates an Operating System Event. More... | |
void * | rm_ctrl_res (int fd, uint32_t client, uint32_t device, uint32_t command, void *data, uint32_t size) |
Control resource command. More... | |
#define _RM_CTRL | ( | fd, | |
client, | |||
object, | |||
cmd, | |||
data | |||
) | rm_ctrl_res(fd, client, object, cmd, &data, sizeof(data)) |
Controls a RM Resource.
This is a macro to simplify code for controlling resources.
fd | - File for controlling object on. |
client | - Client id. |
object | - Object id. |
cmd | - Command to run. |
data | - Data to use. |
#define RM_CTRL | ( | fd, | |
res, | |||
cmd, | |||
data | |||
) | rm_ctrl_res(fd, res->client, res->object, cmd, &data, sizeof(data)) |
Controls a RM Resource.
This is a macro to simplify code for controlling resources.
fd | - File for controlling object on. |
res | - Resource pointer. |
cmd | - Command to run. |
data | - Data to use. |
uint8_t rm_alloc_os_event | ( | int | fd, |
uint32_t | client_id, | ||
uint32_t | device_id | ||
) |
Allocates an Operating System Event.
This is how we can create an operating system event.
fd | - File descriptor to allocate on the OS. |
client_id | - Client ID. |
device_id | - Device ID. |
Definition at line 208 of file api.c.
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.
The RM Core uses an object oriented paradigm which forces us to create nodes and pass them into new regions.
RM Side Effect: Allocates an object with a specific class in the RM Core, for safety purposes we should call a free res for all resources available on the system. However it is not strictly necessary as there is a garbage collector inside the RM Core.
State Side Effect: Parent node is modified, to have a new child.
fd | - File for allocating the device on. |
parent | - Parent node to allocate the device on. |
object | - Object id. |
rm_class | - Class of the new object. |
data | - Pointer for allocation data. |
Invalid File Descriptor - Occurs when fd is -1.
Incorrect File Descriptor - Occurs when fd is an incorrect descriptor.
Definition at line 65 of file api.c.
void* rm_ctrl_res | ( | int | fd, |
uint32_t | client, | ||
uint32_t | device, | ||
uint32_t | command, | ||
void * | data, | ||
uint32_t | size | ||
) |
Control resource command.
The RM Core uses an object oriented paradigm which forces us to use this generic function to apply methods onto the node in question. This specifically is a method application call for an arbitrary resource.
RM Side Effect: Performs a potentially unsafe method on an object in the kernel.
Log Side Effect: Logs incorrect information.
fd | - File for controlling object on. |
client | - Client id to use. |
device | - Object id to use. |
command | - Command to use on the object. |
data | - Command data. |
size | - Size of the data. |
Invalid File Descriptor - Occurs when fd is -1.
Incorrect File Descriptor - Occurs when the fd is an incorrect file descriptor.
RM Failure - Occurs when incorrect information is placed.
Definition at line 164 of file api.c.
uint8_t rm_free_res | ( | int | fd, |
struct NvResource * | object | ||
) |
Frees a Node for a Resource.
The RM Core uses an object oriented paradigm which forces us to free nodes when we are finished. This specifically is a deconstructor call for an arbitrary resource.
fd | - File for deallocating the device on. |
object | - Object we are deallocating. |
Invalid File Descriptor - Occurs when fd is -1.
Incorrect File Descriptor - Occurs when the fd is an incorrect file descriptor.
Definition at line 124 of file api.c.
void rm_free_tree | ( | int | fd, |
struct NvResource * | root | ||
) |
Frees a resource tree for the system.
This is a mechanism by which we can free an entire tree.
fd | - File for deallocating the device on. |
root | - Root we are deallocating from. |
Definition at line 138 of file api.c.
uint8_t rm_version_check | ( | int | ctl_fd, |
uint8_t | ignore_version, | ||
const char * | version | ||
) |
Version check for the RM API.
RM API version check must be performed before running code.
ctl_fd | - The RM version check can only be performed on the ctl file. |
ignore_version | - If we ignore the version of the RM API. |
version | - Version we use for the RMCore. |
Invalid File Descriptor - This occurs when ctl_fd is -1.
Invalid RM Version - This will occur when there is a mismatch on the driver and the user suite.
Seg Fault - This occurs if version is not pointing to NULL but is pointing to a previously allocated memory address.
Definition at line 39 of file api.c.