22 lines
2.0 KiB
OCaml
22 lines
2.0 KiB
OCaml
open Ctypes
|
|
|
|
module U = T.Types(My_types)
|
|
|
|
module P(F:Cstubs.FOREIGN) = struct
|
|
open F
|
|
let error_name = foreign "libusb_error_name" (U.error @-> returning string)
|
|
let error_description = foreign "libusb_strerror" (U.error @-> returning string)
|
|
let init = foreign "libusb_init" (ptr void @-> returning U.error)
|
|
let exit = foreign "libusb_exit" (ptr void @-> returning void)
|
|
let get_version = foreign "libusb_get_version" (void @-> returning (ptr U.version))
|
|
let get_device_list = foreign "libusb_get_device_list" (ptr void @-> ptr (ptr (ptr U.device)) @-> returning U.error)
|
|
let free_device_list = foreign "libusb_free_device_list" (ptr (ptr U.device) @-> int @-> returning void)
|
|
let unref_device = foreign "libusb_unref_device" (ptr U.device @-> returning void)
|
|
let open_device = foreign "libusb_open" (ptr U.device @-> ptr (ptr U.device_handle) @-> returning U.error)
|
|
let close_device = foreign "libusb_close" (ptr U.device_handle @-> returning void)
|
|
let get_device_descriptor = foreign "libusb_get_device_descriptor" (ptr U.device @-> ptr U.device_descriptor @-> returning U.error)
|
|
let get_string_descriptor_ascii = foreign "libusb_get_string_descriptor_ascii" (ptr U.device_handle @-> uint8_t @-> ptr char @-> int @-> returning U.error)
|
|
let control_transfer = foreign "libusb_control_transfer" (ptr U.device_handle @-> uint8_t @-> uint8_t @-> uint16_t @-> uint16_t @-> ptr char @-> uint16_t @-> uint @-> returning U.error)
|
|
let bulk_transfer = foreign "libusb_bulk_transfer" (ptr U.device_handle @-> uint8_t @-> ptr char @-> int @-> ptr int @-> uint @-> returning U.error)
|
|
end
|