summaryrefslogtreecommitdiff
path: root/include/user/usbserial.h
blob: 00c9ba6e632aa36ab08638a15a3d912bcd13ce55 (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
#ifndef _PSP2_USBSERIAL_H_
#define _PSP2_USBSERIAL_H_

#include <psp2/types.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Activate USB serial device
 *
 * @return 0 on success, < 0 on error
 *
 * @note The user is responsible for making sure no other UDC driver is active. This activates UDC as a "PS Vita" Type D device. 
 *
 * @note Wrapper for kernel function sceUsbSerialStart()
 */
int sceUsbSerialStart(void);

/**
 * Setup USB serial device
 *
 * @return 0 on success, < 0 on error
 *
 * @param unk Unknown 
 *
 * @note Wrapper for kernel function sceUsbSerialSetup()
 */
int sceUsbSerialSetup(int unk);	

/**
 * Close USB serial device
 *
 * @note Wrapper for kernel function sceUsbSerialClose()
 */
int sceUsbSerialClose(void);

/**
 * Close USB serial device
 *
 * @return Returns 1 when serial port is open
 *
 * @note Wrapper for kernel function sceUsbSerialStatus()
 */
int sceUsbSerialStatus(void);

/**
 * Get receive buffer length
 *
 * @return Returns length of USB rx buffer
 *
 * @note Wrapper for kernel function sceUsbSerialGetLen()
 */
unsigned int sceUsbSerialGetRecvBufferSize(void);

/**
 * Send data
 * @param[in] *buffer data to send over usb
 * @param len int len of serial buffer data 
 * @param unk1 Unknown
 * @param unk2 Unknown
 * @note max send length is 0x10000
 * @note Wrapper for kernel function sceUsbSerialSend()
 */
unsigned int sceUsbSerialSend(const void *buffer, unsigned int len, int unk1, int unk2);

/**
 * Receive Data
 *
 * @param[out] *buffer buffer for incoming data
 * @param max_len max data length to receive
 * @param unk1 Unknown
 * @param unk2 Unknown
 * @note max recv length is 0x10000
 * @note Wrapper for kernel function sceUsbSerialRecv()
 */
unsigned int sceUsbSerialRecv(void *buffer, unsigned int max_len, int unk1, int unk2);

#ifdef __cplusplus
}
#endif
#endif