summaryrefslogtreecommitdiff
path: root/include/user/udcd.h
blob: 789d71768f5caf8ba60b4483e625c9e8189b8862 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef _PSP2_UDCD_H_
#define _PSP2_UDCD_H_

#ifdef __cplusplus
extern "C" {
#endif

/*
 * USB Status
 */
#define SCE_UDCD_STATUS_CONNECTION_NEW		0x0001
#define SCE_UDCD_STATUS_CONNECTION_ESTABLISHED	0x0002
#define SCE_UDCD_STATUS_CONNECTION_SUSPENDED	0x0004
#define SCE_UDCD_STATUS_CABLE_DISCONNECTED	0x0010
#define SCE_UDCD_STATUS_CABLE_CONNECTED		0x0020
#define SCE_UDCD_STATUS_DEACTIVATED		0x0100
#define SCE_UDCD_STATUS_ACTIVATED		0x0200
#define SCE_UDCD_STATUS_IS_CHARGING		0x0400
#define SCE_UDCD_STATUS_USE_USB_CHARGING	0x0800
#define SCE_UDCD_STATUS_UNKNOWN_1000		0x1000
#define SCE_UDCD_STATUS_UNKNOWN_2000		0x2000

typedef struct {
	uint8_t info[64];
} SceUdcdDeviceInfo;

typedef struct {
	int unk_00;
	int unk_04;
	int unk_08;
	int unk_0C;
	int unk_10;
	const char *driverName;
} SceUdcdWaitParam;

typedef struct {
	int unk_00;
	int state;
	int cable;
	int connection;
	int use_usb_charging;
	int unk_14;
} SceUdcdDeviceState;

/**
 * Get device state
 *
 * @param[out] state - Device state
 *
 * @return 0 on success, < 0 on error.
*/
int sceUdcdGetDeviceState(SceUdcdDeviceState *state);

/**
 * Get device information
 *
 * @param[out] devInfo - Device information
 *
 * @return 0 on success, < 0 on error.
*/
int sceUdcdGetDeviceInfo(SceUdcdDeviceInfo *devInfo);

/**
 * Register callback
 *
 * @param[in] cbid - Callback UID
 * @param[in] state - State
 *
 * @return 0 on success, < 0 on error.
*/
int sceUdcdRegisterCallback(SceUID cbid, int state);

/**
 * Unregister callback
 *
 * @param[in] cbid - Callback UID
 *
 * @return 0 on success, < 0 on error.
*/
int sceUdcdUnregisterCallback(SceUID cbid);

/**
 * Wait for state
 *
 * @param[in] waitParam - Wait parameter
 * @param[in] state - State
 *
 * @return 0 on success, < 0 on error.
*/
int sceUdcdWaitState(SceUdcdWaitParam *waitParam, int state);

#ifdef __cplusplus
}
#endif

#endif /* _PSP2_UDCD_H_ */