Files
vitasdk-odin/UsbSerial/UsbSerial.odin
T

142 lines
3.3 KiB
Odin

package usbserial
import "core:c"
import sce "../common"
foreign import usbserial "system:SceUsbSerial_stub"
foreign import usbserialkern "system:SceUsbSerialForDriver_stub"
@(link_prefix = "sceUsbSerial")
foreign usbserial {
/**
* 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 StartForDriver()
*/
Start :: proc() -> c.int ---
/**
* Setup USB serial device
*
* @return 0 on success, < 0 on error
*
* @param unk Unknown
*
* @note Wrapper for kernel function SetupForDriver()
*/
Setup :: proc(unk: c.int) -> c.int ---
/**
* Close USB serial device
*
* @note Wrapper for kernel function CloseForDriver()
*/
Close :: proc() -> c.int ---
/**
* Close USB serial device
*
* @return Returns 1 when serial port is open
*
* @note Wrapper for kernel function StatusForDriver()
*/
Status :: proc() -> c.int ---
/**
* Get receive buffer length
*
* @return Returns length of USB rx buffer
*
* @note Wrapper for kernel function GetLenForDriver()
*/
GetRecvBufferSize :: proc() -> c.uint ---
/**
* 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 SendForDriver()
*/
Send :: proc(buffer: rawptr, len: c.uint, unk1: c.int, unk2: c.int) -> c.uint ---
/**
* 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 RecvForDriver()
*/
Recv :: proc(buffer: rawptr, max_len: c.uint, unk1: c.int, unk2: c.int) -> c.uint ---
}
foreign usbserialkern {
/**
* 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.
*/
ksceUsbSerialStart :: proc() -> c.int ---
/**
* Setup USB serial device
*
* @return 0 on success, < 0 on error
*
* @param unk Unknown
*/
ksceUsbSerialSetup :: proc(unk: c.int) -> c.int ---
/**
* Get USB device status
*
* @return Returns 1 when serial port is open
*/
ksceUsbSerialStatus :: proc() -> c.int ---
/**
* Close USB serial device
*/
ksceUsbSerialClose :: proc() -> c.int ---
/**
* Get receive buffer length
*
* @return Returns length of USB rx buffer
*/
ksceUsbSerialGetRecvBufferSize :: proc() -> c.uint ---
/**
* Send data
*
* @param[in] *buffer data to send over usb
* @param[in] len int len of serial buffer data
* @param unk1 Unknown
* @param unk2 Unknown
* @note max send length is 0x10000
*/
ksceUsbSerialSend :: proc(buffer: rawptr, len: sce.Size, unk1: c.int, unk2: c.int) -> sce.Size ---
/**
* Receive Data
*
* @param[out] *buffer buffer for incoming data
* @param[in] max_len max data length to receive
* @param unk1 Unknown
* @param unk2 Unknown
* @note max recv length is 0x10000
*/
ksceUsbSerialRecv :: proc(buffer: rawptr, max_len: sce.Size, unk1: c.int, unk2: c.int) -> sce.Size ---
}