libnx  v4.8.0
nv.h
Go to the documentation of this file.
1 /**
2  * @file nv.h
3  * @brief NVIDIA low level driver (nvdrv*) service IPC wrapper.
4  * @author yellows8
5  * @copyright libnx Authors
6  */
7 #pragma once
8 #include "../types.h"
9 #include "../sf/service.h"
10 #include "../kernel/event.h"
11 
12 /// NvServiceType, for __nx_nv_service_type.
13 typedef enum {
14  NvServiceType_Auto = -1, ///< This is the default. Automatically select the type using \ref appletGetAppletType.
15  NvServiceType_Application = 0, ///< Initializes nvdrv.
16  NvServiceType_Applet = 1, ///< Initializes nvdrv:a.
17  NvServiceType_System = 2, ///< Initializes nvdrv:s.
18  NvServiceType_Factory = 3, ///< Initializes nvdrv:t.
20 
21 /// Initialize nvdrv*.
23 
24 /// Exit nvdrv*.
25 void nvExit(void);
26 
27 /// Gets the Service object for the actual nvdrv* service session.
29 
30 typedef enum {
31  NvEventId_Gpu_SmException_BptIntReport=1,
32  NvEventId_Gpu_SmException_BptPauseReport=2,
33  NvEventId_Gpu_ErrorNotifier=3,
34 
35  NvEventId_CtrlGpu_ErrorEventHandle=1,
36  NvEventId_CtrlGpu_Unknown=2,
37 } NvEventId;
38 
39 #define NV_EVENT_ID_CTRL__SYNCPT(slot, syncpt) \
40  ((1u<<28) | ((syncpt) << 16) | (slot))
41 
42 Result nvOpen(u32 *fd, const char *devicepath);
43 Result nvIoctl(u32 fd, u32 request, void* argp);
44 Result nvIoctl2(u32 fd, u32 request, void* argp, const void* inbuf, size_t inbuf_size); ///< [3.0.0+]
45 Result nvIoctl3(u32 fd, u32 request, void* argp, void* outbuf, size_t outbuf_size); ///< [3.0.0+]
46 Result nvClose(u32 fd);
47 Result nvQueryEvent(u32 fd, u32 event_id, Event *event_out);
48 
49 Result nvConvertError(int rc);
Result nvIoctl3(u32 fd, u32 request, void *argp, void *outbuf, size_t outbuf_size)
[3.0.0+]
Result nvInitialize(void)
Initialize nvdrv*.
Service * nvGetServiceSession(void)
Gets the Service object for the actual nvdrv* service session.
NvServiceType
NvServiceType, for __nx_nv_service_type.
Definition: nv.h:13
@ NvServiceType_System
Initializes nvdrv:s.
Definition: nv.h:17
@ NvServiceType_Applet
Initializes nvdrv:a.
Definition: nv.h:16
@ NvServiceType_Application
Initializes nvdrv.
Definition: nv.h:15
@ NvServiceType_Auto
This is the default. Automatically select the type using appletGetAppletType.
Definition: nv.h:14
@ NvServiceType_Factory
Initializes nvdrv:t.
Definition: nv.h:18
Result nvIoctl2(u32 fd, u32 request, void *argp, const void *inbuf, size_t inbuf_size)
[3.0.0+]
void nvExit(void)
Exit nvdrv*.
Kernel-mode event structure.
Definition: event.h:13
Service object structure.
Definition: service.h:14
u32 Result
Function error code result type.
Definition: types.h:44
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21