aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / uefi-raw / src / protocol / usb / io.rs
| 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 |
| 2 | |
| 3 | use core::ffi; |
| 4 | |
| 5 | use crate::{Boolean, Char16, Guid, Status, guid}; |
| 6 | |
| 7 | use super::{ |
| 8 | AsyncUsbTransferCallback, ConfigDescriptor, DataDirection, DeviceDescriptor, DeviceRequest, |
| 9 | EndpointDescriptor, InterfaceDescriptor, UsbTransferStatus, |
| 10 | }; |
| 11 | |
| 12 | #[derive(Debug)] |
| 13 | #[repr(C)] |
| 14 | pub struct UsbIoProtocol { |
| 15 | pub control_transfer: unsafe extern "efiapi" fn( |
| 16 | this: *mut Self, |
| 17 | request: *const DeviceRequest, |
| 18 | direction: DataDirection, |
| 19 | timeout: u32, |
| 20 | data: *mut ffi::c_void, |
| 21 | data_length: usize, |
| 22 | status: *mut UsbTransferStatus, |
| 23 | ) -> Status, |
| 24 | pub bulk_transfer: unsafe extern "efiapi" fn( |
| 25 | this: *mut Self, |
| 26 | device_endpoint: u8, |
| 27 | data: *mut ffi::c_void, |
| 28 | data_length: *mut usize, |
| 29 | timeout: usize, |
| 30 | status: *mut UsbTransferStatus, |
| 31 | ) -> Status, |
| 32 | pub async_interrupt_transfer: unsafe extern "efiapi" fn( |
| 33 | this: *mut Self, |
| 34 | device_endpoint: u8, |
| 35 | is_new_transfer: Boolean, |
| 36 | polling_interval: usize, |
| 37 | data_length: usize, |
| 38 | interrupt_callback: Option<AsyncUsbTransferCallback>, |
| 39 | context: *const ffi::c_void, |
| 40 | ) -> Status, |
| 41 | pub sync_interrupt_transfer: unsafe extern "efiapi" fn( |
| 42 | this: *mut Self, |
| 43 | device_endpoint: u8, |
| 44 | data: *mut ffi::c_void, |
| 45 | data_length: *mut usize, |
| 46 | timeout: usize, |
| 47 | status: *mut UsbTransferStatus, |
| 48 | ) -> Status, |
| 49 | pub isochronous_transfer: unsafe extern "efiapi" fn( |
| 50 | this: *mut Self, |
| 51 | device_endpoint: u8, |
| 52 | data: *mut ffi::c_void, |
| 53 | data_length: usize, |
| 54 | status: *mut UsbTransferStatus, |
| 55 | ) -> Status, |
| 56 | pub async_isochronous_transfer: unsafe extern "efiapi" fn( |
| 57 | this: *mut Self, |
| 58 | device_endpoint: u8, |
| 59 | data: *mut ffi::c_void, |
| 60 | data_length: usize, |
| 61 | isochronous_callback: AsyncUsbTransferCallback, |
| 62 | context: *const ffi::c_void, |
| 63 | ) -> Status, |
| 64 | pub get_device_descriptor: unsafe extern "efiapi" fn( |
| 65 | this: *mut Self, |
| 66 | device_descriptor: *mut DeviceDescriptor, |
| 67 | ) -> Status, |
| 68 | pub get_config_descriptor: unsafe extern "efiapi" fn( |
| 69 | this: *mut Self, |
| 70 | config_descriptor: *mut ConfigDescriptor, |
| 71 | ) -> Status, |
| 72 | pub get_interface_descriptor: unsafe extern "efiapi" fn( |
| 73 | this: *mut Self, |
| 74 | interface_descriptor: *mut InterfaceDescriptor, |
| 75 | ) -> Status, |
| 76 | pub get_endpoint_descriptor: unsafe extern "efiapi" fn( |
| 77 | this: *mut Self, |
| 78 | endpoint_index: u8, |
| 79 | endpoint_descriptor: *mut EndpointDescriptor, |
| 80 | ) -> Status, |
| 81 | pub get_string_descriptor: unsafe extern "efiapi" fn( |
| 82 | this: *mut Self, |
| 83 | lang_id: u16, |
| 84 | string_id: u8, |
| 85 | string: *mut *mut Char16, |
| 86 | ) -> Status, |
| 87 | pub get_supported_languages: unsafe extern "efiapi" fn( |
| 88 | this: *mut Self, |
| 89 | lang_id_table: *mut *mut u16, |
| 90 | table_size: *mut u16, |
| 91 | ) -> Status, |
| 92 | pub port_reset: unsafe extern "efiapi" fn(this: *mut Self) -> Status, |
| 93 | } |
| 94 | |
| 95 | impl UsbIoProtocol { |
| 96 | pub const GUID: Guid = guid!("2b2f68d6-0cd2-44cf-8e8b-bba20b1b5b75"); |
| 97 | } |